-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Installing (or syncing) a project with local file dependency fails in docker #721
Comments
The Docker file I used is very plain
I mounted the project files when running the container However I cannot now reproduce this as it installs
So I can't replicate the original error. I'm bit lost with this. |
It is |
Oh god! That's embarrasing. |
I've got a series of projects in the same parent directory that seem to cause the same problem. Specifically when I'm trying to move up a directory from When I use Instead I've tried
It's not clear to me that this is separate issue, rather than an edge case of this one. I'm happy to create a new issue if that would help. (Edit: I have created a new issue at #1059) Current Setup Version: > pdm --version
Python Development Master (PDM), version 1.14.1 Directory: .
├── local-dependency
│ ├── __init__.py
│ └── pyproject.toml
└── local-dependency-2
├── __init__.py
├── pdm.lock
└── pyproject.toml local-dependency/pyproject.toml: [project]
name = "my_lib"
version = "0.1"
description = ""
authors = [
{name = "Me", email = "[email protected]"},
]
dependencies = []
requires-python = ">=3.9"
dynamic = ["classifiers"]
license = {text = "MIT"}
[project.urls]
homepage = ""
[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api" local-dependency-2/pyproject.toml: [project]
name = "my_lib_2"
version = "0.1"
description = ""
authors = [
{name = "Me", email = "[email protected]"},
]
dependencies = [
"-e file:///${PROJECT_ROOT}/../local-dependency"
]
requires-python = ">=3.9"
dynamic = ["classifiers"]
license = {text = "MIT"}
[project.urls]
homepage = ""
[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api" local-dependency-2/pdm.lock: [[package]]
name = "my-lib"
version = "0.1"
requires_python = ">=3.9"
editable = true
path = "./../local-dependency"
summary = "UNKNOWN"
[metadata]
lock_version = "3.1"
content_hash = "sha256:846ee7de62586775a93ebb56bb357769d9c7f0e955e391656c274c4898200315"
[metadata.files] command: > pdm install -v
~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
Preparing isolated env for PEP 517 build...
Collecting pdm-pep517
Using cached pdm_pep517-0.12.3-py3-none-any.whl (302 kB)
Installing collected packages: pdm-pep517
Successfully installed pdm-pep517-0.12.3
/tmp/pdm-build-env-hvtwo5xe-shared/lib/python3.9/site-packages/pdm/pep517/base.py:394: PDMWarning: `classifiers` no longer supports dynamic filling, please remove it from `dynamic` fields and manually supply all the classifiers
for classifier in meta.classifiers or []:
Traceback (most recent call last):
File "~/mambaforge/envs/simple-uam/bin/pdm", line 10, in <module>
sys.exit(main())
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/core.py", line 233, in main
return Core().main(args)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/core.py", line 168, in main
raise cast(Exception, err).with_traceback(traceback)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/core.py", line 163, in main
f(options.project, options)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/cli/commands/install.py", line 49, in handle
actions.do_sync(
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/cli/actions.py", line 193, in do_sync
candidates = resolve_candidates_from_lockfile(project, requirements)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/cli/actions.py", line 140, in resolve_candidates_from_lockfile
mapping, *_ = resolve(
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/resolver/core.py", line 31, in resolve
result = resolver.resolve(requirements, max_rounds)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/resolvelib/resolvers.py", line 373, in resolve
failure_causes = self._attempt_to_pin_criterion(name)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
criteria = self._get_updated_criteria(candidate)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/resolvelib/resolvers.py", line 203, in _get_updated_criteria
for requirement in self._p.get_dependencies(candidate=candidate):
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/resolver/providers.py", line 172, in get_dependencies
deps, requires_python, _ = self.repository.get_dependencies(candidate)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/models/repositories.py", line 407, in get_dependencies
reqs, python, summary = super().get_dependencies(candidate)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/models/repositories.py", line 70, in get_dependencies
requirements, requires_python, summary = getter(candidate)
File "~/mambaforge/envs/simple-uam/lib/python3.9/site-packages/pdm/models/repositories.py", line 399, in _get_dependencies_from_lockfile
return self.candidate_info[self._identify_candidate(candidate)]
KeyError: ('my-lib', '0.1', 'file:///${PROJECT_ROOT}/../local-dependency', True) Which looks rather identical to #721 barring the use of |
Make sure you run commands with
-v
flag before pasting the output.Steps to reproduce
Running sync (or install) in docker for a project with a local dir referenced with
${PROJECT_ROOT}
failsFor some reason this only seems to happen in docker (or when running a github action, which maybe uses docker).
Example project in
./app
. ├── local-dependency │ ├── __init__.py │ ├── main.py │ └── pyproject.toml ├── pdm.lock └── pyproject.toml
pdm.lock
pyproject.toml
local-dependency/pyproject.toml
Building the project:
I did try this also with non-root user and the result is the same.
Running this fails only in docker. When running the same commands with exactly same files works fine (In windows 10 WSL env).
Environment Information
Some thoughts
I did some digging and found that keys in
self.candidate_info
are (see the last line in stack trace):('my-lib', '0.1', 'file:///app/local-dependency', False)
which then doesn't match the('my-lib', '0.1', 'file:///${PROJECT_ROOT}/local-dependency', False)
The reason could be here:
pdm/pdm/models/requirements.py
Lines 280 to 298 in ba297eb
The
${PROJECT_ROOT}
inself.url
is not resolved to local directory (forself.path
it is)Why this only comes up in docker is beyond me.
The text was updated successfully, but these errors were encountered: