Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libtorch_cpu.so: undefined symbol: iJIT_IsProfilingActive

I have created this Conda environment:

conda env create -f environment.yml

The environment.yml file:

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

I activate the Conda environment. But even a simple statement like python -c "import torch; print(torch.__version__)" to get the PyTorch version throws the undefined symbol error:

(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

I believe the PyTorch installed by Conda is broken. But the Conda logs are all fine. Does anyone have a clue or hint? I'm receiving the undefined symbol error on both my local machine and on Google Colab.

Update: minimal env

Even a minimal Environment like below, would throw similar errors:

conda create -n minimal_pytorch python=3.6 pytorch torchvision torchaudio -c pytorch
source activate minimal_pytorch && python -c "import torch; print(torch.__version__)"

A similar undefined symbol error is thrown:

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 version

When Python version is omitted while creating the environment:

conda create -n minimal_pytorch python pytorch torchvision torchaudio -c pytorch

The error is resolved:

source activate minimal_pytorch && python -c "import torch; print(torch.__version__)"

PyTorch version is received without any error:

2.2.2
like image 940
user3405291 Avatar asked Oct 30 '25 23:10

user3405291


2 Answers

Downgrade mkl package to an earlier version. It should work.

like image 107
Outerio Avatar answered Nov 01 '25 20:11

Outerio


Using pip install instead of conda install solved the problem for me:

pip install torch==x.x+cu11x torchvision==x.x.0+cu11x torchaudio==x.x --extra-index-url https://download.pytorch.org/whl/cu11x
like image 45
Ali Avatar answered Nov 01 '25 20:11

Ali