I can't find the file pip.conf
in the path ~/.config/pip/pip.conf
or the path ~/pip/pip.conf
. My version of pip is 8.1.2

- 1,220
- 1
- 12
- 31

- 693
- 1
- 5
- 12
11 Answers
Use the pip to retrieve its location, here is the trick!
python3 -m pip config debug
It will list global and local env, If it set or otherwise.

- 646
- 4
- 5
-
Damn, this is magic ✨ – Fusion Sep 14 '22 at 19:18
As stated in the documentation, the default locations for Linux are:
- per-user:
$HOME/.config/pip/pip.conf
- global:
/etc/pip.conf

- 48,893
- 5
- 92
- 171

- 939
- 6
- 8
-
12Beware! pip 20.0 (used in Ubuntu 20.04) has a bug, where it doesn't read /etc/pip.conf, but only /etc/xdg/pip/pip.conf. This bug was fixed in pip 20.1, but the fix is currently not available in the pip package for Ubuntu 20.04. – Enno Gröper May 13 '20 at 14:57
-
2it's worth noticing in those same docs that there is a third option to have a per-virtualenv configuration at `$VIRTUAL_ENV/pip.conf`. – vlizana Aug 26 '20 at 20:12
-
@EnnoGröper Do you know if there is an Ubuntu bug report for this? I can't seem to find one. – Michael Feb 02 '21 at 22:05
-
https://pip.pypa.io/en/stable/user_guide/#configuration
If you do not have the pip.conf by default, create it on your desired directory and do the export.
export PIP_CONFIG_FILE=/path/to/pip.conf

- 371
- 2
- 6
-
2Remember, no spaces --> `export PIP_CONFIG_FILE=/path/to/pip.conf` – Michael Ababio Jul 03 '18 at 15:36
Before creating pip.conf I would rather check with the following command before creating one
find . -name 'pip.conf'
For me it was under home directory as
./Library/Application Support/pip/pip.conf

- 1,577
- 1
- 19
- 26
-
1I've found it in `/home/$user_name/.config/pip/pip.conf` using your command. I'm running a Linux machine. – yosra Jun 25 '19 at 09:07
Another solution not found in any of the answers about finding the pip.conf
files currently used by pip:
pip config list
if no file is described you should follow most of the other answers and just create it on your own

- 1,116
- 1
- 14
- 34
just create it.~/pip/pip.conf

- 27,015
- 29
- 156
- 295
-
-
So I added this lines to the config file [global] index-url = https://(website link) and I have error ImportError: No module named (from my site ) – user5324426 Aug 10 '16 at 09:30
-
5
-
As stated in https://stackoverflow.com/a/44969159/1331407 the path should be `~/.config/pip/pip.conf` – ingofreyer Jan 28 '20 at 10:55
I am using WSL ubuntu on win10, with only official python3-pip, and cannot find any pip.conf.
I just create ~/.pip/pip.conf
, and then it speeds up my sudo pip3 install --upgrade pip
!

- 389
- 3
- 6
-
1
-
this answer also helps with using `pip.conf` in a `Dockerfile` : https://stackoverflow.com/questions/38180964/customize-onbuild-environment-in-a-dockerfile – nedstark179 Dec 01 '20 at 15:38
According to the docs, it could be located in a multitude of places.
In terms of flexibility, I say the section about installing it on virtual environments is probably the most flexible IMO.
If you use a virtual environment for your python projects, then it may be desirable to have your pip.conf
inside the virtual environment, than to have it sitting in your home directory.
The reason for this is simple. Say for example you have special projects that require specific pip.conf
setup and you don't want to put the configurations for these projects in the pip.conf
in your home directory or the global one, then you might find it makes life easier to create a dummy environment where this configuration lives and simply copy that environment for each new "secret" project.
Virtualenvwrapper
I will propose a simple way to achieve this with virtualenvwrapper
:
mkvirtualenv --python=/path/to/python _python_project_base
cp ~/my_secret_pip.conf $VIRTUAL_ENV/pip.conf
There, that was easy.
What this allows you to do is that when next you want to create a new project, instead of using mkvirtualenv
, you simply do:
cpvirtualenv _python_project_base new_virtual_env_name
setvirtualenvproject new_virtual_env_name /path/to/project_folder
And voila, the same pip.conf
follows you everywhere, and you don't have to worry about polluting your other config files outside the virtual environment.

- 39,374
- 15
- 132
- 179
copy your config file to /etc/pip.conf
this will make it apply for every user
There is a chance that your local user doesn't have read permissions on your pip.conf.
sudo chmod 644 /etc/pip.conf

- 11
- 1
For Windows, it can be found at %AppData%\Roaming\pip\pip.ini
(pip version 20.0.2)
Here are some other helpful answers for Windows users: Python - cant find pip.ini or pip.conf in Windows

- 5,927
- 1
- 28
- 45

- 46
- 5
I experienced the same issue. I was trying to install a venv on my allocation on a compute cluster system. What worked for me was to do the following before creating the venv.
unset PIP_CONFIG_FILE

- 181
- 1
- 1
- 13