padster / pyNeuroTrace

Python code for processing neural timeseries
https://padster.github.io/pyNeuroTrace/
Mozilla Public License 2.0
2 stars 2 forks source link

error importing pyneurotrace after installation #4

Closed danielmk closed 2 months ago

danielmk commented 3 months ago

This issue is part of the review at openjournals/joss-reviews#6877

This issue concerns the installation instructions.

I created a new environment with conda create --name pyneurotrace python=3.9 and then in the new environment ran pip install pyneurotrace as per the installation instructions. pip does not raise any errors. Then in Python I get the following error trying to import pyneurotrace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Daniel\anaconda3\envs\pyneurotrace\lib\site-packages\pyneurotrace\__init__.py", line 1, in <module>
    from . import gpu
  File "C:\Users\Daniel\anaconda3\envs\pyneurotrace\lib\site-packages\pyneurotrace\gpu\__init__.py", line 1, in <module>
    from . import filters
  File "C:\Users\Daniel\anaconda3\envs\pyneurotrace\lib\site-packages\pyneurotrace\gpu\filters.py", line 2, in <module>
    import cupy as cu
ModuleNotFoundError: No module named 'cupy'

Did I miss something? I'm on windows 10.

Peter-Hogg commented 3 months ago

Hi Daniel,

Something is not working as it should. There appears to be an issue with the optional dependency Cupy. I thought it was setup so that the base install would ignore the GPU versions. I'll investigate this and give you an update once I resolve this issue.

Peter-Hogg commented 3 months ago

I believe I have fixed the issue

danielmk commented 2 months ago

Thank you for the fix. I can indeed import pyneurotrace now. Without having cupy installed. If I understand correctly, the pip install described in the readme installs pyneurotrace always in a way that it does not support the GPU implementation. I think that's generally good, since users should be able to explore the package without worrying about GPU. However, since the GPU implementation is a major part of the JOSS submission, I'd suggest that the readme should explain how to install with GPU support.

Peter-Hogg commented 2 months ago

There is a flag for the pip install command that will include Cupy (pip install pyNeuroTrace[GPU]) which will try to install Cupy with other dependencies. This is currently noted in the documentation but not the ReadMe. It is a bit tricky because Cupy is dependent on several requirements that must be set up for it to work correctly.

I agree with your suggestion and I have updated the ReadMe to detail installing pyNeuroTrace with Cupy. I'll add some of what I've written into the documentation as well so that it had additional detail and links to Cupy documentation as well.

I've also noticed that numpy 2.0 breaks several functions and I will have to updated the requirements to use a numpy version <2.0 until I can investigate why they are breaking and update them accordingly.

danielmk commented 2 months ago

pyneurotrace installs now without cupy so this is closed. If I run into problems installing with cupy I will open a separate issue.