Skip to content
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

ImportError: No module named torch #26

Closed
yunyinghan opened this issue Nov 17, 2017 · 3 comments
Closed

ImportError: No module named torch #26

yunyinghan opened this issue Nov 17, 2017 · 3 comments

Comments

@yunyinghan
Copy link

i run python demo.py , has error. can you help me

xiaomingli15:sceneReco yyh$ python demo.py objc[2455]: Class CaptureDelegate is implemented in both /Library/Python/2.7/site-packages/cv2/cv2.so (0x10ff5ddc0) and /usr/local/opt/opencv/lib/libopencv_videoio.3.3.dylib (0x11235a618). One of the two will be used. Which one is undefined. Traceback (most recent call last): File "demo.py", line 3, in <module> from crnnport import * File "/Users/yyh/Documents/study/sceneReco/crnnport.py", line 6, in <module> import torch ImportError: No module named torch

@chenmozxh
Copy link

you need install pytorch, see http://pytorch.org/

@Melody12ab
Copy link

install pytorch: pip install --upgrade torchvision

@bear63 bear63 closed this as completed Sep 12, 2018
@RobbyHuang
Copy link

RobbyHuang commented May 19, 2019

I used "conda install " command to install pytorch 1.1.0. And I successfully run python3 import torch.
Also I successfully run import torch in jupyter notebook and ipython. But when I run a .py file through a sh file, it failed with the error "ImportError: No module named 'torch'".
How can I handle it. Thank you so much!

$ sudo sh ./experiments/scripts/train_linemod.sh

  • set -e
  • export PYTHONUNBUFFERED=True
  • export CUDA_VISIBLE_DEVICES=0
  • python3 ./tools/train.py --dataset linemod --dataset_root ./datasets/linemod/Linemod_preprocessed
    Traceback (most recent call last):
    File "./tools/train.py", line 13, in
    import torch
    ImportError: No module named 'torch'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants