无法导入火炬(ImportError:libcudart.so.10.0)

问题描述 投票:0回答:2

我目前正在开发Nvidia Jetson Nano,但对Linux不太熟悉。我正在尝试运行一个python文件,该文件会导入一个名为torch的程序包。我已按照NVIDIA here的说明将它与Torchvision一起安装。

当我在终端上运行pip list时,可以看到割炬列为已安装的软件包之一。但是,由于以下错误,我无法运行python文件。当我尝试在python shell上运行它时,会弹出相同的错误。仅供参考:以前它有问题,因为系统默认情况下使用的是python 2,但我已经通过编辑.bashrc文件切换到python 3来修复了路径。

>>> import torch
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jiayi/.local/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module>
    from torch._C import *
ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory

我曾尝试通过pip卸载和安装,但无济于事。当我尝试安装pytorch软件包时(按照github存储库here中的说明进行操作),发生如下所示的错误,这是由于相同的问题所致。它能够检测到割炬软件包已安装,但是似乎存在内部问题。

Requirement already satisfied: torch==1.4.0 from file:///home/jiayi/jetson-inference/build/torch-1.4.0-cp36-cp36m-linux_aarch64.whl in /home/jiayi/.local/lib/python3.6/site-packages (1.4.0)
[jetson-inference]  cloning torchvision...
[sudo] password for jiayi: 
Cloning into 'torchvision-36'...
remote: Enumerating objects: 71, done.
remote: Counting objects: 100% (71/71), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 8219 (delta 37), reused 29 (delta 15), pack-reused 8148
Receiving objects: 100% (8219/8219), 10.22 MiB | 3.60 MiB/s, done.
Resolving deltas: 100% (5631/5631), done.
[jetson-inference]  building torchvision for Python 3.6...
Traceback (most recent call last):
  File "setup.py", line 14, in <module>
    import torch
  File "/home/jiayi/.local/lib/python3.6/site-packages/torch/__init__.py", line 81, in <module>
    from torch._C import *
ImportError: libcudart.so.10.0: cannot open shared object file: No such file or directory

[jetson-inference]  installation complete, exiting with status code 0
[jetson-inference]  to run this tool again, use the following commands:

    $ cd <jetson-inference>/build
    $ ./install-pytorch.sh
linux pytorch nvidia torch nvidia-jetson-nano
2个回答
0
投票

这通常是CUDA版本的问题。

参见:https://github.com/rusty1s/pytorch_geometric/issues/114


0
投票

您可以通过检查torch.version.cuda并确保它与jetson nano上的cuda版本相同,来检查是否安装了支持cuda的炬管版本正确。

安装割炬的一种更简单的方法是从Jetson Zoo下载.whl文件。将nano升级到最新的Jetpack版本可能也很有用]

© www.soinside.com 2019 - 2024. All rights reserved.