Robotics StackExchange | Archived questions

ImportError: No module named 'torch'

Hi,

After writing a command "python3 predict_img.py" to run a script, I have an error:

Traceback (most recent call last):
  File "predict_img.py", line 1, in <module>
    import torch
ImportError: No module named 'torch'

I have installed PyTorch. What can be the reason for this problem?

Thanks a lot!

Asked by Kora11101 on 2019-10-18 11:16:57 UTC

Comments

I'm confused as to how this related to ROS.

You tagged kinetic meaning you're probably on 16.04. Is pytorch installed systemwide for python 2 or python 3? Or have you been using virtualenvs? What is the variable $PYTHONPATH set to?

Asked by Jari on 2019-10-18 12:04:27 UTC

Answers