biocore / biom-format

The Biological Observation Matrix (BIOM) Format Project
http://biom-format.org
Other
89 stars 95 forks source link

AttributeError: module 'numpy' has no attribute 'typeDict' #891

Closed nano1231 closed 1 year ago

nano1231 commented 1 year ago

I installed biom-format and when I run biom convert to concert a biom file to a tsv I get the error:

AttributeError: module 'numpy' has no attribute 'typeDict'

I tried to install an earlier version of numpy, 1.21, but I still get the same error.

wasade commented 1 year ago

@nano1231, could you provide the full traceback please? typeDict does not exist in the biom module so at the moment I'm unsure of the provenance of the error.

(base) 08:22:53 (dtmcdonald@there):biom@master$ grep -ri typedict *
(base) 08:22:57 (dtmcdonald@there):biom@master$ 
nano1231 commented 1 year ago

@wasade Thank you!!! Here is the traceback:

Traceback (most recent call last): File "/Users/fernandonieto/opt/miniconda3/bin/biom", line 7, in from biom.cli import cli File "/Users/fernandonieto/opt/miniconda3/lib/python3.9/site-packages/biom/init.py", line 51, in from .table import Table File "/Users/fernandonieto/opt/miniconda3/lib/python3.9/site-packages/biom/table.py", line 190, in from biom.util import (get_biom_format_version_string, File "/Users/fernandonieto/opt/miniconda3/lib/python3.9/site-packages/biom/util.py", line 25, in import h5py File "/Users/fernandonieto/opt/miniconda3/lib/python3.9/site-packages/h5py/init.py", line 46, in from ._conv import register_converters as _register_converters File "h5py/_conv.pyx", line 1, in init h5py._conv File "h5py/h5t.pyx", line 293, in init h5py.h5t File "/Users/fernandonieto/opt/miniconda3/lib/python3.9/site-packages/numpy/init.py", line 284, in getattr raise AttributeError("module {!r} has no attribute " AttributeError: module 'numpy' has no attribute 'typeDict'

wasade commented 1 year ago

It looks like an issue with h5py, but it's all weird. How was biom-format installed?

nano1231 commented 1 year ago

I installed in my MacOS Big Sur 11.3.1 terminal: conda install -c conda-forge biom-format

wasade commented 1 year ago

Thanks. Can you send the output of conda list?

I'm unable to recreate this issue locally (Big Sir 11.6.8). Do you by chance have an M1 chip?

(qiime2-2022.11) 15:56:37 (dtmcdonald@there):Downloads$ conda create --name biomtest -c conda-forge biom-format
...snip...
(qiime2-2022.11) 15:57:58 (dtmcdonald@there):Downloads$ act biomtest
(biomtest) 15:58:03 (dtmcdonald@there):Downloads$ biom
Usage: biom [OPTIONS] COMMAND [ARGS]...

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  add-metadata       Add metadata to a BIOM table.
  convert            Convert to/from the BIOM table format.
  export-metadata    Export metadata as TSV.
  from-uc            Create a BIOM table from a vsearch/uclust/usearch...
  head               Dump the first bit of a table.
  normalize-table    Normalize a BIOM table.
  show-install-info  Provide information about the biom-format installation.
  subset-table       Subset a BIOM table.
  summarize-table    Summarize sample or observation data in a BIOM table.
  table-ids          Dump IDs in a table.
  validate-table     Validate a BIOM-formatted file.
(biomtest) 15:58:31 (dtmcdonald@there):Downloads$ python
Python 3.11.0 | packaged by conda-forge | (main, Jan 15 2023, 05:44:48) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
>>> 
nano1231 commented 1 year ago

This is the conda list output: biom-format 2.1.14 py39ha30fb19_1 conda-forge blas 1.0 mkl
bottleneck 1.3.5 py39h67323c0_0
brotlipy 0.7.0 py39h9ed2024_1003
ca-certificates 2022.12.7 h033912b_0 conda-forge certifi 2022.12.7 pyhd8ed1ab_0 conda-forge cffi 1.15.1 py39hc55c11b_0
charset-normalizer 2.0.4 pyhd3eb1b0_0
click 8.1.3 unix_pyhd8ed1ab_2 conda-forge conda 22.11.1 py39h6e9494a_1 conda-forge conda-package-handling 1.9.0 py39hca72f7f_1
cryptography 38.0.1 py39hf6deb26_0
h5py 2.10.0 nompi_py39h1bb8402_106 conda-forge hdf5 1.10.6 nompi_haae91d6_101 conda-forge idna 3.4 py39hecd8cb5_0
intel-openmp 2021.4.0 hecd8cb5_3538
libblas 3.9.0 12_osx64_mkl conda-forge libcblas 3.9.0 12_osx64_mkl conda-forge libcxx 14.0.6 h9765a3e_0
libffi 3.3 hb1e8313_2
libgfortran 4.0.0 7_5_0_h1a10cd1_23 conda-forge libgfortran4 7.5.0 h1a10cd1_23 conda-forge liblapack 3.9.0 12_osx64_mkl conda-forge llvm-openmp 15.0.7 h61d9ccf_0 conda-forge mkl 2021.4.0 hecd8cb5_637
mkl-service 2.4.0 py39h9ed2024_0
mkl_fft 1.3.1 py39h4ab4a9b_0
mkl_random 1.2.2 py39hb2f4e1b_0
ncurses 6.3 hca72f7f_3
numexpr 2.8.4 py39he696674_0
numpy 1.24.1 py39hdfa1d0c_0 conda-forge openssl 1.1.1s hfd90126_1 conda-forge packaging 21.3 pyhd3eb1b0_0
pandas 1.4.4 py39he9d5cce_0
pluggy 1.0.0 pyhd8ed1ab_5 conda-forge pycosat 0.6.4 py39hca72f7f_0
pycparser 2.21 pyhd3eb1b0_0
pyopenssl 22.0.0 pyhd3eb1b0_0
pyparsing 3.0.9 py39hecd8cb5_0
pysocks 1.7.1 py39hecd8cb5_0
python 3.9.5 h88f2d9e_3
python-dateutil 2.8.2 pyhd3eb1b0_0
python-wget 3.2 py_0 conda-forge python.app 3 py39h9ed2024_0
python_abi 3.9 2_cp39 conda-forge pytz 2022.1 py39hecd8cb5_0
readline 8.2 hca72f7f_0
requests 2.28.1 py39hecd8cb5_0
ruamel.yaml 0.17.21 py39ha30fb19_2 conda-forge ruamel.yaml.clib 0.2.7 py39ha30fb19_1 conda-forge ruamel_yaml 0.15.100 py39h9ed2024_0
scipy 1.5.3 py39h0fe7a32_0 conda-forge setuptools 65.5.0 py39hecd8cb5_0
six 1.16.0 pyhd3eb1b0_1
sqlite 3.40.0 h880c91c_0
tk 8.6.12 h5d9f67b_0
toolz 0.12.0 py39hecd8cb5_0
tqdm 4.64.1 py39hecd8cb5_0
tzdata 2022f h04d1e81_0
urllib3 1.26.12 py39hecd8cb5_0
wget 1.20.1 h051b688_0
xz 5.2.6 hca72f7f_0
yaml 0.2.5 haf1e3a3_0
zlib 1.2.13 h4dc903c_0

I have a 2.3 GHz 8 core intel Core i9 Thank you Fernando

wasade commented 1 year ago

Puzzling, your install brought a very old version of h5py. If I pin and install "h5py<3.0.0", I'm able to recreate the issue:

(biomtest2) 16:08:28 (dtmcdonald@there):Downloads$ biom
Traceback (most recent call last):
  File "/Users/dtmcdonald/miniconda3/envs/biomtest2/bin/biom", line 7, in <module>
    from biom.cli import cli
  File "/Users/dtmcdonald/miniconda3/envs/biomtest2/lib/python3.9/site-packages/biom/__init__.py", line 51, in <module>
    from .table import Table
  File "/Users/dtmcdonald/miniconda3/envs/biomtest2/lib/python3.9/site-packages/biom/table.py", line 190, in <module>
    from biom.util import (get_biom_format_version_string,
  File "/Users/dtmcdonald/miniconda3/envs/biomtest2/lib/python3.9/site-packages/biom/util.py", line 25, in <module>
    import h5py
  File "/Users/dtmcdonald/miniconda3/envs/biomtest2/lib/python3.9/site-packages/h5py/__init__.py", line 46, in <module>
    from ._conv import register_converters as _register_converters
  File "h5py/_conv.pyx", line 1, in init h5py._conv
  File "h5py/h5t.pyx", line 293, in init h5py.h5t
  File "/Users/dtmcdonald/miniconda3/envs/biomtest2/lib/python3.9/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'typeDict'

Can you try conda install -c conda-forge biom-format "h5py>3.0.0"?

I'll the conda recipe to pin h5py

nano1231 commented 1 year ago

@wasade I reinstall biom-format with the h5py>3.0 version and now it worked, i was able to convert my biom file to tsv without a problem. thank you so much Fernando

wasade commented 1 year ago

That's great!