Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python - cant find pip.ini or pip.conf in Windows

I got Python 2.7.8 installed on my Win7 machine, which comes with pip already pre-installed.
I'm successfully able to install new packages from pip and now I need to add custom repository url to the install list of pip

To do so I need to modify pip.ini which is in %APPDATA%\pip\pip.ini according to the Official Manual
However there are no pip folder anywhere (not in Roaming, not in Local, not in LocalLow) nor there exists PyPa folder in: C:\ProgramData\PyPA\pip\pip.conf

Could you tell me where do i search for pip.ini? how to add foreign repo to the install list?

like image 619
Briksins Avatar asked Feb 02 '15 12:02

Briksins


People also ask

Where is pip INI in Windows?

On Windows the configuration file is: %HOME%\pip\pip. ini.

Where is pip config file located?

pip/pip. conf . The legacy “per-user” configuration file is also loaded, if it exists: $HOME/. pip/pip.

How do I download pip for Windows?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.


2 Answers

Instead of checking a list of well-known locations, you can ask pip to list the valid locations:

pip config -v list 

Fun fact

On the same machine, with the same pip version, the valid locations can vary based on the actual Python version.

Environment: Win 7 x64, the HOME environment variable is set to D:\Home

Python 3.7.3:

> pip config -v list For variant 'global', will try loading 'C:\ProgramData\pip\pip.ini' For variant 'user', will try loading 'D:\Home\pip\pip.ini' For variant 'user', will try loading 'C:\Users\foobar\AppData\Roaming\pip\pip.ini' For variant 'site', will try loading 'C:\Python37\pip.ini' 

Python 3.8.0:

> pip config -v list For variant 'global', will try loading 'C:\ProgramData\pip\pip.ini' For variant 'user', will try loading 'C:\Users\foobar\pip\pip.ini' For variant 'user', will try loading 'C:\Users\foobar\AppData\Roaming\pip\pip.ini' For variant 'site', will try loading 'C:\Python38\pip.ini' 
like image 117
alexandrul Avatar answered Sep 17 '22 02:09

alexandrul


Finally got it sorted.

Apparently for Windows users pip.ini config file is not created, however can be added manually!

just create new %APPDATA%\pip\pip.ini and content of custom repository:

[install] find-links = https://<login>:<password>@your.repo.com/custom/url 

Reference: https://pip.pypa.io/en/stable/user_guide/#config-file

like image 26
Briksins Avatar answered Sep 20 '22 02:09

Briksins