question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

source resolving issue in pyproject.toml

See original GitHub issue

So 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:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
avivex1000commented, Aug 31, 2020

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 notice gitlab is the source name and not the provider or something… so I should have done poetry 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!

1reaction
abncommented, Aug 27, 2020

@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. 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

The pyproject.toml file | Documentation | Poetry
If your pyproject.toml file still references poetry directly as a build backend, you should update it to reference poetry-core instead.
Read more >
Python3 Subprocess Exited with Error (pyproject.toml)
I've looked up online from many sites have a similar error, which seems to suggest that the root of the error is likely...
Read more >
PEP 517 – A build-system independent format for source trees
Here we define a new style of source tree based around the pyproject.toml file defined in PEP 518, extending the [build-system] table in ......
Read more >
Search - pip documentation v22.3.1
Modern Python packages can contain a pyproject.toml file, first introduced ... when no-binary is enabled for source distributions without 'pyproject.toml .
Read more >
How to Publish an Open-Source Python Package to PyPI
The source code of the package is in an src/ subdirectory together ... Each Python project should use a file named pyproject.toml to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found