ml-research / rational_activations

Rational Activation Functions - Replacing Padé Activation Units
MIT License
77 stars 17 forks source link

Can't Install with Cuda 11.2 & PyTorch 1.7.1 #10

Closed kayuksel closed 3 years ago

kayuksel commented 3 years ago

Hello,

I have seen that Cuda 11 compatible version is already among planned tasks.

I just wanted to let you know that it has been failed with following configuration.

Cuda compilation tools, release 11.2, V11.2.67
Build cuda_11.2.r11.2/compiler.29373293_0
My installed PyTorch library version is 1.7.1
k4ntz commented 3 years ago

Thank you ! Are you building from sources or are you trying to install a wheel, can you tell me what platform you're using?

kayuksel commented 3 years ago

@k4ntz Thank you for your response! I should be using either Ubuntu 20.04 or Ubuntu 20.1 I think I have tried installing a wheel. I will try again with CUDA 11 version and let you know.

kayuksel commented 3 years ago

@k4ntz This is what I have got when I have tried on my second computer with CUDA 11 The same error happened but when installed via wheel and built from sources.

Error in the import, you might have an uncompatible cuda version
/home/kamer/miniconda3/lib/python3.8/site-packages/rational/../rational_activations.libs/libcudart-3f3c6934.so.11.0.221: version `libcudart.so.11.0' not found (required by /home/kamer/miniconda3/lib/python3.8/site-packages/rational/cuda.cpython-38-x86_64-linux-gnu.so)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~/miniconda3/lib/python3.8/site-packages/rational/torch/rational_cuda_functions.py in <module>
      3     try:
----> 4         from rational.cuda import *
      5     except ImportError as Err:

ImportError: /home/kamer/miniconda3/lib/python3.8/site-packages/rational/../rational_activations.libs/libcudart-3f3c6934.so.11.0.221: version `libcudart.so.11.0' not found (required by /home/kamer/miniconda3/lib/python3.8/site-packages/rational/cuda.cpython-38-x86_64-linux-gnu.so)

During handling of the above exception, another exception occurred:

NameError                                 Traceback (most recent call last)
<ipython-input-2-54ec67e9fca5> in <module>
----> 1 from rational.torch import Rational

~/miniconda3/lib/python3.8/site-packages/rational/torch/__init__.py in <module>
----> 1 from .rationals import Rational, RecurrentRational, RecurrentRationalModule

~/miniconda3/lib/python3.8/site-packages/rational/torch/rationals.py in <module>
     12 if torch_cuda_available():
     13     try:
---> 14         from rational.torch.rational_cuda_functions import *
     15     except ImportError as ImpErr:
     16         print('\n\nError importing rational_cuda, is cuda not available?\n\n')

~/miniconda3/lib/python3.8/site-packages/rational/torch/rational_cuda_functions.py in <module>
      6         print(f"Error in the import, you might have an uncompatible cuda version")
      7         print(Err)
----> 8         exit(1)
      9 
     10 class Rational_CUDA_A_F(torch.autograd.Function):

NameError: name 'exit' is not defined
Error in the import, you might have an uncompatible cuda version
No module named 'rational.cuda'
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
~/Desktop/rational_activations/rational/torch/rational_cuda_functions.py in <module>
      3     try:
----> 4         from rational.cuda import *
      5     except ImportError as Err:

ModuleNotFoundError: No module named 'rational.cuda'

During handling of the above exception, another exception occurred:

NameError                                 Traceback (most recent call last)
<ipython-input-1-54ec67e9fca5> in <module>
----> 1 from rational.torch import Rational

~/Desktop/rational_activations/rational/torch/__init__.py in <module>
----> 1 from .rationals import Rational, RecurrentRational, RecurrentRationalModule

~/Desktop/rational_activations/rational/torch/rationals.py in <module>
     12 if torch_cuda_available():
     13     try:
---> 14         from rational.torch.rational_cuda_functions import *
     15     except ImportError as ImpErr:
     16         print('\n\nError importing rational_cuda, is cuda not available?\n\n')

~/Desktop/rational_activations/rational/torch/rational_cuda_functions.py in <module>
      6         print(f"Error in the import, you might have an uncompatible cuda version")
      7         print(Err)
----> 8         exit(1)
      9 
     10 class Rational_CUDA_A_F(torch.autograd.Function):

NameError: name 'exit' is not defined
k4ntz commented 3 years ago

Please assert that python3 -c "import torch; print(torch.cuda.is_available())" yieds True, and your pytorch-CUDA version (that might be lower from the CUDA version you see appearing with nvidia-smi: python3 -c "import torch; print(torch.version.cuda)" Can you try those 3 lines:

pip3 install -U pip wheel
pip3 install torch==1.7.1+cu110 -f https://download.pytorch.org/whl/torch_stable.html
pip3 install https://github.com/ml-research/rational_activations/blob/master/wheelhouse/cuda-11.0/rational_activations-0.1.0-cp38-cp38-manylinux2014_x86_64.whl\?raw\=true

Otherwise, you need to have nvcc : nvcc -V to check your version of nvcc, and install from source by cloning and using: python3 setup.py install --user. If installing from source does not work, you can also check

kayuksel commented 3 years ago

@k4ntz You're right, my pytorch-cuda version was 10.2 (lower than 11 what was appearing at nvidia-smi). I will try to fix it now.

k4ntz commented 3 years ago

Okay, we'll create a better documentation in the README file. You can actually use 10.2 version (default) with =>10.2 CUDA version on the host machine (backward compatibility). I'll also make Docker images available. We are working on a website that introduce rational functions better, from theoretical and coding perspectives.

k4ntz commented 3 years ago

But with a working pytorch10.2 version (default), that you might have installed with pip3 install torch, you can normally simply use: pip3 install rational-activations, and please double-check that you have an updated pip and wheel installed: pip3 install -U pip wheel

k4ntz commented 3 years ago

I am closing it for now. Please reopen if needed. :)