Search code examples
pythonpython-2.7proxypipnexus

how can i use pip search with my own nexus pypi repo?


I deploy a nexus repo sys in my local area network, and I config a PyPI repo on it. I can use pip install to install package with my private mirror. But I cannot use pip search.

Here is my pip.ini

[global]
index-url = http://nexus.repo.com/repository/PyPI/simple
index = http://nexus.repo.com/repository/PyPI/pypi
trusted-host = nexus.repo.com

And when I use pip search it returns:

C:\Users\user>pip search redis
HTTP error 404 while getting http://nexus.repo.com/repository/PyPI/pypi
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\search.py", line 45, in run pypi_hits = self.search(query, options)
File "c:\python27\lib\site-packages\pip\commands\search.py", line 62, in search hits = pypi.search({'name': query, 'summary': query}, 'or')
File "c:\python27\lib\xmlrpclib.py", line 1243, in call return self.__send(self.__name, args)
File "c:\python27\lib\xmlrpclib.py", line 1602, in __request verbose=self.__verbose
File "c:\python27\lib\site-packages\pip\download.py", line 776, in request response.raise_for_status()
File "c:\python27\lib\site-packages\pip_vendor\requests\models.py", line 862, in raise_for_status raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: Not Found for url:http://nexus.repo.com/repository/PyPI/pypi
C:\Users\user>

I'm googling and googling, but coming up empty so far. So here I am, hoping someone else can guide me through this. thank you very much.


Solution

  • Try this: pip search redis -i http://nexus.repo.com/repository/PyPI/pypi -vvv --trusted-host nexus.repo.com

    I had the same problem, and found that I was basically searching with the /simple url, rather than the /pypi one (the /simple one works only for pip install)