8

Using nexus 3 I configured a proxy python repository using "https://pypi.org" as remote storage. The url of the repository is "http://localhost:8081/repository/pypi/".

Then i used pip to install packages using nexus repository, in $HOME/.config/pip/pip.conf I have the following configurations:

[global]
index = http://localhost:8081/repository/pypi/pypi
index-url = http://localhost:8081/repository/pypi/stable
trusted-host = localhost

Now when I run pip search pexpect it works fine :

User for localhost:8081: someuser
Password: 
pexpect (4.7.0)                  - Pexpect allows easy control of interactive console applications.
pexpect-serial (0.0.4)           - pexpect with pyseriat
...

But when I run pip install pexpect I get the following error :

Collecting pexpect
User for localhost:8081: someuser
Password: 
  Could not find a version that satisfies the requirement pexpect (from versions: )
No matching distribution found for pexpect

Do I need extras configurations in pip.conf or inside my nexus repository ?

BOUKANDOURA Mhamed
  • 941
  • 1
  • 9
  • 25
  • Possible duplicate of [pip install producing "Could not find a version that satisfies the requirement"](https://stackoverflow.com/questions/51589673/pip-install-producing-could-not-find-a-version-that-satisfies-the-requirement) – Nils Werner Jul 17 '19 at 10:14

2 Answers2

11

You should change this:

[global]
index = http://localhost:8081/repository/pypi/pypi
index-url = http://localhost:8081/repository/pypi/stable
trusted-host = localhost

to this (swapping stable for simple):

[global]
index = http://localhost:8081/repository/pypi/pypi
index-url = http://localhost:8081/repository/pypi/simple
trusted-host = localhost
Clintm
  • 4,505
  • 3
  • 41
  • 54
5

As an alternative, you can install the packages without modifying the config:

If you Nexus PyPi repository is http://localhost:8081/repository/pypi/:

# To install, mind trailing /simple
pip install -i http://localhost:8081/repository/pypi/simple pexpect

# To search, mind trailing /pypi
pip search -i http://localhost:8081/repository/pypi/pypi pexpect

Source: Nexus docs

The Godfather
  • 4,235
  • 4
  • 39
  • 61