openghg / openghg_inversions

University of Bristol Atmospheric Chemistry Research Group RHIME Inversion code (with openghg dependency)
MIT License
5 stars 0 forks source link

Installation failing related to pymc: workaround #30

Open lukewestern opened 5 months ago

lukewestern commented 5 months ago

When running pip install -e openghg_inversions I ran into an installation issue related to pymc.

My workaround was to install pymc when creating the new environment (note I used conda rather than a virtual environment here), and ensuring that numpy was version 1.25.2 (the latest numpy version causes conflicts, this happens at runtime): conda create -c conda-forge -n openghg_inv "pymc>5" "numpy=1.25.2" pip install --upgrade pip setuptools wheel pip install -e openghg_inversions

brendan-m-murphy commented 5 months ago

This was an issue for about a month, but you should be able to use numpy 1.26 with the latest version of pytensor and pymc: https://github.com/pymc-devs/pytensor/issues/441#event-10911975208. Maybe check to make sure you have the latest version of pytensor? (Although I don't see why you wouldn't get it from pymc...)

For reference, these are some of the packages in a python venv I created recently:

Package Version

jax 0.4.21 jaxlib 0.4.21 numpy 1.26.2 numpyro 0.13.2 openghg 0.6.2+204.ged8115f8 openghg-defs 0.0.2 openghg-inversions 0.0.2
opt-einsum 3.3.0 packaging 23.2 pandas 1.5.3 pymc 5.10.1 pytensor 2.18.3 scipy 1.11.4 setuptools 69.0.2 wheel 0.42.0 xarray 2023.12.0 xarray-einstats 0.6.0

One possible difference from what you did was that I did:

pip install -U pip wheel setuptools
python -m pip install numpy

before installing other requirements, because it seems like pip install numpy doesn't link the openblas libraries shipped with numpy for some reason. (The other way around this is to use conda to install numpy, as you did.)

Also, I don't know what the pytensor fix was, so maybe they just avoided the meson build of numpy, which was what caused numpy 1.26 to fail with older versions of pytensor (although I'm not sure if there is an alternative to the meson build for numpy 1.26).

joe-pitt commented 4 months ago

Not sure if this is related, but I also got an error related to pymc when running pip install -e openghg_inversions

AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

It was resolved by rolling back from python 3.12 to python 3.11 (as described here: https://stackoverflow.com/questions/77364550/attributeerror-module-pkgutil-has-no-attribute-impimporter-did-you-mean)

brendan-m-murphy commented 4 months ago

I don't think openghg supports python 3.12 yet (I could be wrong). I suppose this should be in the install instructions, if that's the case.