Skip to content

Kilosort4 Support on MacOS in Docker #2746

Open
@tabedzki

Description

@tabedzki

Feature you'd like to see:

I would like support for the MacOS system. I am using the M series chip to develop for our lab and test new tools locally before deploying to our server. The instructions call for the use of the CUDA python package however Macs do not support use NVIDIA hardware, making it difficult or unintuitive to test the package locally.

Additional Context

I reached out to the Kilosort4 maintainer and he responded that this is a SI issue: MouseLand/Kilosort#674.

When I use the Kilosort4 package through the SpikeInterface software, I end up with the following error:

(dj3.9) ➜  Official_Tutorial_SI_0.99_Nov23 git:(master) ✗ pip install cuda
ERROR: Could not find a version that satisfies the requirement cuda (from versions: none)
ERROR: No matching distribution found for cuda
(dj3.9) ➜  Official_Tutorial_SI_0.99_Nov23 git:(master) ✗ pip install cuda-python
ERROR: Could not find a version that satisfies the requirement cuda-python (from versions: none)
ERROR: No matching distribution found for cuda-python

When going through spikeinterface:

sorter_params = si.get_default_sorter_params('kilosort4')
print(sorter_params)

# run spike sorting on entire recording

sorting_MS4 = si.run_sorter(sorter_name='kilosort4', recording=recording_saved, remove_existing_folder=True,
                             output_folder=base_folder / 'results_KS4',
                             verbose=True, **sorter_params, docker_image=True)

{
	"name": "Exception",
	"message": "This sorter requires cuda, but the package 'cuda-python' is not installed. You can install it with:
pip install cuda-python",
	"stack": "---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
File /opt/anaconda3/envs/dj3.9/lib/python3.9/site-packages/spikeinterface/sorters/utils/misc.py:70, in has_nvidia()
     69 try:
---> 70     from cuda import cuda
     71 except ModuleNotFoundError as err:

ModuleNotFoundError: No module named 'cuda'

The above exception was the direct cause of the following exception:

Exception                                 Traceback (most recent call last)
Cell In[56], line 3
      1 # run spike sorting on entire recording
----> 3 sorting_MS4 = si.run_sorter(sorter_name='kilosort4', recording=recording_saved, remove_existing_folder=True,
      4                              output_folder=base_folder / 'results_KS4',
      5                              verbose=True, **sorter_params, docker_image=True)

File /opt/anaconda3/envs/dj3.9/lib/python3.9/site-packages/spikeinterface/sorters/runsorter.py:169, in run_sorter(sorter_name, recording, output_folder, remove_existing_folder, delete_output_folder, verbose, raise_error, docker_image, singularity_image, delete_container_files, with_output, **sorter_params)
    167         else:
    168             container_image = singularity_image
--> 169     return run_sorter_container(
    170         container_image=container_image,
    171         mode=mode,
    172         **common_kwargs,
    173     )
    175 return run_sorter_local(**common_kwargs)

File /opt/anaconda3/envs/dj3.9/lib/python3.9/site-packages/spikeinterface/sorters/runsorter.py:438, in run_sorter_container(sorter_name, recording, mode, container_image, output_folder, remove_existing_folder, delete_output_folder, verbose, raise_error, with_output, delete_container_files, extra_requirements, installation_mode, spikeinterface_version, spikeinterface_folder_source, **sorter_params)
    436     extra_kwargs[\"container_requires_gpu\"] = True
    437 elif gpu_capability == \"nvidia-optional\":
--> 438     if has_nvidia():
    439         extra_kwargs[\"container_requires_gpu\"] = True
    440     else:

File /opt/anaconda3/envs/dj3.9/lib/python3.9/site-packages/spikeinterface/sorters/utils/misc.py:72, in has_nvidia()
     70     from cuda import cuda
     71 except ModuleNotFoundError as err:
---> 72     raise Exception(
     73         \"This sorter requires cuda, but the package 'cuda-python' is not installed. You can install it with:\
pip install cuda-python\"
     74     ) from err
     76 try:
     77     (cu_result_init,) = cuda.cuInit(0)

Exception: This sorter requires cuda, but the package 'cuda-python' is not installed. You can install it with:
pip install cuda-python"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    containerIssues related to container (docker/singularity) versions of sorterssortersRelated to sorters module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions