Installing chromo: NumPy version>1.21
gaudu opened this issue · 7 comments
After installing chromo using python3 -m pip install --pre --upgrade chromo
, I encountered an error message asking me to use the version of NumPy 1.21 or less in order to call Numba:
gaudu@gaudu-top:~$ chromo -h
Traceback (most recent call last):
File "/home/gaudu/.local/bin/chromo", line 5, in <module>
from chromo.cli import main
File "/home/gaudu/.local/lib/python3.10/site-packages/chromo/__init__.py", line 1, in <module>
from chromo import models
File "/home/gaudu/.local/lib/python3.10/site-packages/chromo/models/__init__.py", line 1, in <module>
from chromo.models.sophia import Sophia20
File "/home/gaudu/.local/lib/python3.10/site-packages/chromo/models/sophia.py", line 2, in <module>
from chromo.common import MCRun, MCEvent, CrossSectionData
File "/home/gaudu/.local/lib/python3.10/site-packages/chromo/common.py", line 12, in <module>
from chromo.util import (
File "/home/gaudu/.local/lib/python3.10/site-packages/chromo/util.py", line 557, in <module>
import numba as nb
File "/usr/lib/python3/dist-packages/numba/__init__.py", line 205, in <module>
_ensure_critical_deps()
File "/usr/lib/python3/dist-packages/numba/__init__.py", line 145, in _ensure_critical_deps
raise ImportError("Numba needs NumPy 1.21 or less")
ImportError: Numba needs NumPy 1.21 or less
In order to go around this, Hans pointed out a solution: create a python environment where one installs chromo again along with the NumPy version 1.21. I can now run chromo in this python environment.
Maybe chromo should be shipped with the NumPy version 1.21 or else?
Hi Chloé,
it seems like the numba version you had installed was not updated for longer time but numpy has been updated.
> import numba as nb
triggers the error and it is in principle unrelated to chromo. Could you try updating numba in your previous environment and check if the problem still persists?
We actually don't require numba for the code to run since it's used for an optional acceleration of one of the routines. So you could also remove numba.
Hello Anatoli,
I remember Hans telling me yesterday that numba isn't a needed package too.
Updating numba requires me to downgrade other packages that I use, like astropy:
gaudu@gaudu-top:~$ pip install --user --upgrade numba
Requirement already satisfied: numba in /usr/lib/python3/dist-packages (0.55.1)
Collecting numba
Downloading numba-0.57.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (3.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.6/3.6 MB 26.1 MB/s eta 0:00:00
Collecting llvmlite<0.41,>=0.40.0dev0
Downloading llvmlite-0.40.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (42.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 42.1/42.1 MB 44.3 MB/s eta 0:00:00
Requirement already satisfied: numpy<1.25,>=1.21 in ./.local/lib/python3.10/site-packages (from numba) (1.23.4)
Installing collected packages: llvmlite, numba
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.
poliastro 0.16.2 requires jplephem, which is not installed.
poliastro 0.16.2 requires astropy<5,>=3.2, but you have astropy 5.0.2 which is incompatible.
Successfully installed llvmlite-0.40.0 numba-0.57.0
I just wanted to raise awareness about it if it happened to others while trying to run chromo. I don't mind using it in its own python environment personally.
I think it is a good idea to remove the numba code. I am personally a big fan of numba, but it adds further complexity to this project, which is already complex. It is more work, but we can replace any numba accelerated code with a compiled extension using C++ and pybind11 to get similar speed ups.
Chloe we installed chromo in a virtual environment on your machine. This means you can install a different numba version inside that environment for chromo without affecting the rest of your installation.
@afedynitch I have to take a closer look, but I think that the rules in our dependencies are misconfigured. The current numba version cannot handle the current numpy version, so for numba to work we have to restrict the numpy version to <=1.23.
@jncots, have a look at this, the numba version is trailing numpy by 0.01. With the next numba release they will likely move to <1.2X or <2. (if 1.26 is the last 1.2x version). Then everything will get back in shape.
Right now there is at least one combination of binaries available with numpy 1.25 and numba 0.58.
Since chromo on PyPI works with numpy >= 1.23, numba >= 0.56.2 should be Ok. The issue could be closed.
Then we close it.