Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

location of pip.conf file

I am working on a system that has to work on both Windows and Linux. Its uses Python's venv module for everything related to Python. I need to create a pip.conf file to activate the pickup of my personal ~/.pip/pip.conf to point it to our internal PyPi server instead of the global one. I also need to be able to hard code the values right into the venv's pip.conf for other scenarios. I can't figure out where the file should be placed.

In short, sometimes I need it to use my personal pip.conf, sometimes I need it to use the venv's pip.conf, on both Linux and Windows (my machine is Windows).

The folder structure of my venv after creation is this:

myproject/build/venv/Include
                    /Lib
                    /Scripts

Where does the pip.conf go? I keep reading in the documentation %virtual_env%/pip.conf but when you don't know what the value of virtual_env, its a pretty useless statement.

My guess is myproject/build/venv/pip.conf, am I right?

edit**

Well, I was wrong. Putting it in the root of the venv folder didn't work. I'm going to keep trying, problem is to redeploy this app after each code change takes an hour.

like image 528
scphantm Avatar asked Feb 10 '17 19:02

scphantm


3 Answers

The easiest way to locate the folder is by running the following command in the cmd.

pip config -v list

That will result with the paths that pip is searching in to find the config file. There are different paths for global, user, site. And you can even add one for you specific needs.

like image 117
George Sotiropoulos Avatar answered Sep 30 '22 19:09

George Sotiropoulos


According to pip user guide https://pip.pypa.io/en/stable/user_guide/#config-file it's pip.ini under Windows, not pip.conf.

It should be at the root of your virtual environnement, right where you tried with pip.conf, and takes precedence over your personal %APPDATA%/pip/pip.ini.

like image 42
Lyonel S Avatar answered Sep 30 '22 19:09

Lyonel S


On Windows, the configuration is stored at C:\Users\<username>\.virtualenvs\<virtual env name>\pip.ini Ref: https://pip.pypa.io/en/stable/user_guide/#config-file

like image 42
leocrimson Avatar answered Sep 30 '22 19:09

leocrimson