-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
area/authRelated to the authenticator and keyringRelated to the authenticator and keyringarea/sourcesReleated to package sources/indexes/repositoriesReleated to package sources/indexes/repositorieskind/bugSomething isn't working as expectedSomething isn't working as expected
Description
- 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 (
-vvvoption).
- Ubuntu 20.10:
- 1.1.6:
- https://gist.github.com/shaunc/14713d9e9e64d32fc81f506ab926ce77
Issue
I have added a private repository hosted in gitlab to poetry config:
poetry config repositories.machinelearning https://gl.factfiber.ai/api/v4/projects/8/packages/pypi/simple
poetry config pypi-token.machinelearning $TOKEN
However, I can't add a package from the repo:
poetry add dcache -vvv
[fails with auth error -- see stack trace below.]
However, I can add it using pip inside the virtual environment
poetry shell
pip install dcache --extra-index-url https://__token__:$TOKEN@gl.factfiber.ai/api/v4/projects/8/packages/pypi/simple
Stacktrace:
poetry add dcache -vvv
Using virtualenv: /home/shauncutts/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9
Stack trace:
10 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/clikit/console_application.py:131 in run
129β parsed_args = resolved_command.args
130β
β 131β status_code = command.handle(parsed_args, io)
132β except KeyboardInterrupt:
133β status_code = 1
9 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/clikit/api/command/command.py:120 in handle
118β def handle(self, args, io): # type: (Args, IO) -> int
119β try:
β 120β status_code = self._do_handle(args, io)
121β except KeyboardInterrupt:
122β if io.is_debug():
8 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/clikit/api/command/command.py:171 in _do_handle
169β handler_method = self._config.handler_method
170β
β 171β return getattr(handler, handler_method)(args, io, self)
172β
173β def __repr__(self): # type: () -> str
7 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/cleo/commands/command.py:92 in wrap_handle
90β self._command = command
91β
β 92β return self.handle()
93β
94β def handle(self): # type: () -> Optional[int]
6 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/poetry/console/commands/add.py:106 in handle
104β return 0
105β
β 106β requirements = self._determine_requirements(
107β packages,
108β allow_prereleases=self.option("allow-prereleases"),
5 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/poetry/console/commands/init.py:328 in _determine_
requirements
326β elif "version" not in requirement:
327β # determine the best version automatically
β 328β name, version = self._find_best_version_for_package(
329β requirement["name"],
330β allow_prereleases=allow_prereleases,
4 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/poetry/console/commands/init.py:361 in _find_best_version_for_package
359β
360β selector = VersionSelector(self._get_pool())
β 361β package = selector.find_best_candidate(
362β name, required_version, allow_prereleases=allow_prereleases, source=source
363β )
3 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/poetry/version/version_selector.py:32 in find_best_candidate
30β },
31β )
β 32β candidates = self._pool.find_packages(dependency)
33β only_prereleases = all([c.version.is_prerelease() for c in candidates])
34β
2 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/poetry/repositories/pool.py:165 in find_packages
163β packages = []
164β for repo in self._repositories:
β 165β packages += repo.find_packages(dependency)
166β
167β return packages
1 ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/lib/python3.9/site-packages/poetry/repositories/legacy_repository.py:264 in find_packages
262β versions = self._cache.store("matches").get(key)
263β else:
β 264β page = self._get("/{}/".format(dependency.name.replace(".", "-")))
265β if page is None:
266β return []
RepositoryError
401 Client Error: Unauthorized for url: https://gl.factfiber.ai/api/v4/projects/8/packages/pypi/simple/dcache/
at ~/.cache/pypoetry/virtualenvs/bt-features-BmwID7oW-py3.9/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),
Note that these, also, didn't work:
poetry config http-basic.machinelearning $TOKEN "__token__"
poetry config http-basic.machinelearning "__token__" $TOKEN
poetry config http-basic.machinelearning $TOKEN ""
poetry config http-basic.machinelearning "" $TOKEN
JamieMcKernanKaizen and justinTM
Metadata
Metadata
Assignees
Labels
area/authRelated to the authenticator and keyringRelated to the authenticator and keyringarea/sourcesReleated to package sources/indexes/repositoriesReleated to package sources/indexes/repositorieskind/bugSomething isn't working as expectedSomething isn't working as expected