Pytorch on jetson tx1

Hi Experts

Have anybody succcesfully installed Pytorch on Jetson Tx1?

Looking for a script.

I have already tried the following (with errors):

I tried the script by Dusty_nv:

But when I ran: python build_deps

I got the following error:

[ 37%] Building CXX object caffe2/CMakeFiles/caffe2.dir/operators/
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
caffe2/CMakeFiles/caffe2.dir/build.make:4998: recipe for target ‘caffe2/CMakeFiles/caffe2.dir/utils/’ failed
make[2]: *** [caffe2/CMakeFiles/caffe2.dir/utils/] Error 4
make[2]: *** Waiting for unfinished jobs…
CMakeFiles/Makefile2:2800: recipe for target ‘caffe2/CMakeFiles/caffe2.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/caffe2.dir/all] Error 2
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2
Failed to run ‘bash …/tools/ --use-cuda --use-nnpack nccl caffe2 libshm gloo c10d THD’

Any hints?



Hi sojohans,

Are you able to monitor the memory usage while compiling PyTorch? (you can do this using the ‘top’ or ‘~/tegrastats’ command)

I would guess that the TX1 is running out of memory when compiling PyTorch. You can see this discussion

If this is the case you can create a swap file. Let me know if you need help here.


Hej John

Thanks for the hints.

I will try to see if I can run ~/tegrasetats during the compilation.

If you have guide for making a swapfile I would be very happy…


ps. I am using a microsd as bootfs


To create 4GB of swap you could do the following

sudo fallocate -l 4G /mnt/swapfile
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile

After this, you should see 4GB of swap memory when visualizing memory usage with the ‘top’ command.

Once you’re done building, you may want to free up this disk space used for the swap memory. To release and delete the swapfile you could then do.

sudo swapoff /mnt/swapfile
sudo rm /mnt/swapfile

You can also check this guide

Let me know if you have any other questions.


Hi John

That helped.

I was now able install pytorch.

Thank you very much.