简介
跟着李沐学AI时遇到的mxnet环境问题。
问题
使用pip install mxnet
时会重新安装相匹配的numpy和requests,而这新安装的这两个版本不满足d2l所需的版本。
然后报错:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
matplotlib 3.5.1 requires numpy>=1.17, but you have numpy 1.16.6 which is incompatible.
d2l 0.17.6 requires numpy==1.21.5, but you have numpy 1.16.6 which is incompatible.
d2l 0.17.6 requires requests==2.25.1, but you have requests 2.18.4 which is incompatible.
anyio 3.6.2 requires idna>=2.8, but you have idna 2.6 which is incompatible.
尝试
试图下载最新版本的mxnet,失败!
显示支持的版本最高只到1.7.0
解决
遍寻csdn无果后,回到d2l的安装那一节,终于成功解决。
- 步骤
- 首先,查看已安装的CUDA版本
nvcc --version
我的版本是11.3- 安装命令:
可以根据CUDA版本更改如上mxnet-cu101的最后一位数字, 例如:CUDA 10.0是cu100, CUDA 9.0是cu90。pip install mxnet-cu101==1.7.0
我的是CUDA 11.3,所以我的命令是:pip install mxnet-cu113==1.7.0
发现我的库里只有1.0.0版本,所以直接下载1.0.0版本尝试一下:
- 下载成功,回到jupyter notebook尝试运行。运行成功!
成功解决,撒花!!!!
过后反思
最后发现其实用不上mxnet,忘了点pytorch代码,被自己蠢哭了,呜呜呜~~~