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.

poetry config not working for HTTP auth so unable to pull private package

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name:
debian:10 
root@91ca4e71776b:/# uname -a
Linux 91ca4e71776b 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 GNU/Linux
  • Poetry version:
poetry --version
Poetry version 1.0.3
  • Link of a Gist with the contents of your pyproject.toml file:
  
[tool.poetry]
name = "foo_bar"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "^3.7"
private_package = "^1.0.13"


[tool.poetry.dev-dependencies]



[tool.poetry.scripts]


[[tool.poetry.source]]
name = "foo"
url = "https://foo.bar/simple"
default = true		

[build-system]
requires = ["poetry>=1.0.3"]
build-backend = "poetry.masonry.api"

Issue

$ poetry config repositories. foo https://foo.bar/simple
$ poetry config $USER_ID $USER_PASSWORD
$ poetry add private_package

[ValueError]
Could not find a matching version of package private_package

and I tried with env as well POETRY_HTTP_BASIC_FOO_USERNAME POETRY_HTTP_BASIC_FOO_PASSWORD but not working.

but poetry add private_package working after mounting config & password at ~/.config/pypoetry/auth.toml & ~/.config/pypoetry/config.toml

problem with mounting config is throwing user and password when error occurred while poetry install and I have to add default = true to [[tool.poetry.source]] to my pyproject.toml

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bneijtcommented, Aug 11, 2020

When using a source with basic auth without configuring the credentials correctly, the source is silently seen as empty.

At https://github.com/python-poetry/poetry/blob/dcf30073d24c29b2d53932ba8599ff049f3f2bb8/poetry/repositories/legacy_repository.py#L365

there is only a check for 404. Meanwhile 401 is parsed, no content is found (it’s a you have to log in page) and an empty list is returned, resulting in a lock simply saying there is a solver problem and no valid version is found.

After some trial and error, I was able to get poetry to pick up the basic auth configuration and see dependencies. The main issue here is that there should be a check for 200 and if not, throw an exception.

0reactions
neersightedcommented, Oct 11, 2022

There was an issue with the environment variables not being respected that is long fixed on 1.2.x – please open a new issue if you are setting the variables correctly and run into issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Poetry trying to install everything from private repository
poetry first checks if the project is in your private-pypi and then checks public-pypi . Here the error is mostly because of 403...
Read more >
Repositories | Documentation | Poetry - Python dependency ...
Installing from private package sources​​ Let's do it. First, configure the package source as a secondary package source to your project. Then, assuming...
Read more >
PyPI packages in the Package Registry - GitLab Docs
If you use the same domain name (such as gitlab.example.com ) multiple times with different authentication tokens, pip may not be able to...
Read more >
Using CodeArtifact with Poetry - Chariot Solutions
If you're not familiar with artifact servers, the basic idea is that you publish your company's private libraries to the server, ...
Read more >
Set up authentication to Python package repositories | Artifact ...
On this page · Before you begin · Overview · Authenticating with keyring. Credential search order; Setting up keyring; Keyring authentication with user...
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