MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.33k stars 381 forks source link

After reinstalling Cellpose, it says "TORCH CUDA version not installed/working" #595

Closed DebrajGhose closed 1 year ago

DebrajGhose commented 1 year ago

Cellpose was working wonderfully on my Windwos 10 machine till yesterday, but then I had to uninstall and reinstall Anaconda. When I reinstalled Cellpose, it started throwing up the "TORCH CUDA version not installed/working" error every time I started it.

I first tried installing using the instructions on the GItHub (https://github.com/MouseLand/cellpose):

conda create --name cellpose python=3.8 conda activate cellpose python -m pip install cellpose[gui]

EDIT: I forgot to include that I also ran the instructions to install pytorch:

pip uninstall torch
conda install pytorch cudatoolkit=11.3 -c pytorch

I think the above was probably what I had done the first time around and cellpose worked great back then. But now I get the "TORCH CUDA version not installed/working" error.

I then tried the instructions from the documentation (https://cellpose.readthedocs.io/en/latest/installation.html):

conda create -n cellpose pytorch=1.8.2 cudatoolkit=10.2 -c pytorch-lts conda activate cellpose pip install cellpose[gui]

When I followed the instructions in the documentation, typing "cellpose" caused the anaconda prompt to stall and never throw up the gui. The documentation says to use python 3.7 but using the command conda install python=3.7 in the cellpose environment throws up a bunch of errors.

I also tried doing (I don't know if the commands below are correct, I tried to pattern match with existing commands):

conda create --name cellpose python=3.7 conda acitvate cellpose conda install pytorch=1.8.2 cudatoolkit=10.2 -c pytorch-lts pip install cellpose[gui]

But even this leads to the anaconda prompt stalling when I try to run cellpose. What should I do or what can I check to make cellpose work again?

carsen-stringer commented 1 year ago

I think you need to use python=3.8. Can you please try the following instructions after following the first set of commands? https://github.com/MouseLand/cellpose#gpu-version-cuda-on-windows-or-linux

the first set of commands:

conda create --name cellpose python=3.8
conda activate cellpose
python -m pip install cellpose[gui]

does not install a GPU CUDA version of pytorch, for that you need to follow the instructions on the readme for GPU version

DebrajGhose commented 1 year ago

Sorry, I forgot to add the two lines to install a GPU CUDA version of pytorch in my original post:

pip uninstall torch
conda install pytorch cudatoolkit=11.3 -c pytorch

I did run these instructions and I still get the same error. The first time that I tried this, it worked fine. I'm not sure what may have changed since I had to reinstall Anaconda.

DebrajGhose commented 1 year ago

Just got it to work! I updated Nvidia drivers and then reinstalled cellpose using the following instructions (basically same as your GitHub readme):

conda create --name cellpose python=3.8
conda activate cellpose
python -m pip install cellpose[gui]
pip uninstall torch
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia