我创建了这个Conda环境:
conda env create -f environment.yml
environment.yml
文件:
name: deep3d_pytorch
channels:
- pytorch
- conda-forge
- defaults
dependencies:
- python=3.6
- pytorch=1.6.0
- torchvision=0.7.0
- numpy=1.18.1
- scikit-image=0.16.2
- scipy=1.4.1
- pillow=6.2.1
- pip
- ipython=7.13.0
- yaml=0.1.7
- pip:
- matplotlib==2.2.5
- opencv-python==3.4.9.33
- tensorboard==1.15.0
- tensorflow==1.15.0
- kornia==0.5.5
- dominate==2.6.0
- trimesh==3.9.20
我激活Conda环境。但即使是像
python -c "import torch; print(torch.__version__)"
这样获取 PyTorch 版本的简单语句也会引发 undefined symbol
错误:
(deep3d_pytorch) m3@i7:~/repos/Deep3DFaceRecon_pytorch> python -c "import torch; print(torch.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/m3/anaconda3/envs/deep3d_pytorch/lib/python3.6/site-packages/torch/__init__.py", line 189, in <module>
from torch._C import *
ImportError: /home/m3/anaconda3/envs/deep3d_pytorch/lib/python3.6/site-packages/torch/lib/libtorch_cpu.so: undefined symbol: iJIT_IsProfilingActive
我相信 Conda 安装的 PyTorch 已损坏。但Conda日志一切都很好。有人有线索或提示吗?我在本地计算机和 Google Colab 上都收到
undefined symbol
错误。
即使是像下面这样的最小环境,也会引发类似的错误:
conda create -n minimal_pytorch python=3.6 pytorch torchvision torchaudio -c pytorch
source activate minimal_pytorch && python -c "import torch; print(torch.__version__)"
抛出类似的
undefined symbol
错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/envs/minimal_pytorch/lib/python3.6/site-packages/torch/__init__.py", line 197, in <module>
from torch._C import * # noqa: F403
ImportError: /usr/local/envs/minimal_pytorch/lib/python3.6/site-packages/torch/lib/libtorch_cpu.so: undefined symbol: iJIT_NotifyEvent
创建环境时省略Python版本时:
conda create -n minimal_pytorch python pytorch torchvision torchaudio -c pytorch
错误已解决:
source activate minimal_pytorch && python -c "import torch; print(torch.__version__)"
PyTorch 版本已收到,没有任何错误:
2.2.2
将 mkl 包降级到早期版本应该可以工作