question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pin max numpy version in `setup.py`

See original GitHub issue

Feature 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:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
esccommented, Jun 23, 2022

@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 via install_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?

1reaction
esccommented, Jun 23, 2022

Although, perhaps I should add, that if you use the advertised pip install numba it will match an appropriate NumPy version, (I presume this is install_requires working):

 💣 zsh» pip install numba
Collecting numba
  Using cached numba-0.55.2-cp310-cp310-macosx_10_14_x86_64.whl (2.3 MB)
Collecting numpy<1.23,>=1.18
  Using cached numpy-1.22.4-cp310-cp310-macosx_10_15_x86_64.whl (17.7 MB)
Collecting llvmlite<0.39,>=0.38.0rc1
  Using cached llvmlite-0.38.1-cp310-cp310-macosx_10_9_x86_64.whl (25.5 MB)
Requirement already satisfied: setuptools in ./miniconda3/envs/issue_8188/lib/python3.10/site-packages (from numba) (61.2.0)
Installing collected packages: numpy, llvmlite, numba
Successfully installed llvmlite-0.38.1 numba-0.55.2 numpy-1.22.4
pip install numba  5.95s user 1.33s system 91% cpu 7.963 total
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found