bjing2016/alphaflow

predict.py does not run AttributeError: module 'numpy' has no attribute 'object'.

labeln opened this issue · 0 comments

I built the docker file from commit 2c27c69. When running predict.py the following stack trace is generated,

root@3f4467776483:/opt/alphaflow# /opt/conda/bin/python -V
Python 3.9.7

root@3f4467776483:/opt/alphaflow# /opt/conda/bin/python /opt/alphaflow/predict.py 

/opt/conda/lib/python3.9/site-packages/openfold-1.0.1-py3.9-linux-x86_64.egg/openfold/data/templates.py:88: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  "template_domain_names": np.object,
Traceback (most recent call last):
  File "/opt/alphaflow/predict.py", line 29, in <module>
    from alphaflow.data.data_modules import collate_fn
  File "/opt/alphaflow/alphaflow/data/data_modules.py", line 32, in <module>
    from alphaflow.data import data_pipeline, feature_pipeline
  File "/opt/alphaflow/alphaflow/data/data_pipeline.py", line 22, in <module>
    from openfold.data import templates, parsers, mmcif_parsing
  File "/opt/conda/lib/python3.9/site-packages/openfold-1.0.1-py3.9-linux-x86_64.egg/openfold/data/templates.py", line 88, in <module>
    "template_domain_names": np.object,
  File "/opt/conda/lib/python3.9/site-packages/numpy/__init__.py", line 324, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. 
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 note that when the container is built that numpy 1.21.2 is first installed, and later, uninstalled when mdtraj is built, leaving 1.26 instead.

 Stored in directory: /root/.cache/pip/wheels/4f/17/89/f855cce8e6394e9029e1b972cb623c8813b706d3d1ca81832f
Successfully built mdtraj
Installing collected packages: fair-esm, typing-extensions, pyparsing, numpy, astunparse, scipy, mdtraj, pytorch_lightning
  Attempting uninstall: typing-extensions
    Found existing installation: typing-extensions 3.10.0.2
    Uninstalling typing-extensions-3.10.0.2:
      Successfully uninstalled typing-extensions-3.10.0.2
  Attempting uninstall: numpy
    Found existing installation: numpy 1.21.2
    **Uninstalling numpy-1.21.2:
      Successfully uninstalled numpy-1.21.2**
  Attempting uninstall: scipy
    Found existing installation: scipy 1.7.3
    Uninstalling scipy-1.7.3:
      Successfully uninstalled scipy-1.7.3
  Attempting uninstall: pytorch_lightning
    Found existing installation: pytorch-lightning 1.5.10
    Uninstalling pytorch-lightning-1.5.10:
      Successfully uninstalled pytorch-lightning-1.5.10
Successfully installed astunparse-1.6.3 fair-esm-2.0.0 mdtraj-1.10.0 **numpy-1.26.4** pyparsing-3.1.2 pytorch_lightning-2.0.4 scipy-1.13.1 typing-extensions-4.12.2

I am going to try pinning numpy 1.21.2 through out the pip installations, please advise if there is a better/different route.