-
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__:[email protected]/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
Reactions are currently unavailable
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