-
-
Notifications
You must be signed in to change notification settings - Fork 191
Description
These error happens during import dash_bio in Python 3.12 if numpy>=2.3.0 because of this change:
Removed the np.compat package source code (removed in 2.0)
(gh-28961)
Ref: https://numpy.org/doc/stable/release/2.3.0-notes.html#expired-deprecations
The fix would be to update the dash-bio code to adhere to numpy>=2.0.0.
In the meantime, a workaround is to fix/specify numpy<2.3.0 in the environment where you are running this code.
Additional information
Complete traceback:
Traceback (most recent call last):
File "/home/workspaceuser/app/app_bio.py", line 4, in <module>
import dash_bio as dashbio
File "/home/workspaceuser/layers/paketo-buildpacks_pip-install/packages/lib/python3.12/site-packages/dash_bio/__init__.py", line 28, in <module>
from . import utils # noqa: F401,E402
^^^^^^^^^^^^^^^^^^^
File "/home/workspaceuser/layers/paketo-buildpacks_pip-install/packages/lib/python3.12/site-packages/dash_bio/utils/__init__.py", line 1, in <module>
from .pdb_parser import PdbParser # noqa: F401,E402
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/workspaceuser/layers/paketo-buildpacks_pip-install/packages/lib/python3.12/site-packages/dash_bio/utils/pdb_parser.py", line 7, in <module>
import parmed as pmd
File "/home/workspaceuser/layers/paketo-buildpacks_pip-install/packages/lib/python3.12/site-packages/parmed/__init__.py", line 23, in <module>
from . import amber, charmm, gromacs, dlpoly, namd, openmm, rosetta, tinker, entos
File "/home/workspaceuser/layers/paketo-buildpacks_pip-install/packages/lib/python3.12/site-packages/parmed/amber/__init__.py", line 14, in <module>
from .netcdffiles import NetCDFTraj, NetCDFRestart
File "/home/workspaceuser/layers/paketo-buildpacks_pip-install/packages/lib/python3.12/site-packages/parmed/amber/netcdffiles.py", line 25, in <module>
from ..utils.netcdf import netcdf_file as NetCDFFile
File "/home/workspaceuser/layers/paketo-buildpacks_pip-install/packages/lib/python3.12/site-packages/parmed/utils/netcdf.py", line 46, in <module>
from numpy.compat import asbytes, asstr
ModuleNotFoundError: No module named 'numpy.compat'
Environment to reproduce the issue:
- Python 3.12
- requirements.txt:
dash-bio==1.0.2
# these two should get installed automatically as dependencies unless there are other (different) existing versions
numpy>=2.3.0
parmed==4.3.0
The error happens at the import step, so no need to use a specific Dash app. If needed, any sample app from the docs can be used: https://dash.plotly.com/dash-bio/molecule2dviewer
No version of ParmEd is specified in the current dependencies of dash-bio: https://github.com/plotly/dash-bio/blob/v1.0.2/setup.py#L36
In any case, in Python 3.12, only ParmEd >=4.2.1 is available: https://github.com/ParmEd/ParmEd/releases/tag/4.2.1