scphantm
scphantm

Reputation: 4533

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.

Upvotes: 14

Views: 73717

Answers (4)

Olivier Verdier
Olivier Verdier

Reputation: 49126

What worked for me to obtain all the config files was

pip config debug

(It seems to do what pip config -v list did before)

Upvotes: 7

George Sotiropoulos
George Sotiropoulos

Reputation: 2123

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.

Upvotes: 29

leocrimson
leocrimson

Reputation: 742

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

Upvotes: 1

Lyonel S
Lyonel S

Reputation: 41

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.

Upvotes: 4

Related Questions