LLNL / LEAP

comprehensive library of 3D transmission Computed Tomography (CT) algorithms with Python API and fully integrated with PyTorch
https://leapct.readthedocs.io
MIT License
74 stars 8 forks source link

Unable to run leap after manual DLL install #58

Closed 01baftb closed 1 week ago

01baftb commented 2 weeks ago

I used the manual install method (i.e. copying the libleapct.dll file instead of compiling the source) as instructed in the manual_install.py. I am unable to run any of the demo scripts after manual installation. I have confirmed that the files, leapctype.py, leaptorch.py, leap_filter_sequence.py, leap_preprocessing_algorithms.py, and libleapct.dll are properly copied to my Python's virtual environment path after running the manual_install.py script:

System info: Windows 10 x64 Python 3.11.9

Below are my steps to repeat:

PS C:\test_LEAP_issue\LEAP-1.14> python .\manual_install.py
Copying LEAP-CT files to: C:\temp_python_venv\venv_test_leap\Lib\site-packages
PS C:\test_LEAP_issue\LEAP-1.14> ls "C:\temp_python_venv\venv_test_leap\Lib\site-packages"

    Directory: C:\temp_python_venv\venv_test_leap\Lib\site-packages

Mode                 LastWriteTime         Length Name                                                                                                                                                          
----                 -------------         ------ ----                                                                                                                                                          
d-----         6/17/2024  10:34 AM                pip                                                                                                                                                           
d-----         6/17/2024  10:32 AM                pip-24.0.dist-info                                                                                                                                            
d-----         6/17/2024  10:32 AM                pkg_resources                                                                                                                                                 
d-----         6/17/2024  10:32 AM                wheel                                                                                                                                                         
d-----         6/17/2024  10:32 AM                wheel-0.43.0.dist-info                                                                                                                                        
d-----         6/17/2024  10:33 AM                _distutils_hack                                                                                                                                               
d-----         6/17/2024  10:33 AM                __pycache__                                                                                                                                                   
-a----         6/17/2024  10:39 AM         298374 leapctype.py
-a----         6/17/2024  10:39 AM          20989 leaptorch.py
-a----         6/17/2024  10:39 AM          28282 leap_filter_sequence.py
-a----         6/17/2024  10:39 AM          26081 leap_preprocessing_algorithms.py
-a----         6/17/2024  10:39 AM        9271808 libleapct.dll
-a----         6/17/2024  10:32 AM              0 pip-24.0.virtualenv
-a----         6/17/2024  10:32 AM              0 setuptools-69.5.1.virtualenv
-a----         6/17/2024  10:32 AM             18 _virtualenv.pth
-a----         6/17/2024  10:32 AM           4546 _virtualenv.py
PS C:\test_LEAP_issue\LEAP-1.14> pip list
Package    Version
---------- -------
pip        24.0
setuptools 69.5.1
wheel      0.43.0

PS C:\test_LEAP_issue\LEAP-1.14\demo_leapctype> python .\d01_standard_geometries.py
  File "C:\temp_python_venv\venv_test_leap\Lib\site-packages\leapctype.py", line 124, in __init__
    self.libprojectors = windll.LoadLibrary(fullPath)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\ctypes\__init__.py", line 454, in LoadLibrary
    return self._dlltype(name)
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\ctypes\__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\temp_python_venv\venv_test_leap\Lib\site-packages\libleapct.dll' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\test_LEAP_issue\LEAP-1.14\demo_leapctype\d01_standard_geometries.py", line 6, in <module>
    leapct = tomographicModels()
             ^^^^^^^^^^^^^^^^^^^
  File "C:\temp_python_venv\venv_test_leap\Lib\site-packages\leapctype.py", line 126, in __init__
    self.libprojectors = ctypes.CDLL(fullPath, winmode=0)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\ctypes\__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'C:\temp_python_venv\venv_test_leap\Lib\site-packages\libleapct.dll' (or one of its dependencies). Try using the full path with constructor syntax.
kylechampley commented 2 weeks ago

Have you installed the CUDA toolkit?

01baftb commented 2 weeks ago

Have you installed the CUDA toolkit?

No, my PC doesn't have NVIDA CPU. Doesn't the DLL support CPU only?

kylechampley commented 2 weeks ago

Ahh, yes, there is the problem. The precompiled dll that I post requires the cuda libraries. Can you compile the code yourself? The instructions are here.

If you cannot compile this yourself, I could build you a library that does not require cuda, but you'll have to wait for me to do this until the weekend. Compiling yourself is pretty easy.

01baftb commented 2 weeks ago

I am not sure how to build without GPU. The instructions says:All you need to do here is swap the CMake file. Rename cpu_CMakeLists.txt to CMakeLists.txt.. But there is no _cpuCMakeLists.txt file in the repo.

kylechampley commented 2 weeks ago

It’s in the src folder.

kylechampley commented 2 weeks ago

Did you see the file in the src folder? Were you able to compile?

01baftb commented 2 weeks ago

Did you see the file in the src folder? Were you able to compile?

Yes, I see it in src folder. I haven’t built yet. Will report back once I try.

01baftb commented 1 week ago

I was able to build without GPU and got the demo scripts to work. It would be great if the releases included pre-built DLL for use without GPU. Or the existing built DLL handled situations where a user does not have a GPU.

kylechampley commented 1 week ago

Glad it worked!

We are definitely interested in making the build process easier, but this type of thing is not really in my skill set. I am hoping someone from the LEAP user community will step up and help us out with this.

I am going to close this issue, but feel free to open another one if you have further issues.