UC-Davis-molecular-computing / ppsim

Python package for simulating population protocols
MIT License
10 stars 5 forks source link

ppsim no longer works on Google Colab #41

Open EricESeverson opened 1 year ago

EricESeverson commented 1 year ago

At some point in 2022, Google colab made some changes to their packages such that calling

pip install ppsim

in a Colab does not work. You see the following error

Building wheels for collected packages: ppsim Building wheel for ppsim (setup.py) ... done Created wheel for ppsim: filename=ppsim-0.1.6-cp38-cp38-linux_x86_64.whl size=739276 sha256=1dd6984598193cfb077062941f9d519d280dd1e0b7b470db6f4e4f745a6d1fde Stored in directory: /root/.cache/pip/wheels/0f/1a/d2/c09ec1601b6fb7abc32bb0b14c23739f8e2f48539fda065137 Successfully built ppsim Installing collected packages: numpy, jedi, ppsim Attempting uninstall: numpy Found existing installation: numpy 1.21.6 Uninstalling numpy-1.21.6: Successfully uninstalled numpy-1.21.6 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. cmdstanpy 1.1.0 requires numpy>=1.21, but you have numpy 1.20.1 which is incompatible. Successfully installed jedi-0.18.2 numpy-1.20.1 ppsim-0.1.6

Then when you try to import Simulation

from ppsim import Simulation

we see the following error

/usr/local/lib/python3.8/dist-packages/ppsim/simulation.py in 39 from tqdm.auto import tqdm 40 ---> 41 from . import simulator 42 from ppsim.crn import Reaction, reactions_to_dict 43 from ppsim.snapshot import Snapshot, TimeUpdate

ImportError: /usr/local/lib/python3.8/dist-packages/ppsim/simulator.cpython-38-x86_64-linux-gnu.so: undefined symbol: npy_log1pf

I don't know if this is because NumPy isn't working at all, or somehow some of the delicate stuff the cython code is trying to do importing various NumPy C functions directly (which was a thing I somehow got to work, but really never understood what it was doing) has now been broken.

dave-doty commented 1 year ago

Sometimes this stuff can be fixed by freezing versions, e.g., maybe it's some interaction between Colab and the newest version of numpy, such that an older version of numpy would work?