Troubles in installing PyTorch on Jetbot

I tried installing PyTorch on my JetBot (I’m new to this forum so correct me If I’m wrong) using the pip command, pip install torch, and it gives me the following error:

Collecting torch Using cached torch-0.1.2.post2.tar.gz (128 kB) ERROR: Command errored out with exit status 1: command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gEAVA7/torch/'"'"'; __file__='"'"'/tmp/pip-install-gEAVA7/torch/'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-XmtaIM cwd: /tmp/pip-install-gEAVA7/torch/ Complete output (8 lines): running egg_info creating /tmp/pip-pip-egg-info-XmtaIM/torch.egg-info writing requirements to /tmp/pip-pip-egg-info-XmtaIM/torch.egg-info/requires.txt writing /tmp/pip-pip-egg-info-XmtaIM/torch.egg-info/PKG-INFO writing top-level names to /tmp/pip-pip-egg-info-XmtaIM/torch.egg-info/top_level.txt writing dependency_links to /tmp/pip-pip-egg-info-XmtaIM/torch.egg-info/dependency_links.txt writing manifest file '/tmp/pip-pip-egg-info-XmtaIM/torch.egg-info/SOURCES.txt' error: package directory 'torch/cuda' does not exist ---------------------------------------- ERROR: Command errored out with exit status 1: python egg_info Check the logs for full command output.

But when I do pip3 install torch, it gives me something different:

Collecting torch
Cache entry deserialization failed, entry ignored
Using cached
Complete output from command python egg_info:
running egg_info
creating pip-egg-info/torch.egg-info
writing pip-egg-info/torch.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/torch.egg-info/dependency_links.txt
writing requirements to pip-egg-info/torch.egg-info/requires.txt
writing top-level names to pip-egg-info/torch.egg-info/top_level.txt
writing manifest file ‘pip-egg-info/torch.egg-info/SOURCES.txt’
error: package directory ‘torch/cuda’ does not exist

Command “python egg_info” failed with error code 1 in /tmp/pip-build-biqdk0si/torch/

I tried one of the .whl files in the PyTorch for Jetson - version 1.7.0 now available post, but they do not seem to open.
I’m pretty sure I’m missing something basic here, where have I gone wrong?

Hi @alok76in, if you are using the SD card image or containers, it should already have PyTorch installed. You may need to run the container to see PyTorch installed in python3.

To answer your question directly, should you install PyTorch manually, you would do it using one of the wheels from the post you linked to. When you say they don’t seem to open, what error message are you getting? You want to install one of the wheels that matches the version of JetPack-L4T that you are running (you can check your L4T version with cat /etc/nv_tegra_release)