Felix-Petersen / difflogic

A Library for Differentiable Logic Gate Networks
MIT License
459 stars 43 forks source link

setup.py did not run successfully; CUDA_HOME is not set? #26

Open n01r1r opened 5 days ago

n01r1r commented 5 days ago

Hello, and thanks for your much inspring work.

I tried to install your difflogic library via pip and manually clone and run setup.py, and both failed for same reason.

Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\User\AppData\Local\Temp\pip-req-build-i0y0k0v6\setup.py", line 28, in <module>
          ext_modules=[CUDAExtension('difflogic_cuda', [
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\User\anaconda3\Lib\site-packages\torch\utils\cpp_extension.py", line 1078, in CUDAExtension
          library_dirs += library_paths(cuda=True)
                          ^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\User\anaconda3\Lib\site-packages\torch\utils\cpp_extension.py", line 1216, in library_paths
          paths.append(_join_cuda_home(lib_dir))
                       ^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\User\anaconda3\Lib\site-packages\torch\utils\cpp_extension.py", line 2416, in _join_cuda_home
          raise OSError('CUDA_HOME environment variable is not set. '
      OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

The CUDA_HOME not detected by either python or torch seemed to be common, so I have reinstalled libraries, etc, which sadly failed.

Upon printing the CUDA_HOME inside the python:

>>> print(os.environ.get('CUDA_PATH'))
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8

So I am confused how should I resolve this issue.

Below is an attachment of the result of nvidia-smi

image

Regards, DY

Felix-Petersen commented 4 days ago

Hi, it seems that you are using Windows. While we do not provide official support for Windows, I would expect that it could work in the wsl Windows Subsystem for Linux. Further, to check that the cuda toolkit is correctly installed, could you also check the output of the command nvcc --version?

Felix-Petersen commented 4 days ago

also, I noticed that in one case you needed CUDA_HOME but then printed CUDA_PATH instead of CUDA_HOME.

n01r1r commented 3 days ago

Thanks for your reply.

1) Upon entering nvcc --version, I get:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

2) My mistake. Printing CUDA_HOME makes the same output.

>>> print(os.environ.get('CUDA_HOME'))
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8

If you do not officially support Windows yet, then I will try to install at WSL later.