docker-robot-framework icon indicating copy to clipboard operation
docker-robot-framework copied to clipboard

How to install numpy / pandas

Open DrVanScott opened this issue 3 years ago • 6 comments

Hi,

can you please give some advise how to use your image and in addition also install numpy / pandas?

BTW, i 've read lots of statements saying that alpine is not the best choice for python based applications, e.g. because auf alpine's musl which is not supported by "standard wheel"...

DrVanScott avatar Dec 08 '20 13:12 DrVanScott

I am not sure the use case of running numpy and pandas in a docker container used for running tests, but regardless you can just use this image as a base and do a pip install. Something like

RUN pip3 install \
    --no-cache-dir \
    numpy \
    pandas \

I agree that alpine may not be best for heavily C based python packages but the intention is not to do a lot of non-testing C work in this docker image so i think the size advantage helps tests run faster.

UltimateDogg avatar Dec 08 '20 15:12 UltimateDogg

We use robotframework-datadriver[XLS] and this in turn has dependencies to these packages...

Unfortunately your idea does not work, even if i previously again install all those dependencies which are temporarily available when building your image. (gcc, make ...):

...
Successfully built numpy
Failed to build pandas
ERROR: Could not build wheels for pandas which use PEP 517 and cannot be installed directly

DrVanScott avatar Dec 08 '20 19:12 DrVanScott

would need something like this:

RUN apk update \
  && apk --no-cache --virtual .build-deps add \
    gcc \
    libffi-dev \
    linux-headers \
    make \
    musl-dev \
    openssl-dev \
    which \
    wget \
# Install Robot Framework and Selenium Library
  && pip3 install \
    --no-cache-dir \
    numpy \
    pandas \
  && apk del --no-cache --update-cache .build-deps

UltimateDogg avatar Dec 08 '20 20:12 UltimateDogg

Hi thanks for your reply. Maybe i was a bit unclear, but your last suggestion was exactly what i have done and which still fails with the error message i posted in my previous comment.

But now i found that it was package "g++" which is additionally missing. Thanks for helping

DrVanScott avatar Dec 09 '20 08:12 DrVanScott

Sure glad it worked, if you dont mind can you paste waht you did? It might be worth adding data driven test cases ability to the main image

UltimateDogg avatar Dec 09 '20 12:12 UltimateDogg

Sure ;-) Both following builds take aprox. 20 minutes each

For numpy/pandas only:

FROM ppodgorsek/robot-framework:latest

USER root

## # Install system dependencies
RUN apk update \
  && apk --no-cache --virtual .build-deps add \
    gcc \
    g++ \
    libffi-dev \
    linux-headers \
    make \
    musl-dev \
    openssl-dev \
    which \
    wget \
    && \
# Install Robot Framework and Selenium Library
  pip3 install \
    --no-cache-dir \
    numpy \
    pandas \
  && apk del --no-cache --update-cache .build-deps

USER ${ROBOT_UID}:${ROBOT_GID}

for robotframework-datadriver[XLS] (and numpy/pandas via dependencies)

FROM ppodgorsek/robot-framework:latest

USER root

## # Install system dependencies
RUN apk update \
  && apk --no-cache --virtual .build-deps add \
    gcc \
    g++ \
    libffi-dev \
    linux-headers \
    make \
    musl-dev \
    openssl-dev \
    which \
    wget \
    && \
# Install Robot Framework and Selenium Library
  pip3 install \
    --no-cache-dir \
    robotframework-datadriver[XLS] \
  && apk del --no-cache --update-cache .build-deps

USER ${ROBOT_UID}:${ROBOT_GID}

DrVanScott avatar Dec 10 '20 11:12 DrVanScott