Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in requirements.lock -e file:. prevents pip install from resolve dependensies without pyproject.toml #1096

Closed
Kanahiro opened this issue May 20, 2024 · 4 comments

Comments

@Kanahiro
Copy link

Kanahiro commented May 20, 2024

Steps to Reproduce

Follow this step.
https://github.com/astral-sh/rye/blob/main/docs/guide/docker.md#container-from-source

  1. build project
  2. write Dockerfile follow above instruction.
  3. docker build . -t imagename
  4. error occurs.

The error seems to be caused by line -e file:. in requirements.lock.
Is it possible to disable to write this line? or other workaround?

Expected Result

  • It is better for pip to work.

Actual Result

error occurs.

 > [4/5] RUN pip install -r requirements.lock:           
0.973 Obtaining file:///. (from -r requirements.lock (line 10))                                                   
0.974 ERROR: file:///. (from -r requirements.lock (line 10)) does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

once the line -e file:e is removed, build steps work well.

Version Info

rye 0.33.0
commit: 0.33.0 (58523f6 2024-04-24)
platform: macos (aarch64)
self-python: cpython@3.12.3
symlink support: t

Stacktrace

No response

@zanieb
Copy link
Member

zanieb commented May 20, 2024

See also discussion at astral-sh/uv#3180

@charliermarsh
Copy link
Member

Those instructions are specifically for a virtual project. Did you set virtual = true in the pyproject.toml as described?

@charliermarsh
Copy link
Member

charliermarsh commented May 20, 2024

If you want to build including the current project, you have to change the Dockerfile to something like:

FROM python:slim

WORKDIR /app
COPY requirements.lock ./
COPY pyproject.toml ./
COPY README.md ./
RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -r requirements.lock

COPY src .
CMD python main.py

But the steps in the docs are correct as-is. You can't include the current project (-e file:///.) as a dependency if you don't copy in the current project.

@Kanahiro
Copy link
Author

Thank you for kind responses!

#1096 (comment)
this works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants