Authentication for Private PyPi server fails
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: Linux 5.13.0-22-generic -Ubuntu SMP x86_64 GNU/Linux
- Poetry version: 1.1.12
- Link of a Gist with the contents of your pyproject.toml file: Gist Link Here
Issue
Hey everyone, I have an issue that I believe was described on this ticket, but the ticket was closed without a clear solution for the problem: https://github.com/python-poetry/poetry/issues/3216
Basically, under Linux, my dependencies are not installed, as Poetry cant authenticate to my private pypi server. The issue seems related to the keyring lib in Linux. It seems Poetry cant find the credentials, even so that the credentials were configured as specified by the docs:
poetry config http-basic.pypi-switch ${USER} ${PASS}
The error issued was the following:
sing virtualenv: /home/andre/.virtualenvs/switch_slac
Updating dependencies
Resolving dependencies...
[stack_trace_poetry.txt](https://github.com/python-poetry/poetry/files/7727076/stack_trace_poetry.txt)
RepositoryError
403 Client Error: Forbidden for url: https://Redacted.com/simple/flake8/
at ~/.local/lib/python3.9/site-packages/poetry/repositories/legacy_repository.py:393 in _get
389│ if response.status_code == 404:
390│ return
391│ response.raise_for_status()
392│ except requests.HTTPError as e:
→ 393│ raise RepositoryError(e)
394│
395│ if response.status_code in (401, 403):
396│ self._log(
397│ "Authorization error accessing {url}".format(url=response.url),
I have also annexed the stack trace.
The solutions I found were the following:
-
Remove the keyring settings or disable them as specified here: https://blog.frank-mich.com/python-poetry-1-0-0-private-repo-issue-fix/
-
Pass directly the credentials to the pypi server link in the .toml like:
[[tool.poetry.source]]
name = "pypi-switch"
url = "https://username@password:Redacted.com/simple/"
default = false
secondary = true
Also it is worth to mention that I didnt experience this error under MacOS or a Docker python:3.10.0-buster (Debian) container environment.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:5 (1 by maintainers)
SOLVED
I forgot to add
/simple
to the end of the url. It is correctly mentioned in the official docs, but it is part ofhttps://foo.bar/simple
string. And since it starts with “foo”, I didn’t finish reading the line.So, the remedy to my problem was finish gitlab’s repository url with
/simple
in thepyproject.toml
:Hello folks, I experience similar issue. I configured my gitlab repo with:
After that, I am able to successfully publish packages to there with:
But I cannot figure out, how to install a package from this private repository. I added this section to project’s
pyproject.toml
:I also tried adding
secondary = true
anddefault = true
, but it just does not work. I always get error:I tried everything in pure install as well (vanilla Fedora installation in virtual machine) - no fancy tools like
pyenv
, just pure python install and pure poetry install and still the same error. I also tried providing both - personal access token and deploy token for gitlab. As I already mentioned - I am able to publish packages, so nothing should be wrong with auth.Also, worth mentioning, I tried these variants for auth setting with
poetry http-basic.gitlab <username> <password>
:All this variants do work for publishing, but none of them works for install it from that repo.
For testing installing from private repo, I don’t have any other dependency in the project. I created new dummy project with
poetry new <project>
, I edited thepyproject.toml
and tried to add my private dependency (a minute ago successfully published) and it fails.Am I doing something wrong? Any advises, please? Thanks
I’ve been unable to get the private repositories working when trying to specify the credentials in the URL with the latest versions(s) of poetry (
1.1.12
and1.2.0a2
)…My
pyproject.toml
file containsBut when trying to install the package, it fails with the following error (output cleaned up a bit)
Some things I noticed
Command[]
block, it has--index-url
with the credentials shown twice at the beginning of the URLcurl
with the credentials works fine.This issue, and #4900 and #3802, are completely blocking me from using Poetry to manage dependencies from private repositories.
@python-poetry/triage