spikeinterface: Spike sorting Error : attribute error due to `np.issctype' removed from Numpy 2.0

Hi, This issue may be relevant to ‘Support Numpy 2.0’ issue opened by @h-mayorquin yesterday. Looks like np.issctype' was removed from Numpy 2.0 which is resulting in a spikesorting error. It says 'AttributeError: np.issctypewas removed in the NumPy 2.0 release. Useissubclass(rep, np.generic)` instead’. I tried to change it to ‘issubclass(obj, np.generic)’ but surprisingly the ‘core’ folder in spikeinterface folder is not there, therefore, no core_tools.py’ file where I could make these changes. It surprised me because these files/folder are there in my personal laptop but cannot be found in the computer where I actually run analysis. The spikeinterface folder in the analysis computer only has two folders: postprocessing and qualitymetrics. When I updated SI some months ago I pulled it from github and I believe its doing automatic updates anytime there’s an update or changes. However, if that’s the case, it is still surprising that there are no other folder besides these two. Anyways, I will appreciate if you guys can guide me how to resolve this.

Thanks J

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 53 (18 by maintainers)

Most upvoted comments

Maybe you can try to do

run_sorter(..., extra_requirements="numpy==1.26", docker_image=True, ...)

not sure at all if this works but this could solve temporary the issue because we set the boundaris numpy<2 in pypi release

It might need to be a list: ["numpy==1.26.4"]

To summarize there are three options:

  1. If you are well versed in docker you can do something along the lines of what Alessio says.
  2. See if @alejoe91 decides to do a new release.
  3. Downgrade for a while, we will have a release in a month at most.

I vote for making a new release with the latest kilosort changes and the numpy bound.

As there is a solution to this and it will be fixed in the upcoming release for dev as well I am closing this.

I did as you suggested. But it still shows version 100.7.

@taningh86 I think first we have to make sure this is going into the correct environment. What does your terminal say?

The version should be 0.101.0rc0 based on the pyproject.toml. Could you also open the pyproject.toml that you cloned with git clone and see what version it says inside the toml?

Also, after a reinstall do we need to also create a new environment with conda env create --file full_spikeinterface_environment_windows.yml? I have been doing that and not sure if that’s necessary if I am not doing conda remove --name si_env --all.

This makes me think this could be contributing to the problem. Before doing anything with conda we need to make sure we are in the correct environment. So I wasn’t clear before (that’s my bad!)

conda activate si_env
git clone https://github.com/SpikeInterface/spikeinterface.git
cd spikeinterface
pip install -e .[full,widgets]
cd ..

You need to be in your environment. If both you and your research partner are fiddling with stuff in (base) as well as in your environment that could contribute to the issue.

If you are using the full_spikeinterface_environment_windows.yml it will attempt to install 0.100.7 because it does the most recent release. This is a limitation of being a pip package in something that is being so actively developed. We have this installation tips rolling install to help users auto install main. So if you were trying to use the windows automatic environment install it could mess things up depending on the order you were doing things.

Really everything will settle down in July-ish after the next full release.

Sorry this is frustrating. NumPy 2.0 has affected quite a few packages and now we all have to work on trying to fix stuff. People actively updating/changing things in the past week are caught in the struggle for the package.

For your specific issue we aren’t sure how it happened. It should have only tried to update numpy if you or someone else on the workstation did a

pip install -U

or similar with Conda. The issue is when numpy was updated it broke everything for you. Is this a shared workstation that someone else may have accidentally used? Or did you recently update anything?

What I would do is

git clone https://github.com/SpikeInterface/spikeinterface.git
cd spikeinterface
pip install -e .[full,widgets]
cd ..

Notice you’re missing the full,widgets with the . which will do the full install. Could you try that? And see if that gets us back up to speed.

The new release to come (0.101.0) is already fixed;)

Yes for that you’ll need to wait until the next release 😉 #3061

Hopefully out on Monday