coin-or / CyLP

A Python interface to CLP, CBC, and CGL to solve LPs and MIPs.
Other
182 stars 68 forks source link

Failed installing cylp using docker #165

Closed rguarnotta closed 2 years ago

rguarnotta commented 2 years ago

Hello.

I am trying to build a containerized service that relies on cbc / cvxpy / cylp. Unfortunately, I haven't been able to install to create an image that depends on these dependencies, the cylp install is failing. I have tried installing cylp from source as well as with pip, both ways lead to the same error.

Here is a simplified version of my DockerFile that focuses on the cylp installation.

FROM ubuntu

RUN apt-get update
RUN apt-get install -yqq git gcc g++ pkg-config libblas-dev liblapack-dev 
RUN apt-get install -yqq python3 python3-pip
RUN apt-get install -yqq coinor-cbc
ENV COIN_INSTALL_DIR /usr/

# Installing from pip.
RUN pip3 install cylp

# Installing from source.
# RUN git clone https://github.com/coin-or/CyLP
# WORKDIR CyLP
# RUN pip3 install .     <= same error installing from source

The error that I get is the following

#9 13.82       aarch64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/coin -I./cylp/cpp -I./cylp/cy -I/tmp/pip-build-env-uq769gc8/overlay/local/lib/python3.10/dist-packages/numpy/core/include -I. -I/usr/include/coin -I/usr/include/python3.10 -c cylp/cpp/IClpPrimalColumnPivotBase.cpp -o build/temp.linux-aarch64-3.10/cylp/cpp/IClpPrimalColumnPivotBase.o -w -std=c++11
#9 13.82       In file included from cylp/cpp/IClpPrimalColumnPivotBase.cpp:1:
#9 13.82       cylp/cpp/IClpPrimalColumnPivotBase.h:5:10: fatal error: ClpPrimalColumnPivot.hpp: No such file or directory
#9 13.82           5 | #include "ClpPrimalColumnPivot.hpp"
#9 13.82             |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
#9 13.82       compilation terminated.
#9 13.82       error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
#9 13.82       [end of output]
#9 13.82
#9 13.82   note: This error originates from a subprocess, and is likely not a problem with pip.
#9 13.82   ERROR: Failed building wheel for cylp
#9 13.82 Failed to build cylp
#9 13.82 ERROR: Could not build wheels for cylp, which is required to install pyproject.toml-based projects

Anyone with the same issue?

tkralphs commented 2 years ago

You need

sudo apt-get install  coinor-cbc coinor-libcbc-dev

in order to get the headers as well, if you are going to build from source (see the README of Cbc). Alternatively, you could just build Cbc also from source, which is easy and allows you to get the latest release. There is a docker file for building CyLP and Cbc from source here:

https://github.com/coin-or-tools/cylp-docker/blob/master/image/Dockerfile

rguarnotta commented 2 years ago

Perfect. It worked, thank you!