labgem / PPanGGOLiN

Build a partitioned pangenome graph from microbial genomes
https://ppanggolin.readthedocs.io
Other
242 stars 29 forks source link

Deprecated NumPy #107

Closed seajane closed 1 year ago

seajane commented 1 year ago

I get a error stating that a Boolean feature of NumPy has been deprecated since NumPy version 1.20. The file requirements state the version of NumPy must be greater than 1.21.

"FutureWarning:

In the future np.bool will be defined as the corresponding NumPy scalar.

Traceback (most recent call last): File "/Users/hbouzek/opt/anaconda3/envs/ppgg/bin/ppanggolin", line 5, in from ppanggolin.main import main File "/Users/hbouzek/opt/anaconda3/envs/ppgg/lib/python3.8/site-packages/ppanggolin/main.py", line 19, in import ppanggolin.nem.rarefaction File "/Users/hbouzek/opt/anaconda3/envs/ppgg/lib/python3.8/site-packages/ppanggolin/nem/rarefaction.py", line 19, in from pandas import Series, read_csv File "/Users/hbouzek/opt/anaconda3/envs/ppgg/lib/python3.8/site-packages/pandas/init.py", line 182, in import pandas.testing File "/Users/hbouzek/opt/anaconda3/envs/ppgg/lib/python3.8/site-packages/pandas/testing.py", line 7, in from pandas.util.testing import ( File "/Users/hbouzek/opt/anaconda3/envs/ppgg/lib/python3.8/site-packages/pandas/util/testing.py", line 27, in import pandas._libs.testing as _testing File "pandas/_libs/testing.pyx", line 10, in init pandas._libs.testing File "/Users/hbouzek/opt/anaconda3/envs/ppgg/lib/python3.8/site-packages/numpy/init.py", line 305, in getattr raise AttributeError(__former_attrs_[attr]) AttributeError: module 'numpy' has no attribute 'bool'. np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool` 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"

I am using a conda environment with Python version 3.8

seajane commented 1 year ago

This error prevents me from using any ppanggolin functions including -h help. I tried versions 1.20.74 and 1.20.105 of pangolin with the same result. I've used versions installed with Mamba and from downloads with pip install . and still get the same error.

axbazin commented 1 year ago

My assumption is that the conda recipe got broken by a major release of one of ppanggolin's dependencies.

Could you tell me the pandas and numpy versions of your environment?

I'm pretty sure the problem comes from one of those, most likely the pandas version.

seajane commented 1 year ago

python 3.8.16 and numpy 1.24.2 pandas 0.25.3

axbazin commented 1 year ago

I managed to reproduce your problem. This should solve itself once the conda recipe gets updates. Forcing the numpy version to 1.23 solves it in the meantime.

mamba install ppanggolin numpy=1.23

axbazin commented 1 year ago

Hello

The bioconda recipe has been updated, and the problem seems resolved. Hopefully it is the same for you. If not, don't hesitate to reopen.

Adelme

cmkobel commented 9 months ago

Just installed version 1.2.74 and got the following when running --version:

(ppanggolin) carl@threadripper ppangolin $ ppanggolin --version
/glittertind/home/carl/miniconda3/envs/ppanggolin/lib/python3.8/site-packages/pandas/util/testing.py:27: FutureWarning:

In the future `np.bool` will be defined as the corresponding NumPy scalar.

Traceback (most recent call last):
  File "/glittertind/home/carl/miniconda3/envs/ppanggolin/bin/ppanggolin", line 7, in <module>
    from ppanggolin.main import main
  File "/glittertind/home/carl/miniconda3/envs/ppanggolin/lib/python3.8/site-packages/ppanggolin/main.py", line 19, in <module>
    import ppanggolin.nem.rarefaction
  File "/glittertind/home/carl/miniconda3/envs/ppanggolin/lib/python3.8/site-packages/ppanggolin/nem/rarefaction.py", line 19, in <module>
    from pandas import Series, read_csv
  File "/glittertind/home/carl/miniconda3/envs/ppanggolin/lib/python3.8/site-packages/pandas/__init__.py", line 182, in <module>
    import pandas.testing
  File "/glittertind/home/carl/miniconda3/envs/ppanggolin/lib/python3.8/site-packages/pandas/testing.py", line 7, in <module>
    from pandas.util.testing import (
  File "/glittertind/home/carl/miniconda3/envs/ppanggolin/lib/python3.8/site-packages/pandas/util/testing.py", line 27, in <module>
    import pandas._libs.testing as _testing
  File "pandas/_libs/testing.pyx", line 10, in init pandas._libs.testing
  File "/glittertind/home/carl/miniconda3/envs/ppanggolin/lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` 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
(ppanggolin) carl@threadripper ppangolin $ mamba --version
mamba 1.1.0
conda 23.1.0
(ppanggolin) carl@threadripper ppangolin $ 

I used the installation instructions in the readme.

jpjarnoux commented 9 months ago

Hi @cmkobel Thank you for using PPanGGOLiN. We have just released version 2 of PPanGGOLiN. I suggest you reinstall PPanGGOLiN in its proper environment like this:

# Install PPanGGOLiN into a new conda environment
conda create -n ppanggolin -c defaults -c conda-forge -c bioconda ppanggolin

# Check PPanGGOLiN install
conda activate ppanggolin
ppanggolin --version

You can find more information here: https://ppanggolin.readthedocs.io/en/latest/user/install.html

Please note that pangenomes between versions 1 & 2 are not compatible.

In addition, version 1.2.74 is not the latest version 1 of PPanGGOLiN. If you wish to keep version 1, update your version of PPanGGOLiN as follows: conda install ppanggolin=1.2.105