How to use and setup pip server path to get the packages ?

In this article, we will see how to configure pip server path on our system to get the packages automatically.

Lets see this step by step.

1. Direct Command Line Installation Steps

Both pip and easy_install support the -i option to specify an index server url, example for simplejosn

#pip install –trusted-host -i http://NGEL-pypirepo.Ngelinux.com:3141/root/pypi/+simple/ simplejson

 

2. Permanent Configuration Installation Steps

b.  To avoid having to re-type index URLs with pip or easy-install , you can configure pip by setting the index-url entry in your $HOME/.pip/pip.conf (posix) or, $HOME/pip/pip.ini (windows).

# $HOME/.pip/pip.conf

[global]

index-url = http://NGEL-pypirepo.Ngelinux.com:3141/root/pypi/+simple/

or, Alternatively, you can add a special environment variable to your shell settings (e.g. .bashrc):

or, For pip search you need a [search] section in your pip.conf:

or, You can configure easy_install by an entry in the $HOME/.pydistutils.cfg file:

# $HOME/.pydistutils.cfg:

[easy_install]

index_url = http://NGEL-pypirepo.Ngelinux.com:3141/root/pypi/+simple/

And in the end we can install it with command:

#pip install simplejson

 

Note:- Make sure the URL is correct to get all the packages through pip successfully.

 

3. Working Example: How i used to work in this.

[user@ngelinux001 .pip]$ cat pip.conf

[global]

index-url = http://NGEL-pypirepo.Ngelinux.com:3141/root/pypi/+simple/

[user@ngelinux001 .pip]$



[user@ngelinux001 .pip]$ /grid/common/pkgs/python/v3.10.4/bin/python3 -m pip install simplejson --trusted-host NGEL-pypirepo.Ngelinux.com

Defaulting to user installation because normal site-packages is not writable

Looking in indexes: http://NGEL-pypirepo.Ngelinux.com:3141/root/pypi/+simple/

Collecting simplejson

  Downloading http://NGEL-pypirepo.Ngelinux.com:3141/root/pypi/%2Bf/f63/600ec06982cdf/simplejson-3.17.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (137 kB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 137.1/137.1 kB 383.4 kB/s eta 0:00:00

Installing collected packages: simplejson

Successfully installed simplejson-3.17.6

WARNING: There was an error checking the latest version of pip.

[user@ngelinux001 .pip]$
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments