fangwei123456 / spikingjelly

SpikingJelly is an open-source deep learning framework for Spiking Neural Network (SNN) based on PyTorch.
https://spikingjelly.readthedocs.io
Other
1.32k stars 237 forks source link

Bug:"CuPy is not installed!", even I have installed cupy-cuda12x with spikingjelly 0.0.0.0.14. #459

Open yuchenweng-private opened 11 months ago

yuchenweng-private commented 11 months ago

Read before creating a new issue

For faster response

You can @ the corresponding developers for your issue. Here is the division:

Features Developers
Neurons and Surrogate Functions fangwei123456
Yanqi-Chen
CUDA Acceleration fangwei123456
Yanqi-Chen
Reinforcement Learning lucifer2859
ANN to SNN Conversion DingJianhao
Lyu6PosHao
Biological Learning (e.g., STDP) AllenYolk
Others Grasshlw
lucifer2859
AllenYolk
Lyu6PosHao
DingJianhao
Yanqi-Chen
fangwei123456

We are glad to add new developers who are volunteering to help solve issues to the above table.

Issue type

SpikingJelly version

0.0.0.0.14

Description

..I have already tried to rebuild the whole environment with torch version 1.8.0 with cuda 11.1, but when I tried to build a MultiStepLIFNode with cupy backend, it still shows that I have not installed cupy.

Minimal code to reproduce the error/bug


import spikingjelly
# ...
AssertionError: CuPy is not installed! You can install it from "https://github.com/cupy/cupy".
yuchenweng-private commented 11 months ago

image Here is a part of my environment packages list. This is so wired that because I have tried to build MultiStepLIFNode before and it runs good with cupy backend.

fangwei123456 commented 11 months ago

Hi, please install SpikingJelly from GitHub (master version) and check if it solves this problem.

yuchenwengwyc commented 11 months ago

Thanks, Dr, Fang. Finally, after I install the master version from github, it works with module activation_based.neuron LIFNode, and it is so wired that then I reinstall the old version, everything is good also with MultiStepLIFneuron.

QiWang233 commented 8 months ago

Issue type

Description

I have already tried to rebuild the whole environment with torch version 1.13.0 with cuda 11.6, but when I tried to build a MultiStepLIFNode with cupy backend, it still shows that I have not installed cupy.

Conda list

微信图片_20240126191539

Code

微信图片_20240126191642

Error

微信图片_20240126185610

Version NVIDIA GeForce RTX 4090

微信图片_20240126191753

  1. "import cupy" is fine.
  2. "change to the latest spikingjelly" doesnot work.

I had tried everything I can do, but it did not work, my god. @fangwei123456

fangwei123456 commented 8 months ago

@QiWang233 Hi, you can set logging level as DEBUG (https://docs.python.org/3/library/logging.html#logging.DEBUG) and check the outputs.

Meanwhile, you can also try to install the latest version from GitHub. Note that the MultiStepLIFNode is removed in the latest version. You can use LIFNode with step_mode = 'm'.

QiWang233 commented 8 months ago

thanks for your reply! After changing the logging.debug and installing the latest version, I get questions below. It can be seen that it is because of the lack of "lava" , so I wonder how can I install the "lava" correctly.

image

fangwei123456 commented 8 months ago

Hi, lava is not easy to be installed... I suggest that you can change the source codes to avoid this problem (just ignore lava). Or you can install the latest version from github (we have fixed this problem).

QiWang233 commented 8 months ago

Thanks for your patience!This is very important to me. But after changing to the lastest version 0.0.0.0.15,still the same problem.

import torch
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s')

try:
    import cupy
except BaseException as e:
    cupy = None

assert cupy is not None

print(cupy)
import spikingjelly
print(spikingjelly)
from spikingjelly.activation_based import neuron

lif = neuron.LIFNode(step_mode='m', backend='cupy').to('cuda:3')
x = torch.randn(10, 3, 224, 224).to('cuda:3')
out = lif(x)
print(out.shape)

image

I do not know why...

fangwei123456 commented 8 months ago

Set device as cuda:0 and try again?

QiWang233 commented 8 months ago

Sorry, it does not work...it is so weird.

QiWang233 commented 8 months ago

Thank you! After changing to a device with 3090(4090->3090), it is solved. Hope my experience can help the other! But I still do not know why 4090 have problem, maybe it is related to the "High Version".

sertreet commented 3 weeks ago

I have also encountered the same problem and have been struggling for two days... This is the log: INFO:root:spikingjelly.clock_driven.lava_exchange: No module named 'lava.lib' INFO:root:spikingjelly.clock_driven.neuron: No module named 'tensorboard' INFO:root:spikingjelly.clock_driven.neuron: No module named 'lava.lib' Then I installed Lava and TensorBoard and used them normally, although the logs still showed: INFO:root:spikingjelly.clock_driven.lava_exchange: No module named 'lava.lib' INFO:root:spikingjelly.clock_driven.neuron: No module named 'lava.lib' But it no longer affects its use