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.

Can't use private repository in `poetry add`

See original GitHub issue

Poetry version: 0.10.3 Python Version: 3.6.5

(Note: I redacted URL of my private repository)

pyproject.toml:

[tool.poetry]
name = "project"
version = "0.1.0"
description = ""
authors = []

[[tool.poetry.source]]
name = "private"
url = "<url>"

[tool.poetry.dependencies]
python = "^3.6"

[tool.poetry.dev-dependencies]
pytest = "^3.5"

I ran the following two commands:

  • poetry config repositories.private <url>
  • poetry config http-basic.private <username>

Checking the config files on disk, the values are correct.

When I run poetry search <private package> or poetry add <private package> poetry cannot find the package. Here’s the output of poetry -vvv add:

poetry -vvv add <private package>
                                  
[ValueError]       
Package [<private package>] not found.  
                                  
Exception trace:
 /usr/local/lib/python3.6/site-packages/poetry/_vendor/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /usr/local/lib/python3.6/site-packages/poetry/console/application.py in do_run() at line 87
   return super(Application, self).do_run(i, o)
 /usr/local/lib/python3.6/site-packages/poetry/_vendor/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /usr/local/lib/python3.6/site-packages/poetry/console/commands/command.py in run() at line 72
   return super(BaseCommand, self).run(i, o)
 /usr/local/lib/python3.6/site-packages/poetry/_vendor/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /usr/local/lib/python3.6/site-packages/poetry/_vendor/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /usr/local/lib/python3.6/site-packages/poetry/console/commands/add.py in handle() at line 65
   packages, allow_prereleases=self.option("allow-prereleases")
 /usr/local/lib/python3.6/site-packages/poetry/console/commands/init.py in _determine_requirements() at line 215
   requirement["name"], allow_prereleases=allow_prereleases
 /usr/local/lib/python3.6/site-packages/poetry/console/commands/init.py in _find_best_version_for_package() at line 245
   name, required_version, allow_prereleases=allow_prereleases
 /usr/local/lib/python3.6/site-packages/poetry/version/version_selector.py in find_best_candidate() at line 28
   package_name, constraint, allow_prereleases=allow_prereleases
 /usr/local/lib/python3.6/site-packages/poetry/repositories/pool.py in find_packages() at line 83
   name, constraint, extras=extras, allow_prereleases=allow_prereleases
 /usr/local/lib/python3.6/site-packages/poetry/repositories/pypi_repository.py in find_packages() at line 90
   info = self.get_package_info(name)
 /usr/local/lib/python3.6/site-packages/poetry/repositories/pypi_repository.py in get_package_info() at line 225
   name, lambda: self._get_package_info(name)
 /usr/local/lib/python3.6/site-packages/poetry/_vendor/cachy/repository.py in remember_forever() at line 174
   val = value(callback)
 /usr/local/lib/python3.6/site-packages/poetry/_vendor/cachy/helpers.py in value() at line 6
   return val()
 /usr/local/lib/python3.6/site-packages/poetry/repositories/pypi_repository.py in <lambda>() at line 225
   name, lambda: self._get_package_info(name)
 /usr/local/lib/python3.6/site-packages/poetry/repositories/pypi_repository.py in _get_package_info() at line 231
   raise ValueError("Package [{}] not found.".format(name))

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...

We use pypicloud for our private repository.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

19reactions
greatvovancommented, Dec 11, 2019

Why is this issue closed?

poetry add still does not work for packages in private repos. The repo is configured:

poetry  config --list
settings.virtualenvs.create = true
settings.virtualenvs.in-project = false
settings.virtualenvs.path = "/Users/xxx/Library/Caches/pypoetry/virtualenvs"
repositories.my.url = "http://pypi.my.domain.net/simple/"
$ poetry add mypackage==1.3.2
                                  
[PackageNotFound]  
Package [mypackage] not found.  

See also verbose output.

There is no authentication in my repo.

The path from repositories.my.url works well with pip install.

I was able to overcome this by adding the package manually into pyproject.toml as well as this section:

[[tool.poetry.source]]
name = "my"
url = "http://pypi.my.domain.net/simple/"

Then I deleted poetry.lock and issued poetry install. Now I got it in the ‘lock’ file, but this seems too cumbersome.

@sdispater should I open a new issue?

P.S. My username, package name and URL are consistently changed into other values.

$ poetry --version
Poetry 0.12.17
14reactions
szafranekcommented, Apr 23, 2020

This issue should be reopened. The problem still happens in poetry 1.0.5.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Repositories | Documentation | Poetry - Python dependency ...
Repositories Poetry supports the use of PyPI and private repositories for discovery of packages as well as for publishing your projects.
Read more >
python - Poetry trying to install everything from private repository
Poetry trying to install everything from private repository · poetry first checks if the project is in your private-pypi and then checks public- ......
Read more >
Using Poetry with a Private Repository
First, let's add a reference to our repository in the pyproject.toml file (above the tool.poetry.dependencies section), add the section ...
Read more >
Poetry - The Blue Book
In this case, you will need to use a private repository. You will need to add it to your global list of repositories....
Read more >
Private package support - Renovate Docs
If you have a preset in a private repo but reference ("extend") it from a public repository then it won't work. This is...
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