poetry fails to find packages in private repositories - depends on venv
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: ubuntu 19.10
- Poetry version: 1.0.5
Issue
It seems that poetry fails to find the package from a private repository (both with nginx + autoindex and pypiserver) if virtualenv is created by poetry or by python -m venv. It finds it if the virtualenv is build with virtualenvwrapper.
I was trying to add package thx-nonamespace from repository pypi.thux.dev
in a package created with poetry new bianco
after adding support for a personal repository:
[tool.poetry]
name = "bianco"
version = "0.1.0"
[[tool.poetry.source]]
name = "dev"
url = "https://pypi.thux.dev/simple/"
and the error message is:
$ poetry add thx-nonamespace
Using version ^0.1.0 for thx-nonamespace
Updating dependencies
Resolving dependencies... (0.6s)
Package operations: 1 install, 0 updates, 0 removals
- Installing thx-nonamespace (0.1.0)
[EnvCommandError]
Command ['/tmp/bianco/lotest/bin/pip', 'install', '--no-deps', '--index-url', 'https://thux:TFCxdr@pypi.thux.dev/simple', '--extra-index-url', 'https://pypi.org/simple/', 'thx-nonamespace==0.1.0'] errored with the following return code 1, and output:
Looking in indexes: https://pypi.thux.dev/simple, https://pypi.thux.dev/simple/, https://pypi.org/simple/
Looking in links: https://pypi.thux.it
Collecting thx-nonamespace==0.1.0
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/thx-nonamespace/
poetry start correctly detecting the existing release of pkg thx-nonamespace
but then tries to downloading it from pypi.org and clearly fails to find it. This happens both with poestry’s navive virtualenv and with virtualenv created with python -m venv
.
Everything works correctly if I use a virtualenv build with virtualenvwrapper:
sandro@bluffx:/tmp/bianco$ mkvirtualenv junk-bianco
Running virtualenv with interpreter /usr/bin/python3.7
Using base prefix '/usr'
/usr/lib/python3/dist-packages/virtualenv.py:1090: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
New python executable in /home/sandro/.virtualenvs/junk-bianco/bin/python3.7
Also creating executable in /home/sandro/.virtualenvs/junk-bianco/bin/python
Please make sure you remove any previous custom paths from your /home/sandro/.pydistutils.cfg file.
Installing setuptools, pkg_resources, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/sandro/.virtualenvs/junk-bianco/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/sandro/.virtualenvs/junk-bianco/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/sandro/.virtualenvs/junk-bianco/bin/preactivate
virtualenvwrapper.user_scripts creating /home/sandro/.virtualenvs/junk-bianco/bin/postactivate
virtualenvwrapper.user_scripts creating /home/sandro/.virtualenvs/junk-bianco/bin/get_env_details
(junk-bianco) sandro@bluffx:/tmp/bianco$ poetry add thx-nonamespace
Using version ^0.2.0 for thx-nonamespace
Updating dependencies
Resolving dependencies... (0.7s)
Package operations: 12 installs, 0 updates, 0 removals
- Installing zipp (3.1.0)
- Installing importlib-metadata (1.5.0)
- Installing pyparsing (2.4.6)
- Installing six (1.14.0)
- Installing attrs (19.3.0)
- Installing more-itertools (8.2.0)
- Installing packaging (20.3)
- Installing pluggy (0.13.1)
- Installing py (1.8.1)
- Installing wcwidth (0.1.8)
- Installing pytest (5.3.5)
- Installing thx-nonamespace (0.2.0)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:7 (2 by maintainers)
Good news: I have now a situation that works. The last step was to use a private repo using
pypiserver
rather than the private repository I used for years that just usesnginx + autoindex
. I think this is acceptable but needs to be reported in the documentation.When I tested the different setup I didn’t realize that
poetry.lock
holds thepyproject.toml
configuration and particularly the sources. Poetry adds a warning thatpoetry.lock
needs an update, but I may have not put enough attention on it so that I thought it worked with both repositories but I was just working with the same one (pypiserver).So, the working situation for me passes through these steps:
pip run pip inistall --upgrade pip
(@mrosales suggests alsosetuptools
andwheel
)pyproject.toml
:[[tool.poetry.source]]
Closing this as it doesn’t reproduce on 1.2.x (and indeed, with the new installer Poetry downloads packages, instead of pip).