Error with numpy==1.24.4
taprs opened this issue · 1 comments
taprs commented
Hi Hengchi and thank you for improving the tool!
I installed wgd v2.0.22
into a brand new venv and got an error upon running wgd viz
:
Traceback (most recent call last):
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/bin/wgd", line 11, in
load_entry_point('wgd', 'console_scripts', 'wgd')()
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/netscratch/dep_mercier/grp_novikova/software/wgd/cli.py", line 557, in viz
_viz(**kwargs)
File "/netscratch/dep_mercier/grp_novikova/software/wgd/cli.py", line 560, in _viz
from wgd.viz import elmm_plot, apply_filters, multi_sp_plot, default_plot,all_dotplots,filter_by_minlength,dotplotunitgene,dotplotingene,filter_mingenumber,dotplotingeneoverall
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd/viz.py", line 20, in
from sklearn import mixture
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/mixture/__init__.py", line 5, in
from ._gaussian_mixture import GaussianMixture
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/mixture/_gaussian_mixture.py", line 11, in
from ._base import BaseMixture, _check_shape
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/mixture/_base.py", line 14, in
from .. import cluster
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/cluster/__init__.py", line 6, in
from ._spectral import spectral_clustering, SpectralClustering
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/cluster/_spectral.py", line 16, in
from ..neighbors import kneighbors_graph, NearestNeighbors
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/neighbors/__init__.py", line 17, in
from ._nca import NeighborhoodComponentsAnalysis
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/neighbors/_nca.py", line 22, in
from ..decomposition import PCA
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/decomposition/__init__.py", line 17, in
from .dict_learning import dict_learning
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/decomposition/dict_learning.py", line 5, in
from . import _dict_learning # type: ignore
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/decomposition/_dict_learning.py", line 21, in
from ..linear_model import Lasso, orthogonal_mp_gram, LassoLars, Lars
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/linear_model/__init__.py", line 11, in
from ._least_angle import (Lars, LassoLars, lars_path, lars_path_gram, LarsCV,
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/sklearn/linear_model/_least_angle.py", line 34, in
method='lar', copy_X=True, eps=np.finfo(np.float).eps,
File "/netscratch/dep_mercier/grp_novikova/software/wgd/wgd_2.0.22/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
So it seems that the installation instructions include the newest version of numpy:
$ pip freeze | grep numpy
numpy==1.24.4
Installing numpy==1.22
into the venv fixed the issue for me. Maybe it's worth adding numpy version limitation into the installation files?
Best, Nikita
heche-psb commented
Hi, Thanks for pointing it out! I didn't change the requirements.txt
pertaining to numpy
because the pytest behaved weird if I fixed the version of numpy
that it couldn't be compatible with multiple versions of python
anymore. I will do some extra test to ensure the compatibility properly. Thanks again for your suggestions!