CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
527 stars 180 forks source link

ImportError: /home/user/anaconda3/envs/venv/lib/python3.7/site-packages/_Ax.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cudaGetDeviceProperties_v2 #551

Closed GreameLee closed 3 weeks ago

GreameLee commented 1 month ago

After installing TIGRE in the Python virtual environment successfully, I want to test it by running demo3 and I met the bug in the title. I run it successfully on the same device but different virtual environment. I guess it may happen because the torch version or there are other packages that have influence on it

AnderBiguri commented 1 month ago

It's the CUDA that you are using. Likely in this environment you used 12.2 but not recopile TIGRE

GreameLee commented 1 month ago

But I run it successfully in 12.2 CUDA already

AnderBiguri commented 1 month ago

But maybe in your current environment, you are not using CUDA 12.2. So Tigre was compiled for 12.2 only, but when you changed the environment, it doesn't have the libraries for 12.2, it has whichever different version you are using now.

GreameLee commented 1 month ago

I have reinstalled cuda and torch as:

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge

and I reinstall it successfully, but the bug is still the same:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/TIGRE/Python/tigre/__init__.py", line 23, in <module>
    from .utilities.Ax import Ax
  File "~/TIGRE/Python/tigre/utilities/Ax.py", line 4, in <module>
    from _Ax import _Ax_ext
ImportError: /home/anaconda3/envs/DOLCE/lib/python3.7/site-packages/_Ax.cpython-37m-x86_64-linux-gnu.so: undefined symbol: cudaGetDeviceProperties_v2
AnderBiguri commented 1 month ago

Right, so you used cuda 11.1 for pytorch, however cuda 12.2 for TIGRE. Recompile TIGRE with cuda 11.1 and you will solve your error!

GreameLee commented 1 month ago

What do you mean recompile TIGRE? I have followed with the installing step by step as the instruction and it shows:


> pip install .

Processing /mnt/new_ssd/haodong/Code/DOLCE/TIGRE/Python
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: Cython in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from pytigre==2.4.0) (3.0.10)
Requirement already satisfied: matplotlib in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from pytigre==2.4.0) (3.5.3)
Requirement already satisfied: numpy in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from pytigre==2.4.0) (1.21.5)
Requirement already satisfied: scipy in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from pytigre==2.4.0) (1.7.3)
Requirement already satisfied: tqdm in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from pytigre==2.4.0) (4.66.1)
Requirement already satisfied: cycler>=0.10 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from matplotlib->pytigre==2.4.0) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from matplotlib->pytigre==2.4.0) (4.38.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from matplotlib->pytigre==2.4.0) (1.4.5)
Requirement already satisfied: packaging>=20.0 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from matplotlib->pytigre==2.4.0) (23.2)
Requirement already satisfied: pillow>=6.2.0 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from matplotlib->pytigre==2.4.0) (9.3.0)
Requirement already satisfied: pyparsing>=2.2.1 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from matplotlib->pytigre==2.4.0) (3.1.1)
Requirement already satisfied: python-dateutil>=2.7 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from matplotlib->pytigre==2.4.0) (2.8.2)
Requirement already satisfied: typing-extensions in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib->pytigre==2.4.0) (3.10.0.0)
Requirement already satisfied: six>=1.5 in /home/haodong/anaconda3/envs/DOLCE/lib/python3.7/site-packages (from python-dateutil>=2.7->matplotlib->pytigre==2.4.0) (1.15.0)
Building wheels for collected packages: pytigre
  Building wheel for pytigre (pyproject.toml) ... done
  Created wheel for pytigre: filename=pytigre-2.4.0-cp37-cp37m-linux_x86_64.whl size=16027055 sha256=555f6891db61a39c1c5ecf7510e7773e89f854fbc36789af1b2a01c63b035e76
  Stored in directory: /tmp/pip-ephem-wheel-cache-ivv7svg8/wheels/6b/5d/b7/71e2dc5e5f7f461454b7fb2cfcca3b4a83d25807238dee4e24
Successfully built pytigre
Installing collected packages: pytigre
  Attempting uninstall: pytigre
    Found existing installation: pytigre 2.4.0
    Uninstalling pytigre-2.4.0:
      Successfully uninstalled pytigre-2.4.0
Successfully installed pytigre-2.4.0

but the bug is the same

AnderBiguri commented 1 month ago

That seems to be using some other cuda, not 11.1. Having various cuda on the computer makes these thigns hard. You may need to play with the setup.py file or make sure you only have 11.1 installed in your computer