Pin max numpy version in `setup.py`
See original GitHub issueFeature request
As of 6/22/22, numpy v1.23 has released. It is possible to install numpy v1.23 alongside numba, though when importing numba, the following error is thrown:
File "/home/divya/external_dependencies/miniconda3/envs/truera-c492f339dfe9d66881580e3ea4cc559e6dae9d7e/lib/python3.9/site-packages/numba/__init__.py", line 140, in _ensure_critical_deps
raise ImportError("Numba needs NumPy 1.22 or less")
Can we specify a max numpy version in install_requires
of numba’s setup.py
file? This way if numba
is specified in a package list, it will force an installation of numpy that is compatible with numba.
Obviously long term is it best to make sure numba is compatible with the latest numpy, but it would be great to pin a max numpy version during install rather than throwing an error at runtime.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How to pip install a package with min and max version range?
You can do: $ pip install "package>=0.2,<0.3". And pip will look for the best match, assuming the version is at least 0.2, and...
Read more >A Practical Guide to Using Setup.py - GoDataDriven
Now you can simply run python setup.py flake8 . Of course you can also pin the version of flake8 (or any other package)...
Read more >Installing NumPy
NumPy can be installed with conda , with pip , with a package manager on macOS and Linux, or from source. For more...
Read more >Should You Use Upper Bound Version Constraints?
Pinning the Python version is special. Anther practice pushed by Poetry is adding an upper cap to the Python version. This is misusing...
Read more >Dependencies Management in Setuptools
For example, the enum package was added in Python 3.4, therefore, package that depends on it can elect to install it only when...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@divya-gopinath thank you for asking about this. In general we tend to pin NumPy on release branches only. Looking at the most recent release branch
release_0.55
, it seems like this is already setup viainstall_requires
(?):https://github.com/numba/numba/blob/release0.55/setup.py#L361 https://github.com/numba/numba/blob/release0.55/setup.py#L403
So, I am not sure how you ended up in that situation, but the runtime checks are in there in case something does go wrong during installation.
How did you install NumPy and Numba?
Although, perhaps I should add, that if you use the advertised
pip install numba
it will match an appropriate NumPy version, (I presume this isinstall_requires
working):