Acellera / moleculekit

MoleculeKit: Your favorite molecule manipulation kit
Other
198 stars 37 forks source link

numpy version, infinite loop when calling Molecule #131

Closed duerrsimon closed 11 months ago

duerrsimon commented 11 months ago

Hi,

this is probably a little bit niche but I spent several hours debugging this today and it;s probably something that should be made more robust.

Basically when installing moleculekit with the wrong numpy version one can run into an infinite loop when calling Molecule.

It doesn't work with 1.21.0: https://colab.research.google.com/drive/1WWb7UgpIwQ9aZiR91kNBiJ6DqqHo22SD?usp=sharing It works again with 1.21.6: https://colab.research.google.com/drive/1m4s_4153k0v5DgVgJQ2vqs9r2a-i8_Ok?usp=sharing

In both reproductions one needs to run first the pip install cell, then restart the runtime and then run the two other cells.

There is no error or no indication what is going wrong and why Molecule("6MRR") just runs infinitely with numpy==1.21.0

stefdoerr commented 11 months ago

Works fine on my machine. It's 99.9% a google colab issue so I can't help you with that. Probably it's failing to compile numpy correctly for that version because it uses different gcc compiler because I saw that it gets stuck on a simple np.where().

  mamba create -n test
  mamba activate test
  mamba install python=3.10.12 ipython
  pip install numpy==1.21.0 git+https://github.com/Acellera/moleculekit.git
  ipython
Python 3.10.12 (main, Jul  5 2023, 18:54:27) [GCC 11.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.15.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import numpy as np

In [2]: print(np.__version__)
1.21.0

In [3]: from moleculekit.molecule import Molecule

In [4]: mol = Molecule("3ptb")

In [5]: print(mol)
Molecule with 1701 atoms and 1 frames
Atom field - altloc shape: (1701,)
duerrsimon commented 11 months ago

Thanks for taking a look! This is the standard docker.io/nvidia/cuda:11.8.0-cudnn8-devel-ubuntu22.04 image that colab probably uses under the hood. HuggingFace does too. Just checked the release notes for that version and it seems related to numpy itself: https://numpy.org/devdocs/release/1.21.1-notes.html Nothing to do on your end then :)