Closed gitassia closed 2 years ago
make sure you are using python3
if you use pip3, or python
if you used pip. Sometimes both coexist but are not the same thing.
Also check inside your script if you can import torch and call torch device. If that doesn't work there's something wrong with the setup and you should try again installing torch.
Also recommend listing your os. If you are using windows, please use WSL 2.0 with Ubuntu 18 as I have not tried on windows PowerShell.
Also please post your complete code, as well as what commands you wrote from installation to when you execute it. That would be helpful
I am using python 3, and pip3. I tried to import torch and no error appeared but when I tried to import torch.device that error appeared again. I have already install and reinstall torch and the problem still exist. For the code I used exactly what was written in the tutorial and when I got this error, I uninstalled and reinstalled torch according to the pytorch guide thinking that it is a version change but apparently it is not the case. I also tried a solution on the web with torch.cuda but it didn't fix the problem and it also mentions torch has no attribute named cuda. @xhlulu
I think there's a problem with your torch installation. Unfortunately I'm no familiar with how torch works and can't point you to a different direction other than check torch.version
You might want to look through the issues on the torch repository.
Or try installing with python -m pip install torch
can you run the following code in python?
import torch
print(torch.__version__)
print(torch.device)
and let me know if that creates an error?
yes of course here is the error, I think I will have to reinstall all the packages and try again maybe there is a confusion between the names so can I use this command ?: pip uninstall dl-translate @xhlulu
Likely a confusion. Make sure there's no file named torch.py in the same directory as your code.
@gitassia Since this is an issue with torch
, I recommend you to open an issue on https://github.com/pytorch/pytorch/issues and maybe link to this issue if relevant. I'll close this for now.
Hello , @xhlulu Please find attached the part of the tutorial that I tried to execute and where I find the error. NB : I used the guide of Pytorch to install torch according to the command appropriate to my system which is: pip3 install torch torchvision torchaudio . The version of torch is 1.10.1 and my python version is 3.8.5 .
Thank you for your help.