xavier NX上安装pytorch_前面一二三四是失败的方法,可以直接按照步骤五进行安装...

一.首先登录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:
    • Python 3.6: https://nvidia.box.com/v/torch-stable-cp36-jetson-jp42
  • Rolling weekly binaries:
    • Python 3.6: https://nvidia.box.com/v/torch-weekly-cp36-jetson-jp42

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

xavier NX上安装pytorch_前面一二三四是失败的方法,可以直接按照步骤五进行安装..._第1张图片

 

torch 1.6安装成功。

然后安装torch1.6对应的torchvision。笔记如下:https://www.cnblogs.com/cumtchw/p/13279051.html

你可能感兴趣的:(Pytorch,NVIDIA,Jetson,Xavier/NX)