source resolving issue in pyproject.toml
See original GitHub issueSo I have a pyproject.toml
where i’ve defined two different sources for two private repo based dependencies in gitlab like so:
[tool.poetry]
name = "my_service"
version = "0.1.0"
description = ""
authors = [""]
[[tool.poetry.source]]
name = "package_1_source"
url = "https://gitlab.com/api/v4/projects/project_id_1/packages/pypi/simple/"
[[tool.poetry.source]]
name = "package_2_source"
url = "https://gitlab.com/api/v4/projects/project_id_2/packages/pypi/simple"
[tool.poetry.dependencies]
python = "^3.8"
package_1 = "1.0.0"
package_2 = "2.0.0"
And I keep getting the following error:
>>>poetry update
Updating dependencies
Resolving dependencies... (0.4s)
[SolverProblemError]
Because my_service depends on package_1 (1.0.0) which doesn't match any versions, version solving failed.
I’ve also tried explicitly pointing dependencies to their relevant sources.
[tool.poetry.dependencies]
package_1 = {version="1.0.0", source="package_1_source"}
package_2 = {version="2.0.0", source="package_2_source"}
I’ve properly set the http token in the poetry config using poetry config http-basic.gitlab __token__ <my_gitlab_token>
,
and when using only one source there doesn’t seem to be an issue.
Also, when changing the order of source
declaration the missing dependencies flip, which makes me assume that source
is being somehow overridden by the second declaration instead of being updated with both 😞
Another curious behavior is that even with one dependency and one source, poetry insisted that the source name and URL had some correlation (like sharing the repo name? I’m not sure but here is an example): this works:
[[tool.poetry.source]]
name = "gitlab"
url = "https://gitlab.com/api/v4/projects/project_id/packages/pypi/simple/"
but this doesn’t: (even when I specifically point to It from the dependency section)
[[tool.poetry.source]]
name = "any_other_name"
url = "https://gitlab.com/api/v4/projects/project_id/packages/pypi/simple/"
I’m running the latest poetry 1.0.10
on a mac Catalina-os version 10.15.3
I’ve gone over the following issue and documentation but couldn’t find a solution for this: https://python-poetry.org/docs/repositories/#install-dependencies-from-a-private-repository https://github.com/python-poetry/poetry/issues/14 https://github.com/python-poetry/poetry/issues/1547
Any help will be much appreciated BTW, this is used for local and CI and both fail in the same manner so far…
Thank you!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
So looks like I’ve missed something a bit silly 😅 when authenticating using
poetry config http-basic.gitlab __token__ <my_gitlab_token>
i didn’t noticegitlab
is the source name and not the provider or something… so I should have donepoetry config http-basic.<source_name> __token__ <my_gitlab_token>
for each of my sources. After doing so it seems to work fine 😃 Sorry for the false alarm, hope this will help anyone else encountering this… I’ll be closing this issue for now. Thanks for the help!@avivex1000 even if you can setup the scenario on 2 sample public packages that would help. I just do not have the time right now to try reproduce the issue so I can debug it.
Note that there are couple of issues in the issue tracker where authentication fails silently. This might be cause of your CI error (ie. credentials not available).
If I were to guess, the relevant code for this might be in https://github.com/python-poetry/poetry/tree/master/poetry/repositories. Particularly, with regards to how packages are searched for in a pool or even how the repository pools are created (ie. discovering source configurations from pyproject.toml). You are welcome to try debug the issue and post any insights.
Feel free to join our discord server too, might be easier debug issues there than over github issue comments. 😃