Could not load dynamic library 'libcudart.so.11.0';

1.问题

Could not load dynamic library 'libcudart.so.11.0'; 
dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory;
LD_LIBRARY_PATH: /usr/local/cuda-10.0/lib64:

https://blog.csdn.net/qq_26018075/article/details/111546689,需要安装:

conda install cudatoolkit=11.0

最终原因是,tensorflow是2.4版本,但已有的cuda版本为10.1,所以需要将tf降级。

但尝试安装卸载都出现问题,尝试使用conda和pip来卸载都不行:

conda uninstall tensorflow

#报错:
Collecting package metadata (repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64/repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64'

#尝试: pip uninstall tensorflow WARNING: Skipping tensorflow as it
is not installed.

尝试使用两者直接安装新版本也不行:

pip install tensorflow==2.0.0
#报错:
ERROR: Could not find a version that satisfies the requirement tensorflow==2.0.0 
(from versions: 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.2.2, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2,
2.3.0, 2.3.1, 2.3.2, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.4.0, 2.4.1, 2.5.0rc0, 2.5.0rc1,
2.5.0rc2, 2.5.0rc3, 2.5.0) ERROR: No matching distribution found for tensorflow==2.0.0

只包含更高版本的。

2.尝试解决

https://blog.csdn.net/wsjzzcbq/article/details/101052960,根据这个添加清华源,

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

不行,给出warining已经添加过了

Warning: 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' already in 'channels' list, moving to the top

https://www.jianshu.com/p/777c7b7a3f3d,尝试设置防火墙ssl

conda config --set ssl_verify false

仍旧不行。

查看python版本为3.8,选择新建conda环境,废弃此环境。但尝试

仍然是这个报错:

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/linux-64'

无法连接到这个源,查看所有的源:

:~$ conda config --show-sources

ssl_verify: False
channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
  - defaults
show_channel_urls: True

尝试使用浏览器访问

https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

本地windows可以访问,linux尝试通过命令来访问:

curl https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

也可以访问。

那么接下来尝试依次删掉上述源:

conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/

conda config --show-sources
==> .condarc <==
ssl_verify: False
channels:
  - defaults
show_channel_urls: True

将所有清华源都删除,终于出现了点不同的东西:

conda install tensorflow==2.0.0

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: | 

输出可能有版本冲突的问题:

 所以更改安装版本,根据cuda版本选择1.14.0

 首先查看tensorboardx2.1依赖的torch版本:

目前我的版本是:

torch                     1.8.1 
tensorboardx              2.1
tensorboard               2.4.1
tensorflow                2.4.1

https://www.jianshu.com/p/058fba2c2530,这篇博文中提到,

 tensorboardx在依旧需要tensorboard的支持 “To run tensorboard web server, you need to install it using: pip install tensorboard”. 
而安装tensorboard需要安装tensorflow。所以会设计到版本依赖的问题。
https://www.tensorflow.org/install/pip

当前环境的python版本是3.8,怪不得pip安装的时候只有2.2版本及以上的,找不到2.2。

所以决定新建一个conda环境,py版本3.7的。

将清华源都删除后,conda可以安装包了。。。。

原文地址:https://www.cnblogs.com/BlueBlueSea/p/14781296.html