Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make `pip search` work with my local pypi server?

I have a bunch of machines that are isolated from the internet, and only have access to some services on the local network.

I want the users using those machines to be able to search for and install whatever python libraries they want from a local pypi server. I therefore created a global pip.conf under /etc/ which contains the following lines:

[global]
trusted-host = my.pypi-server.com
index-url = https://my.pypi-server.com/

This works when the name of the library is known and you just run pip install fancy-lib. However, when searching for a package, pip seems to ignore index-url:

$  pip search fancy-lib -vvvv
Starting new HTTPS connection (1): pypi.python.org

$  pip install fancy-lib -vvvv
Collecting fancy-lib
  1 location(s) to search for versions of fancy-lib:
  * https://my.pypi-server.com/simple/fancy-lib
  Getting page https://my.pypi-server.com/simple/fancy-lib
  Looking up "https://my.pypi-server.com/simple/fancy-lib" in the cache
  No cache entry available
  Starting new HTTPS connection (1): https://my.pypi-server.com/

How can I make pip search work with my local pypi server?

like image 965
rasebo Avatar asked Aug 15 '17 11:08

rasebo


People also ask

Does pip pull from PyPI?

pip is installing the packages from PyPi, yes. On the PyPi website you can find links to github where you can find the full package code, but where pip download is PyPi.

How do I search in pip?

pip search Looking for a package, pip is there to help you out. pip search allows you to search PyPI for any package using the pip search <package> command. The result of the command returns the name and description of all the matching packages.

How to get started with Pip in Python?

Getting Started with PIP Now, when we know what PIP is and we have it installed on the computer, let’s see how to use it. To install a package from the Python Package Index, just open up your terminal and type in a search query using the PIP tool. PIP – Commands Just typing pip in your terminal, should give you the following output on the

Why can't I search for Python packages with Pip?

The upshot is that searching for Python packages with pip, eg: pip search ascii or pip3 search png, isn't possible because this backend search API is unavailable. In March, the API was permanently disabled, depriving developers of one of several ways to programmatically find packages in PyPI.

How do I use PIP search in Bash?

Use with pip_search anything To use as the traditional pip search <keywords> method, add this alias to your.zshrc,.bashrc,.bash_profile, etc. alias pip='function _pip () { if [ $1 = "search" ]; then pip_search "$2"; else pip "$@"; fi; };_pip' Then run with pip search

How do I install pip on Linux?

Installing PIP is easy and if you're running Linux, its usually already installed. If it's not installed or if the current version is outdated, you can use the package manager to install or update it. PyPI - the Python Package Index. Now, when PIP is installed, we need to find a package to install.


1 Answers

It seems it was just a matter of RTM. The search index is independent from the install one, and is specified using index:

[global]
trusted-host = my.pypi-server.com
index = https://my.pypi-server.com/
index-url = https://my.pypi-server.com/

An alternative to this config file would be:

[global]
trusted-host = my.pypi-server.com

[search]
index = https://my.pypi-server.com/

[install]
index-url = https://my.pypi-server.com/

This is not really intuitive, and there is already an enhancement request open to address it: https://github.com/pypa/pip/issues/4263

like image 51
rasebo Avatar answered Oct 09 '22 08:10

rasebo