bodono / scs-python

Python interface for SCS
MIT License
41 stars 33 forks source link

pip installs numpy==1.20 with scs, when lower compatible version already exists #28

Closed salvisolamartinell closed 3 years ago

salvisolamartinell commented 3 years ago

The following Dockerfile stopped working at some point (it worked around 3 months ago).

FROM ubuntu:18.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    sudo && \
    apt-get install -y --no-install-recommends python3-dev python3-pip python3-setuptools && \
    pip3 install wheel dill decorator coverage numpy==1.15.4 ipython==7.9.0 \
    scipy==1.3.0 jupyter==1.0.0 scikit-learn==0.19.1 pandas==0.23.1 \
    matplotlib==2.2.3 cvxpy==1.1.5 flake8 codecov parameterized

cvxpy has scs as dependency, and for some reason numpy==1.20 is installed when installing scs, although numpy==1.15.4 is already there. Do you know why? This makes the installation fails as numpy==1.20 is not compatible with Python3.6.

My workaround was using the following modification:

FROM ubuntu:18.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    sudo && \
# Python dependencies
    apt-get install -y --no-install-recommends python3-dev python3-pip python3-setuptools && \
    pip3 install wheel dill decorator coverage numpy==1.15.4 ipython==7.9.0 \
    scipy==1.3.0 jupyter==1.0.0 scikit-learn==0.19.1 pandas==0.23.1 \
    matplotlib==2.2.3 flake8 codecov parameterized && \
# cvxpy dependency
    pip3 install --no-deps scs && \
    pip3 install cvxpy==1.1.5

but I'm afraid I might be losing some scs functionality.

salvisolamartinell commented 3 years ago

I asked if it might be a pip problem at https://github.com/pypa/pip/issues/9443.

bodono commented 3 years ago

In setup.py for SCS I have

      setup_requires=['numpy >= 1.7'],
      install_requires=['numpy >= 1.7', 'scipy >= 0.13.2'],

which only requires numpy 1.7 or greater (and slightly confusingly numpy 1.15 > 1.7) so I don't think that requirement is coming from SCS, more likely CVXPY is bringing it in. I was not aware that numpy 1.20 is not compatible with python 3.6, would the right fix be for cvxpy to change their install requirments on numpy (assuming it is an issue with cvxpy)?

salvisolamartinell commented 3 years ago

This wasn't an issue with scs. The key difference was from:

pip3 install wheel numpy==1.15.4 scipy==1.3.0 cvxpy==1.1.5

(it doesn't work)

to

pip3 install wheel numpy==1.15.4 scipy==1.3.0
pip3 install cvxpy==1.1.5

(it works).

In the 1st case numpy is not yet available when cvxpy is built.

Sorry about my wrong debugging that made me believe it was a scs issue.