Jerry101
Jerry101

Reputation: 13367

Installing NumPy + SciPy in Python 2.7 now fails with "RuntimeError: Python version >= 3.5 required"

Installing numpy and scipy from source like this (say, in a fresh Python 2.7 pyenv virtualenv):

pip install numpy==1.14.6 scipy==1.0.1 --no-binary numpy,scipy

gets their installers to use a ~/.numpy-site.cfg file that points to my openblas installation.

This used to work. Now it produces a long stack trace ending with:

      File "/usr/local/var/pyenv/versions/2.7.16/envs/issue/lib/python2.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
        exec(code, globals, locals)
      File "/var/folders/_b/q30qg_l50b5gvqd8y4_wb9h00000gn/T/easy_install-o9MJ5E/numpy-1.17.1/setup.py", line 31, in <module>
        if sys.version_info[0] < 3:
    RuntimeError: Python version >= 3.5 required.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Q. What changed?
Q. Why does it say Python version >= 3.5 required. in a Python 2.7 installation?
Q. How to fix it?

Upvotes: 1

Views: 10566

Answers (2)

Khan
Khan

Reputation: 1498

I also encountered an issue where scipy was been installed through a script and it was trying to install a version 1.7.1 which required python 3.7 at least and i hand 3.6. The workaround was i installed scipy myself and the version i got was 1.5.4.

Upvotes: 0

Jerry101
Jerry101

Reputation: 13367

The scipy 1.0.1 installer requires numpy as a prerequisite, but the multiple installers working together end up getting the latest version of numpy unless numpy is already present.

What changed: The latest version of numpy requires Python 3.5+, hence the error message.

So even though the pip command explicitly asked to install numpy==1.14.6 scipy==1.0.1, it triggers a newer numpy installer that fails on Python 2. (The last entry in the stack trace shows numpy-1.17.1 requiring Python 3.)

The problem arises in the interaction between pip, the scipy and numpy installers, and easy_install. Details in pip issue #6945.

Workaround: Install numpy first. Then install scipy. Alternatively, the one-line install might work if you don't need the --no-binary option.

Upvotes: 3

Related Questions