Problem Description
After installing paddle using python3.8, an error was reported when testing the import of paddle.
创建环境并安装
source activate paddle38
pip install paddlepaddle-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install paddlehub -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install paddleocr -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install paddleclas -i https://pypi.tuna.tsinghua.edu.cn/simple
python
>>> import paddle
Error: Can not import paddle core while this file exists:
/root/anaconda3/envs/paddle38/lib/python3.8/site-
packages/paddle/fluid/libpaddle.so
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/anaconda3/envs/paddle38/lib/python3.8/site-
packages/paddle/__init__.py", line 25, in <module>
from .framework import monkey_patch_variable
File "/root/anaconda3/envs/paddle38/lib/python3.8/site-
packages/paddle/framework/__init__.py", line 17, in <module>
from . import random # noqa: F401
File "/root/anaconda3/envs/paddle38/lib/python3.8/site-packages/paddle/framework/random.py", line 16, in <module>
import paddle.fluid as fluid
File "/root/anaconda3/envs/paddle38/lib/python3.8/site-
packages/paddle/fluid/__init__.py", line 36, in <module>
from . import framework
File "/root/anaconda3/envs/paddle38/lib/python3.8/site-
packages/paddle/fluid/framework.py", line 37, in <module>
from . import core
File "/root/anaconda3/envs/paddle38/lib/python3.8/site-
packages/paddle/fluid/core.py", line 304, in <module>
raise e
File "/root/anaconda3/envs/paddle38/lib/python3.8/site-
packages/paddle/fluid/core.py", line 249, in <module>
from . import libpaddle
ImportError: libcudart.so.10.2: cannot open shared object file: No such file or
directory
>>>
problem analysis
After checking a lot of information, I found that the most likely possibility is that the corresponding version is wrong when installing dependent packages. The graphics card driver does not support cuda10.2 or the correct driver is not installed. The driver I installed here is cuda11.7 and does not match the default driver, so it is necessary re-install.
solution
Use conda to install python3.8 and install it through the specified version and domestic mirror.
source activate paddle38
conda install paddlepaddle-gpu==2.4.2 cudatoolkit=11.7 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/Paddle/ -c conda-forge
# 或者使用 pip 安装
python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html