# Cannot install pytorch

**URL:** <https://forums.developer.nvidia.com/t/cannot-install-pytorch/149226>\
**Category:** Jetson Nano\
**Tags:** pytorch, ai-training\
**Created:** [August 28, 2020, 6:54am UTC](https://forums.developer.nvidia.com/t/cannot-install-pytorch/149226 "2020-08-28T06:54:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dj\_pcv](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dj\_pcv](https://forums.developer.nvidia.com/u/dj_pcv)\
**Post date:** [August 28, 2020, 6:54am UTC](https://forums.developer.nvidia.com/t/cannot-install-pytorch/149226/1 "2020-08-28T06:54:55Z")

</div>

I’ve downloaded the wheel of pytorch 1.6 for the nvidia platform from their github, and have been attempting to install it. The install process appears to run, but when I try to import it in python, it returns an error:

File “/usr/lib/python3.6/ctypes/ **init**.py”, line 348, in **init**  
self.\_handle = \_dlopen(self.\_name, mode)  
OSError: libmpi\_cxx.so.20: cannot open shared object file: No such file or directory

When I try to run the hello-world AI tutorial, it works fine up until the part where I try to train a network on new data, at which point it says it cannot find the torch library. I’ve run all the commands specified in the tutorial. When that didn’t work, I tried downloading the wheel directly rather than using the installer.  
Back when I was using the tutorial’s commands, it was returning a different error, having to do with libcudart. Using the official wheel fixed that error, and now it’s hitting the libmpi error.

This has been occurring with wheels from different sources as well. Other packages like tensorflow or numpy import fine.  
I’m using the jetson nano, and am not running this inside a docker container or in a conda environment.

What am I missing? How did you guys get this working?

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [August 28, 2020, 7:38am UTC](https://forums.developer.nvidia.com/t/cannot-install-pytorch/149226/3 "2020-08-28T07:38:00Z")

</div>

Hi,

It’s recommended to use [`l4t-pytorch`](https://ngc.nvidia.com/catalog/containers/nvidia:l4t-pytorch) and [`l4t-ml`](https://ngc.nvidia.com/catalog/containers/nvidia:l4t-ml) containers from [**NGC**](https://ngc.nvidia.com/catalog/all?orderBy=modifiedDESC&query=l4t&quickFilter=&filters=) for pyTorch v1.6.

For more detail, please check this topic:

> [@PyTorch for Jetson](https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available/72048):
>
> Below are pre-built PyTorch pip wheel installers for Jetson Nano, TX1/TX2, Xavier, and Orin with JetPack 4.2 and newer. Download one of the PyTorch binaries from below for your version of JetPack, and see the installation instructions to run on your Jetson. These pip wheels are built for ARM aarch64 architecture, so run these commands on your Jetson (not on a host PC). You can also use the pre-built [l4t-pytorch](https://ngc.nvidia.com/catalog/containers/nvidia:l4t-pytorch) and [l4t-ml](https://ngc.nvidia.com/catalog/containers/nvidia:l4t-ml) container images and [Dockerfiles](https://github.com/dusty-nv/jetson-containers). PyTorch pip wheels JetPack 5 
> 
> > **PyTo…**
> >

Thanks.

---

<div class="post-metadata">

**Author:** ![dj\_pcv](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dj\_pcv](https://forums.developer.nvidia.com/u/dj_pcv)\
**Post date:** [August 28, 2020, 8:23am UTC](https://forums.developer.nvidia.com/t/cannot-install-pytorch/149226/4 "2020-08-28T08:23:12Z")

</div>

It looks like that did it! Thanks so much!

---

<div class="post-metadata">

**Author:** ![dusty\_nv](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dusty_nv/32/14043_2.png) [@dusty\_nv](https://forums.developer.nvidia.com/u/dusty_nv)\
**Post date:** [August 28, 2020, 8:06pm UTC](https://forums.developer.nvidia.com/t/cannot-install-pytorch/149226/5 "2020-08-28T20:06:16Z")

</div>

> [@dj\_pcv](#):
>
> OSError: libmpi\_cxx.so.20: cannot open shared object file: No such file or directory

For others who may read this thread - you have to run this before installing the PyTorch wheel:

```auto
sudo apt-get install libopenblas-base libopenmpi-dev 

```

See here for more instructions: [https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available/](https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-6-0-now-available/)

---

<div class="post-metadata">

**Author:** ![nadeemm](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nadeemm/32/367020_2.png) [@nadeemm](https://forums.developer.nvidia.com/u/nadeemm)\
**Post date:** [October 18, 2021, 5:32pm UTC](https://forums.developer.nvidia.com/t/cannot-install-pytorch/149226/7 "2021-10-18T17:32:23Z")

</div>


