xavier NX上安装pytorch_前面一二三四是失败的方法,可以直接按照步骤五进行安装
博客搬移到:https://blog.csdn.net/u013171226/article/details/107680338
一.首先登录github,在github上搜索pytorch,然后pytorch下面的说明中中可以看到如下内容
Installation
Binaries
Commands to install from binaries via Conda or pip wheels are on our website: https://pytorch.org
NVIDIA Jetson platforms
Python wheels for NVIDIA's Jetson Nano, Jetson TX2, and Jetson AGX Xavier are available via the following URLs:
- Stable binaries:
- Rolling weekly binaries:
They require JetPack 4.2 and above, and @dusty-nv maintains them
From Source
If you are installing from source, you will need a C++14 compiler. Also, we highly recommend installing an Anaconda environment. You will get a high-quality BLAS library (MKL) and you get controlled dependency versions regardless of your Linux distro.
Once you have Anaconda installed, here are the instructions.
If you want to compile with CUDA support, install
- NVIDIA CUDA 9.2 or above
- NVIDIA cuDNN v7 or above
- Compiler compatible with CUDA
If you want to disable CUDA support, export environment variable USE_CUDA=0
. Other potentially useful environment variables may be found in setup.py
.
If you are building for NVIDIA's Jetson platforms (Jetson Nano, TX1, TX2, AGX Xavier), Instructions to install PyTorch for Jetson Nano are available here
二.点击上面的available here跳转到nvidia网站,
可以在网站上下载whl文件,然后按照下面步骤进行安装
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev pip3 install Cython pip3 install numpy torch-1.4.0-cp36-cp36m-linux_aarch64.whl
我安装的时候前面两步都没成功,就直接安装了torch
三.测试
用下面命令进行测试
python3
import torch
四.错误
错误1:OSError: libmpi_cxx.so.20: cannot open shared object file: No such file or directory
sudo apt-get update
apt-get install libopenmpi-dev
再次import torch发现上面的错误消失,但是出现下面的错误
错误2:ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory
sudo apt-get install libopenblas-dev
然后import torch,上面错误消失,出现如下新错误。
错误3:提示Segmentation fault(core dumped) no moudle named torch.
然后从网上搜索了各种方法,尝试了如下的方法:https://blog.csdn.net/sparkexpert/article/details/77675581,把两个库重命名了一下,
然后继续
gdb python
r -c "import torch"
出现如下错误提示
尝试用如下方法,
sudo apt-get upgrade libapt-pkg
然后系统各种不正常了,于是又重新刷机了,
五:成功的方法
然后放弃上面的方法,重新下载torch1.6,https://forums.developer.nvidia.com/t/pytorch-for-jetson-nano-version-1-5-0-now-available/72048
下载torch需要FQ,去github上下载个蓝灯,https://github.com/getlantern/lantern 。安装蓝灯之后就可以FQ下载了(有同学评论torch下载失败,我才想起来我一直是在fq,于是笔记上补充上这一行)
torch 1.6安装成功。
然后安装torch1.6对应的torchvision。笔记如下:https://www.cnblogs.com/cumtchw/p/13279051.html
作者:cumtchw
出处:http://www.cnblogs.com/cumtchw/
我的博客就是我的学习笔记,学习过程中看到好的博客也会转载过来,若有侵权,与我联系,我会及时删除。