Closed Datamance closed 4 months ago
Because of how the entrypoint generator is written,
18 │ def importlib_load_entry_point(spec, group, name):
19 │ dist_name, _, _ = spec.partition('==')
20 │ matches = (
21 │ entry_point
22 │ for entry_point in distribution(dist_name).entry_points
23 │ if entry_point.group == group and entry_point.name == name
24 │ )
25 │ return next(matches).load()
This is going to break every time. I'm not sure how this function is generated but perhaps you can tell setup.py to actually use the version information rather than throwing it away...
I'm not sure what's going on with how you load modules, but issues seem to arise with the use of virtual environments.
Even if I do pip install phy --pre
without --upgrade
, ensuring that I can pin numpy to a version that contains np.bool
(I chose 1.22.4 to roughly match the date of the last commit in this repo), I still get this numpy compilation error:
RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
upon running either phy template-gui params.py
via the CLI or running it from a python script via
from phy.apps.template import template_gui
template_gui("params.py")
To me, this suggests that phy
is somehow trying to circumvent the numpy
in the virtualenv and attempting to use the only updated one on my system - the one in my global python installation:
╭─rico at Five-Pebbles in ~/Science/Data/062122Ferret_Pen4_mseq1_g1/kilosort3 23-02-07 - 15:55:39
╰─○ python -c "import numpy as np; print(np.__version__); print(np.__file__)"
1.24.2
/home/rico/.asdf/installs/python/3.11.1/lib/python3.11/site-packages/numpy/__init__.py
╭─rico at Five-Pebbles in ~/Science/Data/062122Ferret_Pen4_mseq1_g1/kilosort3 23-02-07 - 15:55:56
╰─○ source env/bin/activate
(env) ╭─rico at Five-Pebbles in ~/Science/Data/062122Ferret_Pen4_mseq1_g1/kilosort3 23-02-07 - 15:56:04
╰─(env) ○ python -c "import numpy as np; print(np.__version__); print(np.__file__)"
1.22.4
/home/rico/Science/Data/062122Ferret_Pen4_mseq1_g1/kilosort3/env/lib/python3.11/site-packages/numpy/__init__.py
Have other people run into similar issues? What is the suggested workaround here?
OK, I hunted down the version of numpy (1.23.1) that is compiled against the same C API as what's being used by Phy, while also still including the deprecated np.bool
. You have to pin this dependency and then phy will run.
Please fix this. All it takes is pinning your dependencies, which you should do anyway.
Consider using poetry to lock dependencies, and errors like this will never happen again.
I have the same error, so far "upgrading" to numpy 1.23.1 has solved it pip3 install --upgrade numpy==1.23.1
Windows 10
If you want to make this solution portable, I recently created phy-poetry
. You can pip install phy-poetry
.
Hi there,
I'm trying to use Phy in a virtual environment containing Python 3.11.1 and numpy 1.24.2. I get this error when I try to run the standard
phy template-gui params.py
What is the maximum numpy version to which I must downgrade in order to get this working? Thanks.