Nvidia Jetson nano 安装Archiconda、gpu版torch、踩坑记录
[日常] Jetson TX2 安装 Tensorflow
在NVIDIA Jetson TX2上安装TensorFlow
重要说明:
添加swap file是为了在硬盘上创建虚拟内存,给编译像TensorFlow这种大型的项目提供足够的内存。
```bash
fallocate -l 8G swapfile
```
```bash
chmod 600 swapfile
```
```bash
mkswap swapfile
```
```bash
sudo swapon swapfile
```
```bash
swapon -s
```
PyTorch for Jetson - version 1.9.0 now available
pytorch与torchvision版本对齐
NVIDIA Jetson Xavier NX安装torch和torchvision
NVIDIA Jetson Xavier NX 安yolo v5 环境,必成功(miniforge管理环境)
方法一(源码安装):
cd vision
python3 setup.py install
方法二(不推荐):
# 该方法可能失效
pip3 search torchvision --timeout=500
# 查看到有torchvision的0.7.0a0+78ed10c
pip3 install torchvision==0.7.0a0+78ed10c
官方安装教程
TensorFlow For Jetson Platform
[日常] Jetson TX2 安装 Tensorflow
tensorflow下载连接
Download tensorflow
pip install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v46 tensorflow
pip install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v46 'tensorflow<2'
pip install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v$JP_VERSION tensorflow==$TF_VERSION+nv$NV_VERSION
JP_VERSION
The major and minor version of JetPack you are using, such as 42 for JetPack 4.2.2 or 33 for JetPack 3.3.1.
TF_VERSION
The released version of TensorFlow, for example, 1.13.1.
NV_VERSION
The monthly NVIDIA container version of TensorFlow, for example, 19.01.
WIN10下安装Ubuntu18.04.5双系统+RTX3070独显不太成功安装方法(可参考)
Ubuntu双系统、ROS、软件安装教程
ONNX-TensorRT模型转换代码编译笔记
```text
解决办法
找到 /usr/lib/python3.6/dist-packages/cv2/python-3.6路径下的cv2.cpython-36m-aarch64-linux-gnu.so文件,复制到路径/home/jetson/archiconda3/envs/tf-gpu/lib/python3.6文件夹下即可。
sudo cp /usr/lib/python3.6/dist-packages/cv2/python-3.6/cv2.cpython-36m-aarch64-linux-gnu.so /home/jetson/archiconda3/envs/tf-gpu/lib/python3.6
```
```text
类似的问题:找不到tensorrt,uff,graphsurgeon
注意:保持python版本一致,找到对应的文件夹。
/usr/lib/python3.6
/usr/lib/python3.7
/usr/lib/python3.8
```
非法指令(核心已转储)
```text
python
import torch
```
[Ubuntu/Jetson Nano问题解决“Illegal instruction(core dumped)”](https://blog.csdn.net/LYiiiiiii/article/details/119133826)
```text
错误原因:
1. pytorch版本问题,安装合适的pytorch版本
2. python的版本问题,安装合适的python版本
解决办法:
方法一(推荐):
将 export OPENBLAS_CORETYPE=ARMV8 添加到环境变量即可。
sudo gedit ~/.bashrc
export OPENBLAS_CORETYPE=ARMV8
更新配置
source ~/.bashrc
方法二:
在运行python程序之前,运行下列的代码
OPENBLAS_CORETYPE=ARMV8 python demo.py
```
>>> import torch
Traceback (most recent call last):
File "" , line 1, in <module>
File "/media/mydisk/MyDocuments/PyProjects/20220113/venv/lib/python3.6/site-packages/torch/__init__.py", line 196, in <module>
from torch._C import *
ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory
‵
解决办法:
sudo apt-get install libopenblas-dev