2

I am trying to use the method described here

Dockerfile

FROM python:3.8

COPY requirements.txt setup.py /tmp/
RUN pip3 install -r /tmp/requirements.txt \
    && rm /tmp/*

this fails with:

Step 1/7 : FROM python:3.8
 ---> 79cc46abd78d
Step 2/7 : COPY requirements.txt setup.py /tmp/
 ---> Using cache
 ---> a50a0a8ecb06
Step 3/7 : RUN pip3 install -r /tmp/requirements.txt     && rm /tmp/*
 ---> Running in c7d29bd8f23c
ERROR: Directory '.' is not installable. Neither 'setup.py' nor 'pyproject.toml'
 found.

I also tried commenting out the RUN command, entering the container and running pip3 install -r /tmp/requirements.txt manually. This worked without error.

I have no idea what might be the issue here.

1 Answer 1

1

I figured it out:

the dot . is not relative to the requirements.txt but rather to the current working directory. The reason it worked when I did it manually is, that I also mounted my workspace into a devcontainer and had my working directory in this workspace which also contained the setup.py

The solution is thus to do something like this:

WORKDIR /tmp
COPY requirements.txt setup.py ./
RUN pip3 install -r requirements.txt \
    && rm /tmp/*
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.