ImportError: No module named torch.autograd
See original GitHub issueHello all!, It seems install is ok
Requirement already satisfied: torchvision in /usr/local/lib/python3.8/dist-packages (0.8.1) Requirement already satisfied: torch==1.7.0 in /usr/local/lib/python3.8/dist-packages (from torchvision) (1.7.0) Requirement already satisfied: pillow>=4.1.1 in /usr/lib/python3/dist-packages (from torchvision) (7.2.0) Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from torchvision) (1.19.2) Requirement already satisfied: future in /usr/lib/python3/dist-packages (from torch==1.7.0->torchvision) (0.18.2) Requirement already satisfied: typing-extensions in /usr/lib/python3/dist-packages (from torch==1.7.0->torchvision) (3.7.4.3) Requirement already satisfied: dataclasses in /usr/local/lib/python3.8/dist-packages (from torch==1.7.0->torchvision) (0.6)
Guided by Installation instructions all ok except when I launch:
# python run.py --input_folder /imgs/ --output_folder /imgs/output/ --GPU 0
Running Stage 1: Overall restoration Traceback (most recent call last): File "test.py", line 6, in <module> from torch.autograd import Variable ImportError: No module named torch.autograd Traceback (most recent call last): File "run.py", line 91, in <module> for x in os.listdir(stage_1_results): OSError: [Errno 2] No such file or directory: '/imgs/output/stage_1_restore_output/restored_image'
root@DESKTOP-H0VF09L:/home/akenateb/Bringing-Old-Photos-Back-to-Life# python Python 2.7.18 (default, Apr 20 2020, 20:30:41) [GCC 9.3.0] on linux2
`
What I am doing wrong?
Thanks in advance.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
For me the same on MacOS Catalina, any news ?
I updated to python 3.8.7 and added to ~/.bash_profile the alias ‘alias python=python3’ I also installed the related frameworks
Requirement already satisfied: torch in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (1.7.1) Requirement already satisfied: torchvision in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (0.8.2)
UPDATE: I found a solution now for my case. I found out that the on terminal called run.py script was working with python3 but all other py scripts which was called by code was running with python2. I don’t know why (i changed the alias in ~/.bash_profile and restartet the terminal session, but still this issue. So my solution was to just change in Global/test.py all “python …” calls to python3.
Not it runs, but on mac i have to switch off the use of GPU by “–gpu_ids -1” - there is no support for it (error: “AttributeError: module ‘torch._C’ has no attribute ‘_cuda_setDevice’”)
when the error(error: “AttributeError: module ‘torch._C’ has no attribute ‘_cuda_setDevice’”) occured. just set GPU to ‘-1’ like this
--GPU -1