SpikeInterface / spikeinterface

A Python-based module for creating flexible and robust spike sorting pipelines.
https://spikeinterface.readthedocs.io
MIT License
521 stars 186 forks source link

Kilosort docker image cant install spikeinterface #3502

Open arturoptophys opened 1 week ago

arturoptophys commented 1 week ago

Hi all, i have troubles to run sorting in docker containers for Kilosort 3 but also Kilosort 2.5 If i just run the sorter with docker_image=True

installation_mode='auto' switching to installation_mode: 'github'
Starting container
Installing spikeinterface with github in container
Installing neo with pypi in container
Running kilosort3 sorter inside spikeinterface/kilosort3-compiled-base
Stopping container
[2024-10-23 13:07:00,075][ERROR]: Spike sorting in docker failed with the following error:
Traceback (most recent call last):
  File "path_removed/in_container_sorter_script.py", line 4, in <module>
    from spikeinterface import load_extractor
ModuleNotFoundError: No module named 'spikeinterface'

switching mode to pypi doesnt solve this issue.

I tried to build modified docker image with:

FROM spikeinterface/kilosort3-compiled-base:latest
RUN pip install --user "spikeinterface[full] @ git+https://github.com/SpikeInterface/spikeinterface.git"

yet here I get the error the newest spikeinterface is not compatible with python version in container.

ERROR: Package 'spikeinterface-0.102.0' requires a different Python: 3.8.1 not in '<4.0,>=3.9'

switching to installation from pypi solved the docker build, and if i point docker_image to this build it runs.

Overall, it seems the installation_mode using github is not compatible anymore with python versions in docker containers. However, why switching installation_mode to pypi didn't help im not sure...

Best, Artur

arturoptophys commented 1 week ago

Same with pykilosort docker. Also fixable by creating custom docker and installing spikeinteface from pypi.

zm711 commented 1 week ago

Where is the python 3.8 coming from? It went end of life in October of this year so we switched over to >=3.9 in main. Do you need python 3.8 for something?

arturoptophys commented 1 week ago

No clue, I assumed it was from docker container. I'm running 3.10.12 locally.

zm711 commented 1 week ago

@alejoe91 knows all the docker stuff. So he can comment on this. Maybe we need to make new dockers with an appropriate python version?

samuelgarcia commented 1 week ago

I guess we need to rebuild kilosort with more recent pyhon. The workaround is to install spikeinterface with the 0.101.0 version which support python 3.8 now si need python > 3.8

Lingsheng-Meng commented 1 week ago

Same with pykilosort docker. Also fixable by creating custom docker and installing spikeinteface from pypi.

Same issue with herdingspikes docker.

alejoe91 commented 2 days ago

Thanks for pinging guys! I'll update the python3.8 images over the week!

alejoe91 commented 2 days ago

@arturoptophys I'm testing the different images and they are all Python>=3.9.

Is it possible that your local images are outdated? I would suggest removing them locally and pulling the latest image again.

arturoptophys commented 2 days ago

Indeed, I have tried spike sorting some time ago and downloaded docker image back then. running docker image ls showed they were build > year ago with old python.

run -it spikeinterface/kilosort3-compiled-base:latest
root@41dbd15b9634:/# python --version
Python 3.8.1

Cant test pulling newest version right now as I run out of disc space on my pc :/ .. but I assume this would solve the issue. Sorry for the false alarm.

Wouldn't it make sense to add "docker pull" if one is using "latest" image, when trying to spikesort? As this would prevent the issue of updating the spikeinterface repo but accessing old docker image, like happened to me.

alejoe91 commented 2 days ago

I think that this is a good idea. We could check that the local latest image ID is the same as the on on docker hub, and if not trigger a new pull!