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.

Repository "private" does not exist | Since 1.1.0

See original GitHub issue
[[tool.poetry.source]]
name = "private"
url = "https://my.private.repo/simple"
secondary = true

Issue

When running a poetry install with a private repo (poetry config http-basic.private is set correctly), I get:

  Stack trace:

  7  /usr/local/lib/python3.7/site-packages/poetry/installation/executor.py:199 in _execute_operation
      197β”‚
      198β”‚             try:
    β†’ 199β”‚                 result = self._do_execute_operation(operation)
      200β”‚             except EnvCommandError as e:
      201β”‚                 if e.e.returncode == -2:

  6  /usr/local/lib/python3.7/site-packages/poetry/installation/executor.py:273 in _do_execute_operation
      271β”‚             return 0
      272β”‚
    β†’ 273β”‚         result = getattr(self, "_execute_{}".format(method))(operation)
      274β”‚
      275β”‚         if result != 0:

  5  /usr/local/lib/python3.7/site-packages/poetry/installation/executor.py:408 in _execute_install
      406β”‚
      407β”‚     def _execute_install(self, operation):  # type: (Install) -> None
    β†’ 408β”‚         return self._install(operation)
      409β”‚
      410β”‚     def _execute_update(self, operation):  # type: (Update) -> None

  4  /usr/local/lib/python3.7/site-packages/poetry/installation/executor.py:434 in _install
      432β”‚             archive = self._download_link(operation, Link(package.source_url))
      433β”‚         else:
    β†’ 434β”‚             archive = self._download(operation)
      435β”‚
      436β”‚         operation_message = self.get_operation_message(operation)

  3  /usr/local/lib/python3.7/site-packages/poetry/installation/executor.py:575 in _download
      573β”‚
      574β”‚     def _download(self, operation):  # type: (Operation) -> Path
    β†’ 575β”‚         link = self._chooser.choose_for(operation.package)
      576β”‚
      577β”‚         return self._download_link(operation, link)

  2  /usr/local/lib/python3.7/site-packages/poetry/installation/chooser.py:60 in choose_for
       58β”‚         """
       59β”‚         links = []
    β†’  60β”‚         for link in self._get_links(package):
       61β”‚             if link.is_wheel and not Wheel(link.filename).is_supported_by_environment(
       62β”‚                 self._env

  1  /usr/local/lib/python3.7/site-packages/poetry/installation/chooser.py:92 in _get_links
       90β”‚                 repository = self._pool.repository("pypi")
       91β”‚         else:
    β†’  92β”‚             repository = self._pool.repository(package.source_reference)
       93β”‚
       94β”‚         links = repository.find_links_for_package(package)

  ValueError

  Repository "private" does not exist.

  at /usr/local/lib/python3.7/site-packages/poetry/repositories/pool.py:53 in repository
       49β”‚
       50β”‚         if name in self._lookup:
       51β”‚             return self._repositories[self._lookup[name]]
       52β”‚
    β†’  53β”‚         raise ValueError('Repository "{}" does not exist.'.format(name))
       54β”‚
       55β”‚     def add_repository(
       56β”‚         self, repository, default=False, secondary=False
       57β”‚     ):  # type: (Repository, bool, bool) -> Pool

If I downgrade to 1.0.10, everything works fine. This error popped at the 1.1.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
ChameleonTartucommented, Oct 13, 2020

I get a similar issue with the 1.1.2 version. link-python-common is a private repo project.

  β€’ Installing link-python-common (1.0.0): Failed

  RuntimeError

  Unable to find installation candidates for link-python-common (1.0.0)

  at ~/.poetry/lib/poetry/installation/chooser.py:73 in choose_for
       69β”‚             links.append(link)
       70β”‚ 
       71β”‚         if not links:
       72β”‚             raise RuntimeError(
    β†’  73β”‚                 "Unable to find installation candidates for {}".format(package)
       74β”‚             )
       75β”‚ 
       76β”‚         # Get the best link
       77β”‚         chosen = max(links, key=lambda link: self._sort_key(package, link))

Example of toml file:

[[tool.poetry.source]]
name = "example-test-pypi"
url = "https://exmaple-url-pypi/pypi"
secondary=true

[tool.poetry]
name = "my-example-project-toml"
version = "0.1.0"
description = ""

[tool.poetry.dependencies]
python = "^3.7.7"
link-python-common = "^1.0.0"
xmljson = "^0.2.0"
returns = "^0.13.0"
typing_extensions = "3.7.4"
attrs = "19.1.0"
defusedxml = "^0.6.0"

[tool.poetry.dev-dependencies]
pytest = "^5.1"
mypy = "^0.770.0"
wemake-python-styleguide = "^0.14.0"
pre-commit = "^1.18"
requests = "^2.23.0"

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

Also, I set poetry config http-basic.example-test-pypi my_example_pypy_user my_example_pypi_password

Is there anything I can do to fix this? I can make a PR if you guide me on where and what should be fixed.

2reactions
RobinFrcdcommented, Oct 7, 2020

Alright, I managed to make it work by tweaking the toml. I moved tool.poetry.dependencies to the top.

I had (which is working on 1.0.10 but not on 1.1.0+)

[[tool.poetry.source]]
name = "private"
url = "https://my.private.repo/simple/"
secondary = true

[tool.poetry]
name = "metrics"
version = "0"
description = ""
authors = [""]

[tool.black]
line-length = 88
target-version = ['py37']
include = '\.pyi?$'
exclude = '''
/(
    \.eggs
  | \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | _build
  | buck-out
  | build
  | dist
)/
'''

[tool.coverage.run]
omit = [
    'tests/*',
    '*_pb2.py',
    '*_pb2_grpc.py'
]

[tool.poetry.dependencies]
python = "^3.7"
google-api-python-client = "==1.9.1"
grpcio = "==1.29.0"
grpcio-status = "==1.29.0"
private-logger = "==2.0.2"
protobuf = "==3.11.1"
sentry-sdk = "==0.15.1"
taskipy = ">=1.3.0"
numpy = "*"

[tool.poetry.dev-dependencies]
black = "==19.3b0"
flake8 = "==3.7.9"
mypy = "==0.770"

[tool.taskipy.tasks]
black = "black ."
mypy = "mypy . --ignore-missing-imports"
linter = "flake8 ."

And switched it to

[[tool.poetry.source]]
name = "private"
url = "https://my.private.repo/simple/"
secondary = true

[tool.poetry]
name = "metrics"
version = "0"
description = ""
authors = [""]

[tool.poetry.dependencies]
python = "^3.7"
google-api-python-client = "==1.9.1"
grpcio = "==1.29.0"
grpcio-status = "==1.29.0"
private-logger = "==2.0.2"
protobuf = "==3.11.1"
sentry-sdk = "==0.15.1"
taskipy = ">=1.3.0"
numpy = "*"

[tool.poetry.dev-dependencies]
black = "==19.3b0"
flake8 = "==3.7.9"
mypy = "==0.770"

[tool.black]
line-length = 88
target-version = ['py37']
include = '\.pyi?$'
exclude = '''
/(
    \.eggs
  | \.git
  | \.hg
  | \.mypy_cache
  | \.tox
  | \.venv
  | _build
  | buck-out
  | build
  | dist
)/
'''

[tool.coverage.run]
omit = [
    'tests/*',
    '*_pb2.py',
    '*_pb2_grpc.py'
]

[tool.taskipy.tasks]
black = "black ."
mypy = "mypy . --ignore-missing-imports"
linter = "flake8 ."

And now it works with 1.1.0+.

So I don’t know if we should close the issue, I think it’s still a bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Poetry trying to install everything from private repository
I clear the cache when trying something. N.B: the private repo I'm trying to install from does not require any kind of authentication....
Read more >
The Chart Repository Guide - Helm
This section explains how to create and work with Helm chart repositories. At a high level, a chart repository is a location where...
Read more >
Learning the Basics - Gradle User Manual
Declaring multiple repositories is helpful if some dependencies are only available in one repository but not the other. You can mix any type...
Read more >
Private Repositories - Declarative GitOps CD for Kubernetes
If application manifests are located in private repository then repository credentials have to be configured. Argo CD supports both HTTP and SSH GitΒ ......
Read more >
How To Fix Go Mod Unknown Revision - Golang Cafe
After the introduction of Go mod you may have worked with Go modules and private repositories. When working on a Go project that...
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