I'm trying to install this framework from Github called torch2trt (found here:).
I ran the following code in a Python terminal to install it:
git clone
cd torch2trt
python setup.py installbut ended up with the following error message:
Traceback (most recent call last): File "setup.py", line 2, in <module> import torch
ImportError: No module named torchI have already installed pytorch using pip install torch torchvision
Does anyone know how to resolve this?
25 Answers
Try running everything in python3:
python3 -m pip install torch torchvisionfollowed by :
python3 setup.py install In Linux,
which python
which pipIn Windows power shell
where python
where pipCheck if both pip and python are from same parent directory.
python defaults to python2
So you should change python setup.py install to python3 setup.py install
Otherwise you can check the PyTorch page and try another version.
I would try this one first.
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f
0You haven't installed Torch. Install it with pip via: