-
Notifications
You must be signed in to change notification settings - Fork 24.1k
ModuleNotFoundError: No module named 'torch._C' #574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Solutionthe problem is that you have a folder called [Edited to add the snippet above, rather than buried down in the thread]
|
you cannot rename pip wheels like that and expect them to work. We shall include pip wheels for python 3.6 from the next release. |
@soumith You're definitely right. I have tried it because this procedure works for TensorFlow like a charm :D @apaszke Here your are:
If I can give you any other information about the issue feel free to ask, I'm happy to help you! |
Yeah, so you can see that there's |
Thank you for your help! I'll try it 👍 |
Hi, I met the same problem when installing PyTorch with Python 2.7.13 和 Anaconda 4.3.0 (64-bit). Would you give me a hint? The installing way is written as follows: After that, the system told me that PyTorch is installed. Then I wrote down 'python' in the prompt command line. At last, 'import torch' was entered in the python command line. Unfortunately , I got the following information: The package /usr/lib/python2.7/site-packages has no torch package. The pytorch has a package torch, and has the following files: |
you are not using anaconda python, as it is looking for packages in |
The output of 'which python' is '/root/anaconda2/bin/python'. Just now, I also wrote down the '/root/anaconda2/bin/python' in the command line, and use 'import torch' in the python command line. The result is the same: |
In addition, I installed torch 7 in another package before installing pytorch. The OS is centos 7. |
@phenixcx the problem is that you have a folder called |
Great! It really work. Thank you very much. The package locations make pytorch confused. |
@soumith genius observation! |
@soumith your suggestion really helps! confused by this problem for a long time. Hope everyone who has the same problem can find this solution successfully. |
@soumith Thank you so much I was getting crazy over this error |
@soumith Thanks a lot! |
Solved my problem too! Thanks @soumith |
Gah, I hit this point twice so far :-P . By the way, the issue also arises if you dutifully cd into home directory, but the script itself is in the cloned |
oh god, that was it |
worked! |
worked! |
I got the same error after built from source of branch v0.3.0 My system is OSX10.12, python version is 3.6.1. I don't use anaconda python. I installed all the optional dependency through pip3. I disabled CUDA support by Changed the installation command a little bit to fit my system: got 7 warnings in the middle of building:
Besides these warnings, the installation looks ok to me. |
@Jonbean Hi, I just clone the lateset version of pytorch from master branch. And I have successfully installed it. Why not try master branch? |
i`m having the same issue: ImportErrorTraceback (most recent call last) ImportError: No module named 'torch' i`m using jupyter notebook after install the pytorch, and i dont know how to solve that problem. |
Could you please make this comment more visible? It's the second time I arrive in this thread and it's the second time that's the solution... |
@talesa added the solution to the 2nd post in the thread: #574 (comment) |
I am having a similar issue. And the solution here doesn't seem to work for me. I started following the Practical Deep Learning for Coders course at http://course.fast.ai/. I use Windows 7, and Jupyter Notebook started through Anaconda Navigator. When doing imports at the start of the lesson, I get the following error:
I also tried to do
I tried doing And I tried it after deactivating my fastai channel:
Can someone help me with this problem? |
@PJvG Did you find a solution to your issue? |
Not sure if you managed to tackle this @BulNik , but once you built the wheel, it will be in
replace the wheel file's name with yours It works on my Raspberry Pi 4 Model B at least. Let me know if you're still having issues! |
After doing the cd... approach, Strangely, restarting and resetting all in my google colabs resolved this issue. Maybe trying this first first could save time. Not sure why though |
Hi, I made that. And I have a new error :( import torch |
* refactor tests * add category based type promotion * add category test * re-order test * clang-tidy; improve integer variance * flake
* CUDA 11.1 Windows builder * Update driver_update.bat * update driver * Update smoke_test.bat
Hello, I have the same issue with my python script. I'm on a AWS EC2 instance and using Python3.3.9, with Here is my python script:
And here is the error message. As you can see, it successfully import
And I cannot locate files named like
I would appreciate for any help! Thanks |
Same problem here, python 3.10.6, when doing: |
Hi @jstalahua @Makoto1021 @ndvbd 👋 Regarding your respective issues, in all the cases I've seen so far:
So I suggest checking if the problem occurs if you run the command where there is a "torch" folder (if so, run the command somewhere else). And otherwise, install an existing build 😄 |
I have the same exact problem:
|
Hi @monajalal 👋 That indeed looks like the same situation. Have you checked my suggestions above? |
Hi! Can someone help me with the following error? I was trying to install xformers from taking instructions from here and I don't understand where I am going wrong.
Would really appreciate your help! |
Hi @generalistbloke 👋 Have you checked my previous answer above? I hope this helps ✌️ |
Hi, I have been trying to work with sentence-transformers/all-MiniLM-L12-v2 from hugging face. I pip installed it using the command from hugging face, though I am unable to use it. I am using vscode and am in a virtual environment created using the
and get the following error:
Could anyone advise on what I may be doing wrong? |
Hey @aayushjACN, Have you tried the solutions in this thread?
That should put us on good tracks to help you out! |
Hey @frgfm, Thanks for your prompt feedback! I have managed to fix the issue, turns out I just had to restart my VSCode and it worked fine. Must have been some glitch. Cheers, |
Traceback (most recent call last): |
Hey @alaaeddinebessghaier 👋 We can't do much with the traceback and no context 😅 Mind sharing a bit more? Ideally, we need to be able to reproduce this locally (so minimal reproducible snippet + expected result) |
Yeah, reinstalling works |
For me the solution was to make sure the torch is being installed with venv enabled:
then:
If permission issues on Windows, try firstly:
and proceed again with mentioned commands. |
Hi there,
I have downloaded the PyTorch pip package CPU version for Python 3.5 from the official webpage. I downloaded it using wget and I renamed the package in order to install the package on ArchLinux with Python 3.6. After that, I used the
pip install
command to install the package and no error messages are shown. Thetorchvision
package is correctly installed.If I try to import the
torch
module usingimport torch
in an ipython session or in a Python session I receive the following error:Any ideas?
Best regards,
Alessandro
The text was updated successfully, but these errors were encountered: