Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: Torch not compiled with CUDA enabled #549

Closed
rafaelblevin821 opened this issue May 10, 2022 · 5 comments
Closed

AssertionError: Torch not compiled with CUDA enabled #549

rafaelblevin821 opened this issue May 10, 2022 · 5 comments

Comments

@rafaelblevin821
Copy link

Hi,

I'm having trouble getting Bindsnet to work with the GPU.

I had been having this problem for months and finally solved it by completely uninstalling PyTorch and reinstalling it, then making sure all Cuda drivers were up to date.

I checked with:

torch.cuda.is_available()
True

However, after this, Bindsnet would no longer work. So I re-installed Bindsnet again, although during install I noticed Bindsnet uninstalled the newest version of torch and installed an older version.

So now when I run:

torch.cuda.is_available()
I get:
False

I don't know how anyone else can get Bindsnet to run on their GPU with Cuda. I tried older versions of Cuda and it would not work.

I feel a simple solution would be to update the install with the newest version of PyTorch.

@Hananel-Hazan
Copy link
Collaborator

Thank you for using BindsNET.
You are correct, BindsNET use poetry for managing dependencies. Poetry install the CPU version and not the GPU version, this is a known bug . I hope they will solve it soon.

The only temporary solution is to install PyTorch GPU version after installing BindsNET.

@danielgafni Please take a look in this issue.

@danielgafni
Copy link
Contributor

Hey @rafaelblevin821 !

By installing BindsNET you get the CPU torch build by default.

However, nothing prevents you from installing the GPU build if you need it. For example:

# automatically get the right version for your setup (for CUDA 11) 
python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
# install a specific torch version
python -m pip install https://download.pytorch.org/whl/cu113/torch-1.10.0%2Bcu113-cp38-cp38-linux_x86_64.whl

Or add

torch = { url = "https://download.pytorch.org/whl/cu113/torch-1.10.0%2Bcu113-cp38-cp38-linux_x86_64.whl", platform = "linux" }

to pyproject.toml if using Poetry.

You can choose the right version for your setup here. A convenient way to do it is to run python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 once and check which specific version is getting picked automatially.

The reason why torch is getting overwritten for you is because you don't seem to fix it's version. You can do it by using any python package manager like Poetry, conda, pyenv or even simply pip with a requirements.txt file.

@rafaelblevin821
Copy link
Author

Hi @danielgafni, I have tried this several times already. I get Cuda working with PyTorch, but when I run BindsNet it no longer works. The only way to get BindsNet working after this is to re-install it... then we are back to square 1.

Can you confirm that have gotten BindsNet to work with the GPU and PyTorch?

@danielgafni
Copy link
Contributor

Yes, I'm running BindsNET with CUDA right now.

What do you mean by

when I run BindsNET it no longer works

?

Can you post the error message?

@rafaelblevin821
Copy link
Author

@Hananel-Hazan and @danielgafni BindsNet seems to be working with Cuda now. I was getting Poetry related errors, but after a full uninstall of Pytorch and a restart, I was able to install Pytorch with Cuda and get it working with BindsNet. Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants