View this page
Toggle table of contents sidebar
pip allows a user to change its behaviour via 3 mechanisms:
-
command line options
-
environment variables
-
configuration files
This page explains how the configuration files and environment variables work,
and how they are related to pip’s various command line options.
See also
pip config command, which helps manage pip’s configuration.
Configuration Files¶
Configuration files can change the default values for command line options.
The files are written using standard INI format.
pip has 3 “levels” of configuration files:
-
global: system-wide configuration file, shared across users. -
user: per-user configuration file. -
site: per-environment configuration file; i.e. per-virtualenv.
Additionally, environment variables can be specified which will override any of the above.
Location¶
pip’s configuration files are located in fairly standard locations. This
location is different on different operating systems, and has some additional
complexity for backwards compatibility reasons. Note that if user config files
exist in both the legacy and current locations, values in the current file
will override values in the legacy file.
Unix
- Global
-
In a “pip” subdirectory of any of the paths set in the environment variable
XDG_CONFIG_DIRS(if it exists), for example/etc/xdg/pip/pip.conf.This will be followed by loading
/etc/pip.conf. - User
-
$HOME/.config/pip/pip.conf, which respects theXDG_CONFIG_HOMEenvironment variable.The legacy “per-user” configuration file is also loaded, if it exists:
$HOME/.pip/pip.conf. - Site
-
$VIRTUAL_ENV/pip.conf
MacOS
- Global
-
/Library/Application Support/pip/pip.conf - User
-
$HOME/Library/Application Support/pip/pip.conf
if directory$HOME/Library/Application Support/pipexists
else$HOME/.config/pip/pip.confThe legacy “per-user” configuration file is also loaded, if it exists:
$HOME/.pip/pip.conf. - Site
-
$VIRTUAL_ENV/pip.conf
Windows
- Global
-
-
On Windows 7 and later:
C:\ProgramData\pip\pip.ini
(hidden but writeable) -
On Windows Vista: Global configuration is not supported.
-
On Windows XP:
C:\Documents and Settings\All Users\Application Data\pip\pip.ini
-
- User
-
%APPDATA%\pip\pip.iniThe legacy “per-user” configuration file is also loaded, if it exists:
%HOME%\pip\pip.ini - Site
-
%VIRTUAL_ENV%\pip.ini
PIP_CONFIG_FILE¶
Additionally, the environment variable PIP_CONFIG_FILE can be used to specify
a configuration file that’s loaded last, and whose values override the values
set in the aforementioned files. Setting this to os.devnull
disables the loading of all configuration files. Note that if a file exists
at the location that this is set to, the user config file will not be loaded.
Loading order¶
When multiple configuration files are found, pip combines them in the following
order:
-
Global
-
User
-
Site
-
PIP_CONFIG_FILE, if given.
Each file read overrides any values read from previous files, so if the
global timeout is specified in both the global file and the per-user file
then the latter value will be used.
Naming¶
The names of the settings are derived from the long command line option.
As an example, if you want to use a different package index (--index-url) and
set the HTTP timeout (--timeout) to 60 seconds, your config file would
look like this:
[global] timeout = 60 index-url = https://download.zope.org/ppix
Per-command section¶
Each subcommand can be configured optionally in its own section. This overrides
the global setting with the same name.
As an example, if you want to decrease the timeout to 10 seconds when
running the pip freeze, and use 60 seconds for all other commands:
[global] timeout = 60 [freeze] timeout = 10
Boolean options¶
Boolean options like --ignore-installed or --no-dependencies can be set
like this:
[install] ignore-installed = true no-dependencies = yes
To enable the boolean options --no-compile, --no-warn-script-location and
--no-cache-dir, falsy values have to be used:
[global] no-cache-dir = false [install] no-compile = no no-warn-script-location = false
Repeatable options¶
For options which can be repeated like --verbose and --quiet, a
non-negative integer can be used to represent the level to be specified:
[global] quiet = 0 verbose = 2
It is possible to append values to a section within a configuration file. This
is applicable to appending options like --find-links or --trusted-host,
which can be written on multiple lines:
[global] find-links = http://download.example.com [install] find-links = http://mirror1.example.com http://mirror2.example.com trusted-host = mirror1.example.com mirror2.example.com
This enables users to add additional values in the order of entry for such
command line arguments.
Environment Variables¶
pip’s command line options can be set with environment variables using the
format PIP_<UPPER_LONG_NAME> . Dashes (-) have to be replaced with
underscores (_).
-
PIP_TIMEOUT=60is the same as--timeout=60 -
PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com"
is the same as
--find-links=http://mirror1.example.com --find-links=http://mirror2.example.com
Repeatable options that do not take a value (such as --verbose) can be
specified using the number of repetitions:
-
PIP_VERBOSE=3is the same aspip install -vvv
Note
Environment variables set to an empty string (like with export X= on Unix) will not be treated as false.
Use no, false or 0 instead.
Precedence / Override order¶
Command line options override environment variables, which override the
values in a configuration file. Within the configuration file, values in
command-specific sections override values in the global section.
Examples:
-
--host=foooverridesPIP_HOST=foo -
PIP_HOST=foooverrides a config file with[global] host = foo -
A command specific section in the config file
[<command>] host = bar
overrides the option with same name in the[global]config file section.
Contents
- User Guide
- Installing Packages
- Requirements Files
- Constraints Files
- Installing from Wheels
- Uninstalling Packages
- Listing Packages
- Searching for Packages
- Configuration
- Config file
- Environment Variables
- Config Precedence
- Command Completion
- Installing from local packages
- «Only if needed» Recursive Upgrade
- User Installs
- Ensuring Repeatability
- Pinned Version Numbers
- Hash-checking Mode
- Installation Bundles
Installing Packages¶
pip supports installing from PyPI, version control, local projects, and
directly from distribution files.
The most common scenario is to install from PyPI using Requirement Specifiers
$ pip install SomePackage # latest version $ pip install SomePackage==1.0.4 # specific version $ pip install 'SomePackage>=1.0.4' # minimum version
For more information and examples, see the pip install reference.
Requirements Files¶
«Requirements files» are files containing a list of items to be
installed using pip install like so:
pip install -r requirements.txt
Details on the format of the files are here: Requirements File Format.
Logically, a Requirements file is just a list of pip install arguments
placed in a file. Note that you should not rely on the items in the file being
installed by pip in any particular order.
In practice, there are 4 common uses of Requirements files:
-
Requirements files are used to hold the result from pip freeze for the
purpose of achieving repeatable installations. In
this case, your requirement file contains a pinned version of everything that
was installed when pip freeze was run.pip freeze > requirements.txt pip install -r requirements.txt
-
Requirements files are used to force pip to properly resolve dependencies.
As it is now, pip doesn’t have true dependency resolution, but instead simply uses the first
specification it finds for a project. E.g if pkg1 requires pkg3>=1.0 and
pkg2 requires pkg3>=1.0,<=2.0, and if pkg1 is resolved first, pip will
only use pkg3>=1.0, and could easily end up installing a version of pkg3
that conflicts with the needs of pkg2. To solve this problem, you can
place pkg3>=1.0,<=2.0 (i.e. the correct specification) into your
requirements file directly along with the other top level requirements. Like
so:pkg1 pkg2 pkg3>=1.0,<=2.0
-
Requirements files are used to force pip to install an alternate version of a
sub-dependency. For example, suppose ProjectA in your requirements file
requires ProjectB, but the latest version (v1.3) has a bug, you can force
pip to accept earlier versions like so: -
Requirements files are used to override a dependency with a local patch that
lives in version control. For example, suppose a dependency,
SomeDependency from PyPI has a bug, and you can’t wait for an upstream fix.
You could clone/copy the src, make the fix, and place it in VCS with the tag
sometag. You’d reference it in your requirements file with a line like so:git+https://myvcs.com/some_dependency@sometag#egg=SomeDependency
If SomeDependency was previously a top-level requirement in your
requirements file, then replace that line with the new line. If
SomeDependency is a sub-dependency, then add the new line.
It’s important to be clear that pip determines package dependencies using
install_requires metadata,
not by discovering requirements.txt files embedded in projects.
See also:
- Requirements File Format
- pip freeze
- «setup.py vs requirements.txt» (an article by Donald Stufft)
Constraints Files¶
Constraints files are requirements files that only control which version of a
requirement is installed, not whether it is installed or not. Their syntax and
contents is nearly identical to Requirements Files. There is one key
difference: Including a package in a constraints file does not trigger
installation of the package.
Use a constraints file like so:
pip install -c constraints.txt
Constraints files are used for exactly the same reason as requirements files
when you don’t know exactly what things you want to install. For instance, say
that the «helloworld» package doesn’t work in your environment, so you have a
local patched version. Some things you install depend on «helloworld», and some
don’t.
One way to ensure that the patched version is used consistently is to
manually audit the dependencies of everything you install, and if «helloworld»
is present, write a requirements file to use when installing that thing.
Constraints files offer a better way: write a single constraints file for your
organisation and use that everywhere. If the thing being installed requires
«helloworld» to be installed, your fixed version specified in your constraints
file will be used.
Constraints file support was added in pip 7.1.
Installing from Wheels¶
«Wheel» is a built, archive format that can greatly speed installation compared
to building and installing from source archives. For more information, see the
Wheel docs ,
PEP427, and
PEP425
Pip prefers Wheels where they are available. To disable this, use the
—no-binary flag for pip install.
If no satisfactory wheels are found, pip will default to finding source archives.
To install directly from a wheel archive:
pip install SomePackage-1.0-py2.py3-none-any.whl
For the cases where wheels are not available, pip offers pip wheel as a
convenience, to build wheels for all your requirements and dependencies.
pip wheel requires the wheel package to be installed, which provides the
«bdist_wheel» setuptools extension that it uses.
To build wheels for your requirements and all their dependencies to a local directory:
pip install wheel pip wheel --wheel-dir=/local/wheels -r requirements.txt
And then to install those requirements just using your local directory of wheels (and not from PyPI):
pip install --no-index --find-links=/local/wheels -r requirements.txt
Uninstalling Packages¶
pip is able to uninstall most packages like so:
$ pip uninstall SomePackage
pip also performs an automatic uninstall of an old version of a package
before upgrading to a newer version.
For more information and examples, see the pip uninstall reference.
Listing Packages¶
To list installed packages:
$ pip list docutils (0.9.1) Jinja2 (2.6) Pygments (1.5) Sphinx (1.1.2)
To list outdated packages, and show the latest version available:
$ pip list --outdated docutils (Current: 0.9.1 Latest: 0.10) Sphinx (Current: 1.1.2 Latest: 1.1.3)
To show details about an installed package:
$ pip show sphinx --- Name: Sphinx Version: 1.1.3 Location: /my/env/lib/pythonx.x/site-packages Requires: Pygments, Jinja2, docutils
For more information and examples, see the pip list and pip show
reference pages.
Searching for Packages¶
pip can search PyPI for packages using the pip search
command:
The query will be used to search the names and summaries of all
packages.
For more information and examples, see the pip search reference.
Configuration¶
Config file¶
pip allows you to set all command line option defaults in a standard ini
style config file.
The names and locations of the configuration files vary slightly across
platforms. You may have per-user, per-virtualenv or site-wide (shared amongst
all users) configuration:
Per-user:
- On Unix the default configuration file is:
$HOME/.config/pip/pip.conf
which respects theXDG_CONFIG_HOMEenvironment variable. - On macOS the configuration file is
$HOME/Library/Application Support/pip/pip.conf. - On Windows the configuration file is
%APPDATA%\pip\pip.ini.
There are also a legacy per-user configuration file which is also respected,
these are located at:
- On Unix and macOS the configuration file is:
$HOME/.pip/pip.conf - On Windows the configuration file is:
%HOME%\pip\pip.ini
You can set a custom path location for this config file using the environment
variable PIP_CONFIG_FILE.
Inside a virtualenv:
- On Unix and macOS the file is
$VIRTUAL_ENV/pip.conf - On Windows the file is:
%VIRTUAL_ENV%\pip.ini
Site-wide:
- On Unix the file may be located in
/etc/pip.conf. Alternatively
it may be in a «pip» subdirectory of any of the paths set in the
environment variableXDG_CONFIG_DIRS(if it exists), for example
/etc/xdg/pip/pip.conf. - On macOS the file is:
/Library/Application Support/pip/pip.conf - On Windows XP the file is:
C:\Documents and Settings\All Users\Application Data\pip\pip.ini - On Windows 7 and later the file is hidden, but writeable at
C:\ProgramData\pip\pip.ini - Site-wide configuration is not supported on Windows Vista
If multiple configuration files are found by pip then they are combined in
the following order:
- Firstly the site-wide file is read, then
- The per-user file is read, and finally
- The virtualenv-specific file is read.
Each file read overrides any values read from previous files, so if the
global timeout is specified in both the site-wide file and the per-user file
then the latter value is the one that will be used.
The names of the settings are derived from the long command line option, e.g.
if you want to use a different package index (--index-url) and set the
HTTP timeout (--default-timeout) to 60 seconds your config file would
look like this:
[global] timeout = 60 index-url = http://download.zope.org/ppix
Each subcommand can be configured optionally in its own section so that every
global setting with the same name will be overridden; e.g. decreasing the
timeout to 10 seconds when running the freeze
(Freezing Requirements) command and using
60 seconds for all other commands is possible with:
[global] timeout = 60 [freeze] timeout = 10
Boolean options like --ignore-installed or --no-dependencies can be
set like this:
[install] ignore-installed = true no-dependencies = yes
To enable the boolean options --no-compile and --no-cache-dir, falsy
values have to be used:
[global] no-cache-dir = false [install] no-compile = no
Appending options like --find-links can be written on multiple lines:
[global] find-links = http://download.example.com [install] find-links = http://mirror1.example.com http://mirror2.example.com
Environment Variables¶
pip’s command line options can be set with environment variables using the
format PIP_<UPPER_LONG_NAME> . Dashes (-) have to be replaced with
underscores (_).
For example, to set the default timeout:
export PIP_DEFAULT_TIMEOUT=60
This is the same as passing the option to pip directly:
pip --default-timeout=60 [...]
To set options that can be set multiple times on the command line, just add
spaces in between values. For example:
export PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com"
is the same as calling:
pip install --find-links=http://mirror1.example.com --find-links=http://mirror2.example.com
Config Precedence¶
Command line options have precedence over environment variables, which have precedence over the config file.
Within the config file, command specific sections have precedence over the global section.
Examples:
--host=foooverridesPIP_HOST=fooPIP_HOST=foooverrides a config file with[global] host = foo- A command specific section in the config file
[<command>] host = bar
overrides the option with same name in the[global]config file section
Command Completion¶
pip comes with support for command line completion in bash, zsh and fish.
To setup for bash:
$ pip completion --bash >> ~/.profile
To setup for zsh:
$ pip completion --zsh >> ~/.zprofile
To setup for fish:
$ pip completion --fish > ~/.config/fish/completions/pip.fish
Alternatively, you can use the result of the completion command
directly with the eval function of your shell, e.g. by adding the following to your startup file:
eval "`pip completion --bash`"
Installing from local packages¶
In some cases, you may want to install from local packages only, with no traffic
to PyPI.
First, download the archives that fulfill your requirements:
$ pip install --download DIR -r requirements.txt
Note that pip install --download will look in your wheel cache first, before
trying to download from PyPI. If you’ve never installed your requirements
before, you won’t have a wheel cache for those items. In that case, if some of
your requirements don’t come as wheels from PyPI, and you want wheels, then run
this instead:
$ pip wheel --wheel-dir DIR -r requirements.txt
Then, to install from local only, you’ll be using —find-links and —no-index like so:
$ pip install --no-index --find-links=DIR -r requirements.txt
«Only if needed» Recursive Upgrade¶
pip install --upgrade is currently written to perform an eager recursive
upgrade, i.e. it upgrades all dependencies regardless of whether they still
satisfy the new parent requirements.
E.g. supposing:
- SomePackage-1.0 requires AnotherPackage>=1.0
- SomePackage-2.0 requires AnotherPackage>=1.0 and OneMorePackage==1.0
- SomePackage-1.0 and AnotherPackage-1.0 are currently installed
- SomePackage-2.0 and AnotherPackage-2.0 are the latest versions available on PyPI.
Running pip install --upgrade SomePackage would upgrade SomePackage and
AnotherPackage despite AnotherPackage already being satisfied.
pip doesn’t currently have an option to do an «only if needed» recursive
upgrade, but you can achieve it using these 2 steps:
pip install --upgrade --no-deps SomePackage pip install SomePackage
The first line will upgrade SomePackage, but not dependencies like
AnotherPackage. The 2nd line will fill in new dependencies like
OneMorePackage.
See #59 for a plan of making «only if needed» recursive the default
behavior for a new pip upgrade command.
User Installs¶
With Python 2.6 came the «user scheme» for installation,
which means that all Python distributions support an alternative install
location that is specific to a user. The default location for each OS is
explained in the python documentation for the site.USER_BASE variable. This mode
of installation can be turned on by specifying the —user option to pip install.
Moreover, the «user scheme» can be customized by setting the
PYTHONUSERBASE environment variable, which updates the value of site.USER_BASE.
To install «SomePackage» into an environment with site.USER_BASE customized to ‘/myappenv’, do the following:
export PYTHONUSERBASE=/myappenv pip install --user SomePackage
pip install --user follows four rules:
- When globally installed packages are on the python path, and they conflict
with the installation requirements, they are ignored, and not
uninstalled. - When globally installed packages are on the python path, and they satisfy
the installation requirements, pip does nothing, and reports that
requirement is satisfied (similar to how global packages can satisfy
requirements when installing packages in a--system-site-packages
virtualenv). - pip will not perform a
--userinstall in a--no-site-packages
virtualenv (i.e. the default kind of virtualenv), due to the user site not
being on the python path. The installation would be pointless. - In a
--system-site-packagesvirtualenv, pip will not install a package
that conflicts with a package in the virtualenv site-packages. The —user
installation would lack sys.path precedence and be pointless.
To make the rules clearer, here are some examples:
From within a --no-site-packages virtualenv (i.e. the default kind):
$ pip install --user SomePackage Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
From within a --system-site-packages virtualenv where SomePackage==0.3 is already installed in the virtualenv:
$ pip install --user SomePackage==0.4 Will not install to the user site because it will lack sys.path precedence
From within a real python, where SomePackage is not installed globally:
$ pip install --user SomePackage [...] Successfully installed SomePackage
From within a real python, where SomePackage is installed globally, but is not the latest version:
$ pip install --user SomePackage [...] Requirement already satisfied (use --upgrade to upgrade) $ pip install --user --upgrade SomePackage [...] Successfully installed SomePackage
From within a real python, where SomePackage is installed globally, and is the latest version:
$ pip install --user SomePackage [...] Requirement already satisfied (use --upgrade to upgrade) $ pip install --user --upgrade SomePackage [...] Requirement already up-to-date: SomePackage # force the install $ pip install --user --ignore-installed SomePackage [...] Successfully installed SomePackage
Ensuring Repeatability¶
pip can achieve various levels of repeatability:
Pinned Version Numbers¶
Pinning the versions of your dependencies in the requirements file
protects you from bugs or incompatibilities in newly released versions:
SomePackage == 1.2.3 DependencyOfSomePackage == 4.5.6
Using pip freeze to generate the requirements file will ensure that not
only the top-level dependencies are included but their sub-dependencies as
well, and so on. Perform the installation using —no-deps for an extra dose of insurance against installing
anything not explicitly listed.
This strategy is easy to implement and works across OSes and architectures.
However, it trusts PyPI and the certificate authority chain. It
also relies on indices and find-links locations not allowing
packages to change without a version increase. (PyPI does protect
against this.)
Hash-checking Mode¶
Beyond pinning version numbers, you can add hashes against which to verify
downloaded packages:
FooProject == 1.2 --hash=sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
This protects against a compromise of PyPI or the HTTPS
certificate chain. It also guards against a package changing
without its version number changing (on indexes that allow this).
This approach is a good fit for automated server deployments.
Hash-checking mode is a labor-saving alternative to running a private index
server containing approved packages: it removes the need to upload packages,
maintain ACLs, and keep an audit trail (which a VCS gives you on the
requirements file for free). It can also substitute for a vendor library,
providing easier upgrades and less VCS noise. It does not, of course,
provide the availability benefits of a private index or a vendor library.
For more, see pip install’s discussion of hash-checking mode.
Installation Bundles¶
Using pip wheel, you can bundle up all of a project’s dependencies, with
any compilation done, into a single archive. This allows installation when
index servers are unavailable and avoids time-consuming recompilation. Create
an archive like this:
$ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX) $ pip wheel -r requirements.txt --wheel-dir=$tempdir $ cwd=`pwd` $ (cd "$tempdir"; tar -cjvf "$cwd/bundled.tar.bz2" *)
You can then install from the archive like this:
$ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX) $ (cd $tempdir; tar -xvf /path/to/bundled.tar.bz2) $ pip install --force-reinstall --ignore-installed --upgrade --no-index --no-deps $tempdir/*
Note that compiled packages are typically OS- and architecture-specific, so
these archives are not necessarily portable across machines.
Hash-checking mode can be used along with this method to ensure that future
archives are built with identical packages.
Warning
Finally, beware of the setup_requires keyword arg in setup.py.
The (rare) packages that use it will cause those dependencies to be
downloaded by setuptools directly, skipping pip’s protections. If you need
to use such a package, see Controlling
setup_requires.
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Sign up
Appearance settings
Money and Business
I updated pip to 9.0.1 and now I get a warning message in the pip list command.
DEPRECATION: The default format will switch to columns in the future. You can use –format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
As the message says, if you add the option to specify the format as follows, there will be no warning.pip list --format=columns
However, it is too much trouble to add it every time, so add it to the following configuration file.
pip.conf(Unix, macOS)pip.ini(Windows)
- Location of the pip configuration file
pip.conf,pip.ini pip.conf,pip.iniWhat to add to the file
Table of Contents
- Location of the pip.conf and pip.ini configuration files
- What to add to pip.conf and pip.ini
- legacy
- columns
- freeze
- json
Location of the pip.conf and pip.ini configuration files
The location of the pip configuration file pip.conf (pip.ini on Windows) is as follows. If the configuration file does not exist, create a new one.
- User Guide — pip 9.0.1 documentation
It depends on Unix, macOS, and Windows.
- Unix
$HOME/.config/pip/pip.conf- legacy:
$HOME/.pip/pip.conf - virtualenv:
$VIRTUAL_ENV/pip.conf
- macOS
$HOME/Library/Application Support/pip/pip.conf- legacy:
$HOME/.pip/pip.conf - virtualenv:
$VIRTUAL_ENV/pip.conf
- Windows
%APPDATA%\pip\pip.ini- legacy:
%HOME%\pip\pip.ini - virtualenv:
%VIRTUAL_ENV%\pip.ini
What to add to pip.conf and pip.ini
Add the following to the configuration file.
[list]
format = <list_format>
There are four choices for <list_format>.
legacycolumnsfreezejson
Choose the one you like.
legacy
Display as before.
colorama (0.3.7)
docopt (0.6.2)
idlex (1.13)
jedi (0.9.0)
columns
Package Version
--------- -------
colorama 0.3.7
docopt 0.6.2
idlex 1.13
jedi 0.9.0
freeze
colorama==0.3.7
docopt==0.6.2
idlex==1.13
jedi==0.9.0
json
[{'name': 'colorama', 'version': '0.3.7'}, {'name': 'docopt', 'version': '0.6.2'}, ...
Create pip.conf and remove the pip list warning
- Configuration
- Location of pip.conf file
- Pip config
- Set pip config file in windows and basic configurations
- PIP_CONFIG_FILE is used instead of per-user configuration file #10643
- Pip config¶
- Pip config¶
- Where on Windows 10 is pip.conf or pip.ini located? #4206
Configuration
PIP_CONFIG_FILE, if given. Global. User. Site. Each file read overrides any
values read from previous files, so if the global timeout is specified in both
the global file and the per-user file then the latter value will be used.
Naming# The names of the settings are derived from the long command line
option.
[global]
timeout = 60
index-url = https://download.zope.org/ppix
[global]
timeout = 60
[freeze]
timeout = 10
[install]
ignore-installed = true
no-dependencies = yes
[global]
no-cache-dir = false
[install]
no-compile = no
no-warn-script-location = false
[global]
quiet = 0
verbose = 2
[global]
find-links =
http://download.example.com
[install]
find-links =
http://mirror1.example.com
http://mirror2.example.com
trusted-host =
mirror1.example.com
mirror2.example.com
PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com"
--find-links=http://mirror1.example.com --find-links=http://mirror2.example.com
Location of pip.conf file
13. 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. …
myproject/build/venv/Include
/Lib
/Scripts
pip config debug
Pip config
debug: List the configuration files and values defined under them.
Configuration keys should be dot separated command and option name, with the
special prefix “global” affecting any …
python -m pip config [<file-option>] list
python -m pip config [<file-option>] [--editor <editor-path>] edit
python -m pip config [<file-option>] get command.option
python -m pip config [<file-option>] set command.option value
python -m pip config [<file-option>] unset command.option
python -m pip config [<file-option>] debug
py -m pip config [<file-option>] list
py -m pip config [<file-option>] [--editor <editor-path>] edit
py -m pip config [<file-option>] get command.option
py -m pip config [<file-option>] set command.option value
py -m pip config [<file-option>] unset command.option
py -m pip config [<file-option>] debug
Set pip config file in windows and basic configurations
This directory may not exist, if so, then create one manually. here are some
common configurations that I add to the config file. [global] trusted-host =
5.6.7.8 pypi.org …
[global]
trusted-host = 5.6.7.8 pypi.org files.pythonhosted.org
proxy = 8.7.8.7:8080
$ pip config list
global.proxy='8.7.8.7:8080'
global.trusted-host='5.6.7.8 pypi.org files.pythonhosted.org'
PIP_CONFIG_FILE is used instead of per-user configuration file #10643
Description. I’ve been playing with pip and its configuration files. From what
I’ve read in documentation: and the PIP_CONFIG_FILE file is the 1st loaded
file. Now, if i define …
# Show all config files and their values.
# $PIP_CONFIG_FILE is not defined
pip config debug
# For variant 'global', will try loading '/Library/Application Support/pip/pip.conf'
# For variant 'user', will try loading '$HOME/.pip/pip.conf'
# For variant 'user', will try loading '$HOME/.config/pip/pip.conf'
# For variant 'site', will try loading '/Library/Frameworks/Python.framework/Versions/3.10/pip.conf'
# env_var:
# env:
# global:
# /Library/Application Support/pip/pip.conf, exists: True
# global.verbose: true
# global.retries: 20
# global.no-cache-dir: true
# list.not-required: true
# site:
# /Library/Frameworks/Python.framework/Versions/3.10/pip.conf, exists: False
# user:
# $HOME/.pip/pip.conf, exists: False
# $HOME/.config/pip/pip.conf, exists: True
# global.no-cache-dir: false
# install.no-deps: true
# Set PIP_CONFIG_FILE
export PIP_CONFIG_FILE="$HOME/Documents/pip.conf"
# Show config files.
pip config debug
# For variant 'env', will try loading '$HOME/Documents/pip.conf'
# For variant 'global', will try loading '/Library/Application Support/pip/pip.conf'
# For variant 'site', will try loading '/Library/Frameworks/Python.framework/Versions/3.10/pip.conf'
# env_var:
# PIP_CONFIG_FILE='$HOME/Documents/pip.conf'
# env:
# $HOME/Documents/pip.conf, exists: True
# global.retries: 10
# show.files: true
# global:
# /Library/Application Support/pip/pip.conf, exists: True
# global.verbose: true
# global.retries: 20
# global.no-cache-dir: true
# list.not-required: true
# site:
# /Library/Frameworks/Python.framework/Versions/3.10/pip.conf, exists: False
# Show user configuration.
pip config --user list
# :env:.config-file='$HOME/Documents/pip.conf'
# Show all config files.
# PIP_CONFIG_FILE is not set.
pip config debug
# env_var:
# env:
# global:
# C:\ProgramData\pip\pip.ini, exists: False
# site:
# %USERPROFILE%\AppData\Local\Programs\Python\Python310\pip.ini, exists: False
# user:
# %USERPROFILE%\pip\pip.ini, exists: False
# %USERPROFILE%\AppData\Roaming\pip\pip.ini, exists: True
# general.verbose: true
# Set PIP_CONFIG_FILE
$env:PIP_CONFIG_FILE = "$env:USERPROFILE\Documents\pip.ini"
# Show all config files.
pip config debug
# env_var:
# PIP_CONFIG_FILE='%USERPROFILE%\\Documents\\pip.ini'
# env:
# %USERPROFILE%\Documents\pip.ini, exists: True
# global:
# C:\ProgramData\pip\pip.ini, exists: False
# site:
# %USERPROFILE%\AppData\Local\Programs\Python\Python310\pip.ini, exists: False
# Show user settings.
pip config --user list
# :env:.config-file='%USERPROFILE%\\Documents\\pip.ini'
If `PIP_CONFIG_FILE` is set to an existing file, the user configuration
is currently not loaded. This commit changes this behavior, so that the
user configuration will be loaded either way.
This adheres to the
[documentation](https://github.com/pypa/pip/blame/f66b3e8d0168990e35f981e77b6abe6a6974c4ee/docs/html/topics/configuration.md#L84-L105)
and fixes pypa#10643.
Implementing tests for this is currently not possible without more
monkey patching methods, which would have to allow us to load temporary
files for config files with fixed paths.
Pip config¶
python-m pip config [< file-option >] list python-m pip config [< file-option
>] [—editor < editor-path >] List the configuration files and values defined
under them. If none of —user, — …
python -m pip config [<file-option>] list
python -m pip config [<file-option>] [--editor <editor-path>] edit
python -m pip config [<file-option>] get name
python -m pip config [<file-option>] set name value
python -m pip config [<file-option>] unset name
python -m pip config [<file-option>] debug
py -m pip config [<file-option>] list
py -m pip config [<file-option>] [--editor <editor-path>] edit
py -m pip config [<file-option>] get name
py -m pip config [<file-option>] set name value
py -m pip config [<file-option>] unset name
py -m pip config [<file-option>] debug
Pip config¶
Editor to use to edit the file. Uses VISUAL or EDITOR environment variables if
not provided.—global¶ Use the system-wide configuration file only—user¶ Use
the user configuration file …
pip config [<file-option>] list
pip config [<file-option>] [--editor <editor-path>] edit
pip config [<file-option>] get name
pip config [<file-option>] set name value
pip config [<file-option>] unset name
Where on Windows 10 is pip.conf or pip.ini located? #4206
To check which config file is being looked at run: pip config —editor
pathtoeditorofyourchoice edit, this will open the linked ini file. If it
doesnt exist, the Editor …
λ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
