Nexus pypi hosted repository through pip install fails

7,732 views
Skip to first unread message

Kalai

unread,
Jun 20, 2017, 7:05:38 PM6/20/17
to Nexus Users
We planned to move from pypi registry to nexus pypi repository. I have a pypi package hosted in Nexus-3.2.1 pypi hosted repository.I am able to host the package successfully.But when i tried to install that package through pip. It fails. Help me to figure out

Thanks in advance,
Kalai

Rich Seddon

unread,
Jun 20, 2017, 7:45:22 PM6/20/17
to Nexus Users
Fails how?

What does the pip output look like?

What does your pip configuration look like?

You'll need to supply some information before anyone can help you.

Regards,

Rich

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/9777a082-b329-4565-883b-2e623e3820cb%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Kalai

unread,
Jun 21, 2017, 12:04:49 PM6/21/17
to Nexus Users
Here is .pypirc config

muthu@mac:$ cat ~/.pypirc 

[distutils]

index-servers =

    nexus


[nexus]

username:admin

password:admin123

repository:http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-hosted/



When i said pip install <my package>, it looks through in https://pypi.python.org/simple not in http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-hosted/ .


Here is the pip output:

Collecting my-package

  1 location(s) to search for versions of concept-matcher:

  * https://pypi.python.org/simple/my-package/

  Getting page https://pypi.python.org/simple/my-package/

  Looking up "https://pypi.python.org/simple/my-package/" in the cache

  No cache entry available

  Starting new HTTPS connection (1): pypi.python.org

  "GET /simple/my-package/ HTTP/1.1" 404 28063

  Status code 404 not in [200, 203, 300, 301]

  Could not fetch URL https://pypi.python.org/simple/my-package/: 404 Client Error: Not Found for url: https://pypi.python.org/simple/my-package/ - skipping

  Could not find a version that satisfies the requirement my-package (from versions: )

Cleaning up...

No matching distribution found for my-package

Exception information:

Traceback (most recent call last):

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main

    status = self.run(options, args)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run

    requirement_set.prepare_files(finder)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files

    ignore_dependencies=self.ignore_dependencies))

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 554, in _prepare_file

    require_hashes

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 278, in populate_link

    self.link = finder.find_requirement(self, upgrade)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/index.py", line 514, in find_requirement

    'No matching distribution found for %s' % req

DistributionNotFound: No matching distribution found for my-package


Thanks,

Kalai



On Tuesday, June 20, 2017 at 4:45:22 PM UTC-7, Rich Seddon wrote:
Fails how?

What does the pip output look like?

What does your pip configuration look like?

You'll need to supply some information before anyone can help you.

Regards,

Rich
On Tue, Jun 20, 2017 at 6:05 PM, Kalai <kalai.m...@iacpublishinglabs.com> wrote:
We planned to move from pypi registry to nexus pypi repository. I have a pypi package hosted in Nexus-3.2.1 pypi hosted repository.I am able to host the package successfully.But when i tried to install that package through pip. It fails. Help me to figure out

Thanks in advance,
Kalai

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.

Rich Seddon

unread,
Jun 21, 2017, 12:09:55 PM6/21/17
to Nexus Users
The .pypirc file configuration is for publishing.

See "Global pip.conf file with a repository group" section here for configuration needed to have pip retrieve packages through Nexus:



To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

To post to this group, send email to nexus...@glists.sonatype.com.

Kalai

unread,
Jun 21, 2017, 3:06:25 PM6/21/17
to Nexus Users
Thanks Rich. I tried creating pip.conf under ~/.pip/pip.conf.I am using pip version-9.0.1 and python image-2.7.10

http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-all/ --pypi group repo

http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-hosted/ -- pypi hosted repo


Here is the config of pip.conf

[global]

index = http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-all/

index-url = http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-hosted/


This is what i get now

HTTP error 404 while getting http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-all/

HTTPError: 404 Client Error: Not Found for url: http://nexus-test.dev.iad.oshift.iacp.io/repository/pypi-all/


am i doing something wrong?Let me know.



Rich Seddon

unread,
Jun 21, 2017, 3:18:19 PM6/21/17
to Nexus Users
As per the instructions in the book, you will need this in the pip.conf file:

[global]

Regards,

Rich

To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.

To post to this group, send email to nexus...@glists.sonatype.com.

Kalai

unread,
Jun 21, 2017, 5:48:31 PM6/21/17
to Nexus Users
Thank you so much Rich.. It worked like a charm. Here is the command i used: 

pip install <package-name> --trusted-host nexus-test.dev.iad.oshift.iacp.io


Thanks,

Kalai

Max Hellwig

unread,
Jan 16, 2018, 6:14:29 AM1/16/18
to Nexus Users, kalai.m...@iacpublishinglabs.com
You can also add the trusted-host setting to your pip configuration file under global:

Brian Auron

unread,
Apr 2, 2018, 4:19:23 PM4/2/18
to Nexus Users, kalai.m...@iacpublishinglabs.com, mxhe...@gmail.com
Hello,

I've created a PYPI hosted repository, a PYPI proxy (for https://pypi.python.org), and a repository group containing both.

The hosted repository is named PYPI, the proxy is PYPI-Official, and the group is PYPI-All.

I have two problems when I create ~/.pip/pip.conf with contents:
[global]
index-url = https://user:long pass wo...@nexus.example.com/repository/PYPI-All/simple

The first is that I'm unable to create virtual environments:

% virtualenv -p python3 venv
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python/3.6.4_3/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/username/venv/bin/python3.6
Not overwriting existing python script /Users/username/venv/bin/python (you must use /Users/username/deleteme/venv/bin/python3.6)
Installing setuptools, pip, wheel...
  Complete output from command /Users/username/venv/bin/python3.6 - setuptools pip wheel:
  Collecting setuptools
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/index.py", line 792, in get_page
    "Cache-Control": "max-age=600",
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 602, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/_vendor/requests/hooks.py", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/Library/Python/2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 181, in handle_401
    username = six.moves.input("User for %s: " % parsed.netloc)
EOFError: EOF when reading a line
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 2328, in <module>
    main()
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 797, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /Users/username/venv/bin/python3.6 - setuptools pip wheel failed with error code 2

The second is if I remove ~/.pip/pip.conf and instead create venv/pip.conf with the same contents with a virtualenv in place:
(venv) % pip search six
User for nexus.example.com: user
Password:
(venv) %  pip install six
Collecting six
User for nexus.example.com: user
Password:
  Could not find a version that satisfies the requirement six (from versions: )
No matching distribution found for six

So not only is it not using the proxy, it's also ignoring the credentials.

Any advice would be very much appreciated, thanks!
Reply all
Reply to author
Forward
0 new messages