TonyHongtaoWu / RainMamba

[ACM MM'24 Oral] RainMamba: Enhanced Locality Learning with State Space Models for Video Deraining
MIT License
62 stars 6 forks source link

CUDA_HOME not taking nvcc path #4

Closed Maniac1769 closed 1 month ago

Maniac1769 commented 1 month ago

The CUDA_HOME from pytorvh isnt taking path to my nvcc

TonyHongtaoWu commented 1 month ago

Can you provide more log information about this bug?

TonyHongtaoWu commented 1 month ago

Given that this is an environmental configuration issue, I can try to provide a universal solution. To solve the issue where PyTorch cannot find the nvcc compiler due to an incorrect CUDA_HOME environment variable on a Linux system, follow these steps:

  1. Verify CUDA Installation: Open a terminal and check if CUDA is installed and where it is located by using the command:

    nvcc --version

    If this command returns the version of the CUDA compiler, CUDA is installed correctly. If it returns an error, it means either CUDA is not installed or nvcc is not in your PATH.

  2. Locate CUDA Installation Path: If CUDA is installed, you need to find the installation path. Usually, CUDA is installed in /usr/local/cuda. You can check this by:

    ls /usr/local/cuda

    If this directory exists, it's likely your CUDA installation path.

  3. Set the CUDA_HOME Environment Variable: You need to set the CUDA_HOME environment variable to point to your CUDA installation directory. Edit your ~/.bashrc or ~/.zshrc file (depending on your shell) and add the following line at the end:

    export CUDA_HOME=/usr/local/cuda

    Replace /usr/local/cuda with your actual CUDA installation path if it's different.

  4. Update Your PATH and LD_LIBRARY_PATH: In the same ~/.bashrc or ~/.zshrc file, add the following lines to ensure that nvcc and the CUDA libraries can be found by your system:

    export PATH=${CUDA_HOME}/bin:${PATH}
    export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
  5. Apply the Changes: Save the changes and close the editor. To apply these changes, you need to run the following command or simply restart your terminal:

    source ~/.bashrc

    Or if you're using Zsh:

    source ~/.zshrc
  6. Verify the Setup: Open a new terminal window and use the following command to confirm that the environment variable is correctly set:

    echo $CUDA_HOME

    You should see the CUDA installation path you set earlier. Run nvcc --version again to confirm that nvcc can now be found correctly.

By following these steps, you should be able to resolve the issue with PyTorch not being able to find nvcc. If you continue to experience problems when running PyTorch code, make sure that your PyTorch version is compatible with your CUDA version.