sweez
sweez

Reputation: 77

Alpine Docker image with pandas installed on Pipenv

We need an alpine based docker image that can have pandas package within pipenv

This works.

FROM python:3-alpine 
RUN apk add g++  && \ 
    pip install numpy

But, our process needs the install on pipenv and below fails with error pipenv not found

FROM python:3-alpine
RUN apk add g++  && \ 
    pipenv install numpy

Note pipenv is installed in earlier docker statements. However, even the below fails, with pipenv not found

FROM python:3-alpine
RUN apk add g++  && \ 
    pip install --user pipenv && \
    pipenv install numpy

Any suggestions?

Upvotes: 0

Views: 680

Answers (1)

Ed Brook
Ed Brook

Reputation: 328

pipenv isn't available because pip install --user pipenv installs it in /root/.local/bin, which isn't listed in the search path ($PATH). The easiest way to fix it would be to install pipenv without the --user flag. It will then be installed in /usr/local/bin/:

FROM python:3-alpine
RUN apk add g++ && \
    pip install pipenv && \                                                     
    pipenv install numpy

If you run through the build steps manually, it gives you a warning about this:

  • docker run --rm -ti python:3-alpine /bin/sh
  • apk add g++
  • pip install --user pipenv this shows the warning below:

WARNING: The scripts pipenv and pipenv-resolver are installed in '/root/.local/bin' which is not on PATH.

Upvotes: 3

Related Questions