ImportError: No module named 'torch' [closed]

asked 2019-10-18 11:16:57 -0600

Kora11101 gravatar image

updated 2019-10-21 03:39:11 -0600

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!

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by stevemacenski
close date 2019-10-18 14:54:34.715366

Comments

1

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?

Jari gravatar imageJari ( 2019-10-18 12:04:27 -0600 )edit