无法在Jetson nanoUbuntu中导入Pytorch

问题描述

我无法在我的jetson nano(jetpack 4.4,Cuda 10.2.89)中导入PyTorch,我已经从.whl文件成功安装了它,并且在我的pip3库中。但是,当我导入它时,它显示此错误。请帮忙。

Traceback (most recent call last):
  File "<stdin>",line 1,in <module>
  File "/home/parikshit/.local/lib/python3.6/site-packages/torch/__init__.py",line 188,in <module>
    _load_global_deps()
  File "/home/parikshit/.local/lib/python3.6/site-packages/torch/__init__.py",line 141,in _load_global_deps
    ctypes.CDLL(lib_path,mode=ctypes.RTLD_GLOBAL)
  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```

解决方法

尝试执行以下操作:

cd /home/parikshit/.local/lib/python3.6/site-packages/torch
ls
# You should find a .so file. Run the following command on that file
ldd the_file_you_found.so
#In the output you should see "not found"
#To find out which apt packages provide this .so:
sudo apt install apt-file
sudo apt-file update
#Now search for that "not found" library file. Example:
apt-file search blah.so.100
#In the first part of each line you will see the name of the file that you need to install. Example:
sudo apt install lib-hello
#Enjoy!
,
cd /home/parikshit/.local/lib/python3.6/site-packages/torch ls
# You should find a .so file. Run the following command on that file ldd the_file_you_found.so
#In the output you should see "not found"
#To find out which apt packages provide this .so: sudo apt install apt-file sudo apt-file update
#Now search for that "not found" library file. Example: apt-file search blah.so.100
#In the first part of each line you will see the name of the file that you need to install. Example: sudo apt install lib-hello
#Enjoy!

上一个答案解决了我在 Jetson Nano 上找不到 libmpi_cxx.so.20 的问题,但我在导入 Torch 时遇到了不同的错误。

错误是: from torch._C import * ImportError: numpy.core.multiarray 导入失败

如果您因为导入 numpy 失败而在导入 Torch 时遇到问题,请按照以下步骤操作。

pip install numpy -I

您可以在 GitHub 上查看该问题的详细信息。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...