Mithril
Mithril

Reputation: 13808

pip can not install local package in docker

My Dockerfile is

FROM python:2

COPY . /mnt

WORKDIR /mnt

RUN ls -al
RUN pip install basin-textminner/
RUN pip install -r annotator-server/requirements.txt

ENV PYTHONUNBUFFERED 0

ENV HOST '0.0.0.0'
ENV PORT 5000

CMD python run.py

Got error when install local package basin-textminner.

$ docker build -t bidspy .
Sending build context to Docker daemon 101.9 MB
Step 1 : FROM python:2
 ---> b1d5c2d7dda8
Step 2 : COPY . /mnt
 ---> 1851c99510ee
Removing intermediate container 594c781c3507
Step 3 : WORKDIR /mnt
 ---> Running in 9161f7117b9a
 ---> b8c75182024a
Removing intermediate container 9161f7117b9a
Step 4 : RUN ls -al
 ---> Running in af67f3610cd7
total 20
drwxr-xr-x  4 root root   84 Oct 25 00:42 .
drwxr-xr-x 21 root root 4096 Oct 25 00:43 ..
-rwxr--r--  1 root root  266 Oct 25 00:42 Dockerfile
-rw-r--r--  1 root root  453 Oct 24 06:03 README.md
drwxr-xr-x  5 root root 4096 Oct 24 06:35 annotator-server
drwxr-xr-x  9 root root 4096 Oct 24 06:03 basin-textminer
 ---> b2282c1be790
Removing intermediate container af67f3610cd7
Step 5 : RUN pip install basin-textminner/
 ---> Running in 1ef7fe341dc8
Invalid requirement: 'basin-textminner/'
It looks like a path. Does it exist ?
The command '/bin/sh -c pip install basin-textminner/' returned a non-zero code: 1

pip install xxxx/ is correct, only can not work on docker build.

I saw a problem with pip install -e Pip install -e packages don't appear in Docker .Have tried to move WORKDIR to later , neither work.

My test:

WORKDIR /mnt
RUN ls -al                              # work
RUN ls -al basin-textminner/            # error 
RUN ls -al ./basin-textminner           # error
RUN ls -al /mnt/basin-textminner        # error

-----
RUN ls -al /mnt/basin-textminner        # error
WORKDIR /mnt

Upvotes: 0

Views: 4158

Answers (1)

Srgrn
Srgrn

Reputation: 1825

according to your log and dockerfile you have a typo

RUN pip install basin-textminner/

ls output 
drwxr-xr-x  9 root root 4096 Oct 24 06:03 basin-textminer

so it should be

RUN pip install basin-textminer/

or the folder should be renamed to basin-textminner

Upvotes: 1

Related Questions