docker的conda环境中安装mindspore(CPU版本?)

58 篇文章 1 订阅
该篇博客记录了在Docker环境下安装MindSpore CPU版本的过程,包括conda环境配置、清华源的使用以及MindSpore GPU版本安装失败后转为安装CPU版本的尝试。在安装过程中遇到CUDA版本不匹配的问题,最终成功安装CPU版本但导入时仍报错找不到libcudnn.so.7库文件。
摘要由CSDN通过智能技术生成

docker的conda环境中安装ms (CPU版本?)

export PATH=/root/miniconda3/envs/GLUE/bin:$PATH

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --set show_channel_urls yes
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.9.0/MindSpore/gpu/x86_64/cuda-10.1/mindspore_gpu-1.9.0-cp38-cp38-linux_x86_64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.9.0/MindSpore/gpu/x86_64/cuda-10.1/mindspore_gpu-1.9.0-cp38-cp38-linux_x86_64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple

(GLUE) root@cd163c5c74c9:~/miniconda3/envs/GLUE/bin# conda install -c conda-forge -c bioconda scglue pytorch-gpu jupyterlab
Collecting package metadata (current_repodata.json): done
Solving environment: done

docker的conda环境中安装ms (CPU版本?)
(ms19) root@0b5003cae16c:/workspace# pip install scglue pytorch-gpu jupyterlab -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.9.0/MindSpore/gpu/x86_64/cuda-10.1/mindspore_gpu-1.9.0-cp38-cp38-linux_x86_64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple
pip 安装ms缺乏下面
Downloading and Extracting Packages
cudatoolkit-10.1.243 | 427.6 MB | 3
(ms19) root@0b5003cae16c:/workspace# conda install mindspore-gpu=1.9.0 cudatoolkit=10.1 -c mindspore -c conda-forge ####用conda比较好
No LSB modules are available.
CUDA 10.1 is not supported on Ubuntu 20.04

#####安装cuda11的
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.9.0/MindSpore/gpu/x86_64/cuda-11.1/mindspore_gpu-1.9.0-cp38-cp38-linux_x86_64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple
conda install mindspore-gpu=1.9.0 cudatoolkit=11.1 -c mindspore -c conda-forge

注意参考下方安装指南,添加运行所需的环境变量配置

(ms19) root@0b5003cae16c:/workspace# echo $LD_LIBRARY_PATH
/usr/local/nvidia/lib:/usr/local/nvidia/lib64
(ms19) root@0b5003cae16c:/workspace#

./opt/conda/pkgs/cudatoolkit-10.1.243-h8cb64d8_10/lib
./opt/conda/envs/ms19/lib/libcublas.so.10
./opt/conda/lib/libcublas.so
./opt/conda/lib/libcublas.so.11
./opt/conda/lib/libcublas.so.11.5.1.109
./opt/conda/lib/libcublas.so
./opt/conda/lib/libcublas.so.11
./opt/conda/lib/libcublas.so.11.5.1.109
./opt/conda/envs/ms19/lib/libcublas.so
./opt/conda/envs/ms19/lib/python3.8/site-packages/nvidia/cublas/lib/libcublas.so.11
./opt/conda/envs/ms19/lib/libcublas.so.10.2.1.243
./opt/conda/envs/ms19/lib/libcublas.so.10

[mindspore/run_check/_check_version.py:194] Cuda [‘10.1’, ‘11.1’, ‘11.6’] version(libcu*.so need by mindspore-gpu) is not found, please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, or check whether the CUDA version in wheel package and the CUDA runtime in current device matches, please refer to the installation guidelines: https://www.mindspore.cn/install

(ms19) root@0b5003cae16c:/# echo $LD_LIBRARY_PATH
/usr/local/nvidia/lib:/usr/local/nvidia/lib64
(ms19) root@0b5003cae16c:/#

export LD_LIBRARY_PATH=/opt/conda/envs/ms19/lib/:$LD_LIBRARY_PATH

./opt/conda/envs/ms19/lib/python3.8/site-packages/nvidia_cudnn_cu11-8.5.0.96.dist-info
./opt/conda/envs/ms19/lib/python3.8/site-packages/nvidia_cuda_nvrtc_cu11-11.7.99.dist-info
./opt/conda/envs/ms19/lib/python3.8/site-packages/nvidia_cuda_runtime_cu11-11.7.99.dist-info
./opt/conda/envs/ms19/lib/python3.8/site-packages/nvidia
./opt/conda/envs/ms19/lib/python3.8/site-packages/nvidia_cublas_cu11-11.10.3.66.dist-info
export LD_LIBRARY_PATH=/opt/conda/envs/ms19/lib/python3.8/site-packages/:$LD_LIBRARY_PATH
这里安装ms是失败的!
(base) root@0b5003cae16c:/# conda activate ms19
(ms19) root@0b5003cae16c:/# uname -a
Linux 0b5003cae16c 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
(ms19) root@0b5003cae16c:/#
因为docker 镜像 不能装 显卡的驱动 所以GPU 版本安装不了下面安装CPU
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.9.0/MindSpore/cpu/x86_64/mindspore-1.9.0-cp38-cp38-linux_x86_64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple
(ms19) root@0b5003cae16c:/# python
Python 3.8.13 (default, Oct 21 2022, 23:50:54)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import mindspore
[ERROR] ME(28009,7ff33eaaf6c0,python):2022-11-11-13:11:45.822.587 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:46] LoadDynamicLib] Load dynamic library libmindspore_gpu failed, returns [libcudnn.so.7: cannot open shared object file: No such file or directory].
quit()
(ms19) root@0b5003cae16c:/# pip uninstall mindspore
Found existing installation: mindspore 1.9.0
Uninstalling mindspore-1.9.0:
Would remove:
/opt/conda/envs/ms19/bin/cache_admin
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore-1.9.0.dist-info/*
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/*
Would not remove (might be manually added):
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/_ms_mpi.cpython-38-x86_64-linux-gnu.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libcuda_ops.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libgpu_collective.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libmpi_adapter.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libmpi_collective.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libnccl.so.2
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libnvidia_collective.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/plugin/libmindspore_gpu.so
Proceed (Y/n)? y
Successfully uninstalled mindspore-1.9.0
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
(ms19) root@0b5003cae16c:/# python
Python 3.8.13 (default, Oct 21 2022, 23:50:54)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import mindspore

quit()
(ms19) root@0b5003cae16c:/# pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.9.0/MindSpore/cpu/x86_64/mindspore-1.9.0-cp38-cp38-linux_x86_64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting mindspore1.9.0
Using cached https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.9.0/MindSpore/cpu/x86_64/mindspore-1.9.0-cp38-cp38-linux_x86_64.whl (158.7 MB)
Requirement already satisfied: packaging>=20.0 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore
1.9.0) (21.3)
Requirement already satisfied: psutil>=5.6.1 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore1.9.0) (5.9.4)
Requirement already satisfied: pillow>=6.2.0 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore
1.9.0) (9.3.0)
Requirement already satisfied: numpy>=1.17.0 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore1.9.0) (1.23.4)
Requirement already satisfied: astunparse>=1.6.3 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore
1.9.0) (1.6.3)
Requirement already satisfied: scipy>=1.5.2 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore1.9.0) (1.9.3)
Requirement already satisfied: protobuf>=3.13.0 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore
1.9.0) (3.20.1)
Requirement already satisfied: asttokens>=2.0.4 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from mindspore1.9.0) (2.1.0)
Requirement already satisfied: six in /opt/conda/envs/ms19/lib/python3.8/site-packages (from asttokens>=2.0.4->mindspore
1.9.0) (1.16.0)
Requirement already satisfied: wheel<1.0,>=0.23.0 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from astunparse>=1.6.3->mindspore1.9.0) (0.37.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /opt/conda/envs/ms19/lib/python3.8/site-packages (from packaging>=20.0->mindspore
1.9.0) (3.0.9)
Installing collected packages: mindspore
Successfully installed mindspore-1.9.0
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
(ms19) root@0b5003cae16c:/#
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import mindspore
[ERROR] ME(26924,7f33a41ca6c0,python):2022-11-11-13:14:25.916.924 [mindspore/ccsrc/runtime/hardware/device_context_manager.cc:46] LoadDynamicLib] Load dynamic library libmindspore_gpu failed, returns [libcudnn.so.7: cannot open shared object file: No such file or directory].
quit()
(ms19) root@0b5003cae16c:/# pip uninstall mindspore
Found existing installation: mindspore 1.9.0
Uninstalling mindspore-1.9.0:
Would remove:
/opt/conda/envs/ms19/bin/cache_admin
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore-1.9.0.dist-info/*
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/*
Would not remove (might be manually added):
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/_ms_mpi.cpython-38-x86_64-linux-gnu.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libcuda_ops.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libgpu_collective.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libmpi_adapter.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libmpi_collective.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libnccl.so.2
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/libnvidia_collective.so
/opt/conda/envs/ms19/lib/python3.8/site-packages/mindspore/lib/plugin/libmindspore_gpu.so
Proceed (Y/n)? Y
Successfully uninstalled mindspore-1.9.0
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
(ms19) root@0b5003cae16c:/#
import mindspore
(ms19) root@0b5003cae16c:/# python
Python 3.8.13 (default, Oct 21 2022, 23:50:54)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import mindspore
import torch
import scglue

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值