Ashwin
Ashwin

Reputation: 247

docker build error the folder you are executing pip from can no longer be found

I'm making a Dockerfile to install python38 on centos7 base. Everything works file until pip3 command. Dockerile looks like this.

FROM centos:centos7

RUN RPM_LIST=" \
      gcc \
      make \
      openssl-devel \
      bzip2-devel \
      libffi-devel" && \
    yum install -y $RPM_LIST && \
    curl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz && \
    tar xvf Python-3.8.2.tgz && \
    cd Python-3.8.2  && \
    ./configure && \
    make && \
    make install && \
    rm -rf /Python-3.8.2* && \
    yum remove -y $RPM_LIST && \
    pip3 install retrying

Error is The folder you are executing pip from can no longer be found..

I changed the last line to RUN pip3 install retrying and it started working, but it added an additional 300 MB to my image, which i can't effort.

Any suggestions, what am i missing here or any alternative ways ?

Upvotes: 0

Views: 1611

Answers (2)

warrens
warrens

Reputation: 2135

I just ran into The folder you are executing pip from can no longer be found.

My Dockerfile has not changed in months. It does not install pip.

It does force remove and make a folder just prior to running a pip install on a requirements file -- into which pip is supposed to install things.

The fix? I simply ran it again and it worked. Hmm...

So I am posting this here in case there is some mysterious timing issue about which folks wish to collect clues.

--- edit add --

Also, yesterday I ran into this docker issue, which required turning off docker's experimental gRPC feature in its preferences. Perhaps it could be related somehow?

Why does Serverless produce an Invalid Cross-device link Error when trying to package or deploy?

Upvotes: 0

Ashwin
Ashwin

Reputation: 247

This is how the working Dockerfile looks like

FROM centos:centos7

RUN RPM_LIST=" \
      gcc \
      make \
      openssl-devel \
      bzip2-devel \
      libffi-devel" && \
    yum install -y $RPM_LIST && \
    curl -O https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz && \
    tar xvf Python-3.8.2.tgz && \
    cd Python-3.8.2  && \
    ./configure && \
    make && \
    make install && \
    pip3 install retrying && \
    yum remove -y $RPM_LIST && \
    rm -rf /Python-3.8.2*

for some reason, calling pip3 command from Python-3.8.2 folder was not working. Here i moved the rm command after the pip3 call. Hope this information helps someone.

Upvotes: 1

Related Questions