skip to Main Content

I’m just trying to create a docker image from this Dockerfile.

FROM debian:latest

USER root

ENV DEBIAN_FRONTEND noninteractive
ENV PATH /twecoll:$PATH

RUN apt-get update
RUN apt-get install -y build-essential libxml2-dev zlib1g-dev python-dev python-pip pkg-config libffi-dev libcairo-dev git
RUN pip install python-igraph
RUN pip install --upgrade cffi
RUN pip install cairocffi

RUN git clone https://github.com/jdevoo/twecoll.git
ADD .twecoll /root

WORKDIR /app
VOLUME /app

ENTRYPOINT ["twecoll"]
CMD ["-v"]

but when running RUN pip install python-igraph, an error appears like this.

Error Message:
Error Message

Any idea why?

2

Answers


  1. Try as the documentation suggests.

    pip install git+https://github.com/igraph/python-igraph
    

    or

    pip install –no-binary ‘:all:’ python-igraph
    
    Login or Signup to reply.
  2. When you’re installing python-igraph from pip and it can’t find a precompiled wheel for your distribution (which it mostly doesn’t), pip will try to compile the igraph binaries for your image, which 1) is error-prone, 2) takes a long time, 3) is the reason you need to install so many build tools and libraries. A better approach is to install igraph from the Debian repositories with apt-get install python-igraph first, which will install all the necessary requirements including a compiled igraph.

    This leaves the following Dockerfile:

    FROM debian:latest
    
    USER root
    
    ENV DEBIAN_FRONTEND noninteractive
    ENV PATH /twecoll:$PATH
    
    RUN apt-get update
    RUN apt-get install -y python-dev python-pip libffi-dev libcairo-dev git python-igraph
    RUN pip install python-igraph
    RUN pip install --upgrade cffi
    RUN pip install cairocffi
    
    RUN git clone https://github.com/jdevoo/twecoll.git
    ADD .twecoll /root
    
    WORKDIR /app
    VOLUME /app
    
    ENTRYPOINT ["twecoll"]
    CMD ["-v"]
    

    As you can see I’m just installing python-igraph, no more build tools! You may even be able to do something similar for cairo and ffi but I’m leaving that for you.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search