Is it possible to get pip to print the configuration it is using?
Is there any way to get pip to print the config it will attempt to use? For debugging purposes it would be very nice to know that:
- config.ini files are in the correct place and pip is finding them.
- The precedence of the config settings is treated in the way one would expect from the docs
python pip
add a comment |
Is there any way to get pip to print the config it will attempt to use? For debugging purposes it would be very nice to know that:
- config.ini files are in the correct place and pip is finding them.
- The precedence of the config settings is treated in the way one would expect from the docs
python pip
do you mean the pip.conf files?
– A. L. Flanagan
Jun 22 '16 at 16:20
1
Yes, the Windows equivalent to the pip.conf file is a config.ini file in a parent directory called 'pip'.
– Alexander
Jun 23 '16 at 9:18
add a comment |
Is there any way to get pip to print the config it will attempt to use? For debugging purposes it would be very nice to know that:
- config.ini files are in the correct place and pip is finding them.
- The precedence of the config settings is treated in the way one would expect from the docs
python pip
Is there any way to get pip to print the config it will attempt to use? For debugging purposes it would be very nice to know that:
- config.ini files are in the correct place and pip is finding them.
- The precedence of the config settings is treated in the way one would expect from the docs
python pip
python pip
edited Jun 22 '16 at 15:30


Moses Koledoye
62k75876
62k75876
asked Apr 12 '16 at 9:45
AlexanderAlexander
393716
393716
do you mean the pip.conf files?
– A. L. Flanagan
Jun 22 '16 at 16:20
1
Yes, the Windows equivalent to the pip.conf file is a config.ini file in a parent directory called 'pip'.
– Alexander
Jun 23 '16 at 9:18
add a comment |
do you mean the pip.conf files?
– A. L. Flanagan
Jun 22 '16 at 16:20
1
Yes, the Windows equivalent to the pip.conf file is a config.ini file in a parent directory called 'pip'.
– Alexander
Jun 23 '16 at 9:18
do you mean the pip.conf files?
– A. L. Flanagan
Jun 22 '16 at 16:20
do you mean the pip.conf files?
– A. L. Flanagan
Jun 22 '16 at 16:20
1
1
Yes, the Windows equivalent to the pip.conf file is a config.ini file in a parent directory called 'pip'.
– Alexander
Jun 23 '16 at 9:18
Yes, the Windows equivalent to the pip.conf file is a config.ini file in a parent directory called 'pip'.
– Alexander
Jun 23 '16 at 9:18
add a comment |
3 Answers
3
active
oldest
votes
For 10.0.x and higher
There is new pip config
command, to list current configuration values
pip config list
(As pointed by @wmaddox in comments) To get the list of where pip looks for config files
pip config list -v
Pre 10.0.x
You can start python console and do. (If you have virtaulenv don't forget to activate it first)
from pip import create_main_parser
parser = create_main_parser()
# print all config files that it will try to read
print(parser.files)
# reads parser files that are actually found and prints their names
print(parser.config.read(parser.files))
create_main_parser
is function that creates parser
which pip uses to read params from command line(optparse
) and loading configs(configparser
)
Possible file names for configurations are generated in get_config_files
. Including PIP_CONFIG_FILE
environment variable if it set.
parser.config
is instance of RawConfigParser
so all generated file names in get_config_files
are passed to parser.config.read
.
Attempt to read and parse a list of filenames, returning a list of filenames which were successfully parsed. If filenames is a string, it is treated as a single filename. If a file named in filenames cannot be opened, that file will be ignored. This is designed so that you can specify a list of potential configuration file locations (for example, the current directory, the user’s home directory, and some system-wide directory), and all existing configuration files in the list will be read. If none of the named files exist, the ConfigParser instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using read_file() before calling read() for any optional files:
1
I think this is useful but it seems to just print the files it would potentially use. For example, if I run this on my Mac I get['/Library/Application Support/pip/pip.conf', '/Users/myuser/.pip/pip.conf', '/Users/myuser/Library/Application Support/pip/pip.conf']
but none of those files actually exist. Is there some logging or anything that would have pip print out the files it's trying to read and whether or not it was successful in doing so?
– FGreg
Jun 22 '16 at 18:14
@FGreg I extend my answer. I have some questions for you. How are you trying to pass yourconfig.ini
?get_config_files
readsPIP_CONFIG_FILE
environment variable, are you setting it properly? Are you using virtualenv?
– Sardorbek Imomaliev
Jun 22 '16 at 18:54
I'm trying to figure out if it is using a pip.conf, pip.ini, conf.ini, etc... and if so where is it located. Your updates seem to cover what i was looking for; thanks.
– FGreg
Jun 23 '16 at 15:50
With example above this can easily be converted into script. Which can be ran to show information you want.
– Sardorbek Imomaliev
Jun 24 '16 at 16:05
Good to note...pip search
seems to always use PyPi.org, even when your pip.conf is correctly configured to use a private mirror. I wasted an embarrassingly long period of time on this earlier today trying to debug a problem.
– Brian M. Carr
Apr 25 '18 at 11:53
|
show 1 more comment
From how I see it, your question can be interpreted in three ways:
- What is the configuration of the pip executable?
There is a quite extensive documentation for the configurations supported by pip, see here: https://pip.pypa.io/en/stable/user_guide/#configuration
- What is the configuration that pip uses when configuring and subsequently building code required by a Python module?
This is specified by the package that is being installed. The package maintainer is responsible for producing a configuration script. For example, Numpy has a Configuration class (https://github.com/numpy/numpy/blob/master/numpy/distutils/misc_util.py) that they use to configure their Cython build.
- What are the current modules installed with pip so I can reproduce a specific environment configuration?
This is easy, pip freeze > requirements.txt
. This will produce a file of all currently installed pip modules along with their exact versions. You can then do pip install -r requirements.txt
to reproduce that exact environment configuration on another machine.
I hope this helps.
add a comment |
You can run pip in pdb. Here's an example inside ipython:
>>> import pip
>>> import pdb
>>> pdb.run("pip.main()", globals())
(Pdb) s
--Call--
> /usr/lib/python3.5/site-packages/pip/__init__.py(197)main()
-> def main(args=None):
(Pdb) b /usr/lib/python3.5/site-packages/pip/baseparser.py:146
Breakpoint 1 at /usr/lib/python3.5/site-packages/pip/baseparser.py:146
(Pdb) c
> /usr/lib/python3.5/site-packages/pip/baseparser.py(146)__init__()
-> if self.files:
(Pdb) p self.files
['/etc/xdg/pip/pip.conf', '/etc/pip.conf', '/home/andre/.pip/pip.conf', '/home/andre/.config/pip/pip.conf']
The only trick here was looking up the path of the baseparser (and knowing that the files are in there). If you don't know this already you can simply step through the program or read the source. This type of exploration should work for most Python programs.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36569511%2fis-it-possible-to-get-pip-to-print-the-configuration-it-is-using%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
For 10.0.x and higher
There is new pip config
command, to list current configuration values
pip config list
(As pointed by @wmaddox in comments) To get the list of where pip looks for config files
pip config list -v
Pre 10.0.x
You can start python console and do. (If you have virtaulenv don't forget to activate it first)
from pip import create_main_parser
parser = create_main_parser()
# print all config files that it will try to read
print(parser.files)
# reads parser files that are actually found and prints their names
print(parser.config.read(parser.files))
create_main_parser
is function that creates parser
which pip uses to read params from command line(optparse
) and loading configs(configparser
)
Possible file names for configurations are generated in get_config_files
. Including PIP_CONFIG_FILE
environment variable if it set.
parser.config
is instance of RawConfigParser
so all generated file names in get_config_files
are passed to parser.config.read
.
Attempt to read and parse a list of filenames, returning a list of filenames which were successfully parsed. If filenames is a string, it is treated as a single filename. If a file named in filenames cannot be opened, that file will be ignored. This is designed so that you can specify a list of potential configuration file locations (for example, the current directory, the user’s home directory, and some system-wide directory), and all existing configuration files in the list will be read. If none of the named files exist, the ConfigParser instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using read_file() before calling read() for any optional files:
1
I think this is useful but it seems to just print the files it would potentially use. For example, if I run this on my Mac I get['/Library/Application Support/pip/pip.conf', '/Users/myuser/.pip/pip.conf', '/Users/myuser/Library/Application Support/pip/pip.conf']
but none of those files actually exist. Is there some logging or anything that would have pip print out the files it's trying to read and whether or not it was successful in doing so?
– FGreg
Jun 22 '16 at 18:14
@FGreg I extend my answer. I have some questions for you. How are you trying to pass yourconfig.ini
?get_config_files
readsPIP_CONFIG_FILE
environment variable, are you setting it properly? Are you using virtualenv?
– Sardorbek Imomaliev
Jun 22 '16 at 18:54
I'm trying to figure out if it is using a pip.conf, pip.ini, conf.ini, etc... and if so where is it located. Your updates seem to cover what i was looking for; thanks.
– FGreg
Jun 23 '16 at 15:50
With example above this can easily be converted into script. Which can be ran to show information you want.
– Sardorbek Imomaliev
Jun 24 '16 at 16:05
Good to note...pip search
seems to always use PyPi.org, even when your pip.conf is correctly configured to use a private mirror. I wasted an embarrassingly long period of time on this earlier today trying to debug a problem.
– Brian M. Carr
Apr 25 '18 at 11:53
|
show 1 more comment
For 10.0.x and higher
There is new pip config
command, to list current configuration values
pip config list
(As pointed by @wmaddox in comments) To get the list of where pip looks for config files
pip config list -v
Pre 10.0.x
You can start python console and do. (If you have virtaulenv don't forget to activate it first)
from pip import create_main_parser
parser = create_main_parser()
# print all config files that it will try to read
print(parser.files)
# reads parser files that are actually found and prints their names
print(parser.config.read(parser.files))
create_main_parser
is function that creates parser
which pip uses to read params from command line(optparse
) and loading configs(configparser
)
Possible file names for configurations are generated in get_config_files
. Including PIP_CONFIG_FILE
environment variable if it set.
parser.config
is instance of RawConfigParser
so all generated file names in get_config_files
are passed to parser.config.read
.
Attempt to read and parse a list of filenames, returning a list of filenames which were successfully parsed. If filenames is a string, it is treated as a single filename. If a file named in filenames cannot be opened, that file will be ignored. This is designed so that you can specify a list of potential configuration file locations (for example, the current directory, the user’s home directory, and some system-wide directory), and all existing configuration files in the list will be read. If none of the named files exist, the ConfigParser instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using read_file() before calling read() for any optional files:
1
I think this is useful but it seems to just print the files it would potentially use. For example, if I run this on my Mac I get['/Library/Application Support/pip/pip.conf', '/Users/myuser/.pip/pip.conf', '/Users/myuser/Library/Application Support/pip/pip.conf']
but none of those files actually exist. Is there some logging or anything that would have pip print out the files it's trying to read and whether or not it was successful in doing so?
– FGreg
Jun 22 '16 at 18:14
@FGreg I extend my answer. I have some questions for you. How are you trying to pass yourconfig.ini
?get_config_files
readsPIP_CONFIG_FILE
environment variable, are you setting it properly? Are you using virtualenv?
– Sardorbek Imomaliev
Jun 22 '16 at 18:54
I'm trying to figure out if it is using a pip.conf, pip.ini, conf.ini, etc... and if so where is it located. Your updates seem to cover what i was looking for; thanks.
– FGreg
Jun 23 '16 at 15:50
With example above this can easily be converted into script. Which can be ran to show information you want.
– Sardorbek Imomaliev
Jun 24 '16 at 16:05
Good to note...pip search
seems to always use PyPi.org, even when your pip.conf is correctly configured to use a private mirror. I wasted an embarrassingly long period of time on this earlier today trying to debug a problem.
– Brian M. Carr
Apr 25 '18 at 11:53
|
show 1 more comment
For 10.0.x and higher
There is new pip config
command, to list current configuration values
pip config list
(As pointed by @wmaddox in comments) To get the list of where pip looks for config files
pip config list -v
Pre 10.0.x
You can start python console and do. (If you have virtaulenv don't forget to activate it first)
from pip import create_main_parser
parser = create_main_parser()
# print all config files that it will try to read
print(parser.files)
# reads parser files that are actually found and prints their names
print(parser.config.read(parser.files))
create_main_parser
is function that creates parser
which pip uses to read params from command line(optparse
) and loading configs(configparser
)
Possible file names for configurations are generated in get_config_files
. Including PIP_CONFIG_FILE
environment variable if it set.
parser.config
is instance of RawConfigParser
so all generated file names in get_config_files
are passed to parser.config.read
.
Attempt to read and parse a list of filenames, returning a list of filenames which were successfully parsed. If filenames is a string, it is treated as a single filename. If a file named in filenames cannot be opened, that file will be ignored. This is designed so that you can specify a list of potential configuration file locations (for example, the current directory, the user’s home directory, and some system-wide directory), and all existing configuration files in the list will be read. If none of the named files exist, the ConfigParser instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using read_file() before calling read() for any optional files:
For 10.0.x and higher
There is new pip config
command, to list current configuration values
pip config list
(As pointed by @wmaddox in comments) To get the list of where pip looks for config files
pip config list -v
Pre 10.0.x
You can start python console and do. (If you have virtaulenv don't forget to activate it first)
from pip import create_main_parser
parser = create_main_parser()
# print all config files that it will try to read
print(parser.files)
# reads parser files that are actually found and prints their names
print(parser.config.read(parser.files))
create_main_parser
is function that creates parser
which pip uses to read params from command line(optparse
) and loading configs(configparser
)
Possible file names for configurations are generated in get_config_files
. Including PIP_CONFIG_FILE
environment variable if it set.
parser.config
is instance of RawConfigParser
so all generated file names in get_config_files
are passed to parser.config.read
.
Attempt to read and parse a list of filenames, returning a list of filenames which were successfully parsed. If filenames is a string, it is treated as a single filename. If a file named in filenames cannot be opened, that file will be ignored. This is designed so that you can specify a list of potential configuration file locations (for example, the current directory, the user’s home directory, and some system-wide directory), and all existing configuration files in the list will be read. If none of the named files exist, the ConfigParser instance will contain an empty dataset. An application which requires initial values to be loaded from a file should load the required file or files using read_file() before calling read() for any optional files:
edited Nov 28 '18 at 14:54
answered Jun 22 '16 at 16:02
Sardorbek ImomalievSardorbek Imomaliev
8,93421831
8,93421831
1
I think this is useful but it seems to just print the files it would potentially use. For example, if I run this on my Mac I get['/Library/Application Support/pip/pip.conf', '/Users/myuser/.pip/pip.conf', '/Users/myuser/Library/Application Support/pip/pip.conf']
but none of those files actually exist. Is there some logging or anything that would have pip print out the files it's trying to read and whether or not it was successful in doing so?
– FGreg
Jun 22 '16 at 18:14
@FGreg I extend my answer. I have some questions for you. How are you trying to pass yourconfig.ini
?get_config_files
readsPIP_CONFIG_FILE
environment variable, are you setting it properly? Are you using virtualenv?
– Sardorbek Imomaliev
Jun 22 '16 at 18:54
I'm trying to figure out if it is using a pip.conf, pip.ini, conf.ini, etc... and if so where is it located. Your updates seem to cover what i was looking for; thanks.
– FGreg
Jun 23 '16 at 15:50
With example above this can easily be converted into script. Which can be ran to show information you want.
– Sardorbek Imomaliev
Jun 24 '16 at 16:05
Good to note...pip search
seems to always use PyPi.org, even when your pip.conf is correctly configured to use a private mirror. I wasted an embarrassingly long period of time on this earlier today trying to debug a problem.
– Brian M. Carr
Apr 25 '18 at 11:53
|
show 1 more comment
1
I think this is useful but it seems to just print the files it would potentially use. For example, if I run this on my Mac I get['/Library/Application Support/pip/pip.conf', '/Users/myuser/.pip/pip.conf', '/Users/myuser/Library/Application Support/pip/pip.conf']
but none of those files actually exist. Is there some logging or anything that would have pip print out the files it's trying to read and whether or not it was successful in doing so?
– FGreg
Jun 22 '16 at 18:14
@FGreg I extend my answer. I have some questions for you. How are you trying to pass yourconfig.ini
?get_config_files
readsPIP_CONFIG_FILE
environment variable, are you setting it properly? Are you using virtualenv?
– Sardorbek Imomaliev
Jun 22 '16 at 18:54
I'm trying to figure out if it is using a pip.conf, pip.ini, conf.ini, etc... and if so where is it located. Your updates seem to cover what i was looking for; thanks.
– FGreg
Jun 23 '16 at 15:50
With example above this can easily be converted into script. Which can be ran to show information you want.
– Sardorbek Imomaliev
Jun 24 '16 at 16:05
Good to note...pip search
seems to always use PyPi.org, even when your pip.conf is correctly configured to use a private mirror. I wasted an embarrassingly long period of time on this earlier today trying to debug a problem.
– Brian M. Carr
Apr 25 '18 at 11:53
1
1
I think this is useful but it seems to just print the files it would potentially use. For example, if I run this on my Mac I get
['/Library/Application Support/pip/pip.conf', '/Users/myuser/.pip/pip.conf', '/Users/myuser/Library/Application Support/pip/pip.conf']
but none of those files actually exist. Is there some logging or anything that would have pip print out the files it's trying to read and whether or not it was successful in doing so?– FGreg
Jun 22 '16 at 18:14
I think this is useful but it seems to just print the files it would potentially use. For example, if I run this on my Mac I get
['/Library/Application Support/pip/pip.conf', '/Users/myuser/.pip/pip.conf', '/Users/myuser/Library/Application Support/pip/pip.conf']
but none of those files actually exist. Is there some logging or anything that would have pip print out the files it's trying to read and whether or not it was successful in doing so?– FGreg
Jun 22 '16 at 18:14
@FGreg I extend my answer. I have some questions for you. How are you trying to pass your
config.ini
? get_config_files
reads PIP_CONFIG_FILE
environment variable, are you setting it properly? Are you using virtualenv?– Sardorbek Imomaliev
Jun 22 '16 at 18:54
@FGreg I extend my answer. I have some questions for you. How are you trying to pass your
config.ini
? get_config_files
reads PIP_CONFIG_FILE
environment variable, are you setting it properly? Are you using virtualenv?– Sardorbek Imomaliev
Jun 22 '16 at 18:54
I'm trying to figure out if it is using a pip.conf, pip.ini, conf.ini, etc... and if so where is it located. Your updates seem to cover what i was looking for; thanks.
– FGreg
Jun 23 '16 at 15:50
I'm trying to figure out if it is using a pip.conf, pip.ini, conf.ini, etc... and if so where is it located. Your updates seem to cover what i was looking for; thanks.
– FGreg
Jun 23 '16 at 15:50
With example above this can easily be converted into script. Which can be ran to show information you want.
– Sardorbek Imomaliev
Jun 24 '16 at 16:05
With example above this can easily be converted into script. Which can be ran to show information you want.
– Sardorbek Imomaliev
Jun 24 '16 at 16:05
Good to note...
pip search
seems to always use PyPi.org, even when your pip.conf is correctly configured to use a private mirror. I wasted an embarrassingly long period of time on this earlier today trying to debug a problem.– Brian M. Carr
Apr 25 '18 at 11:53
Good to note...
pip search
seems to always use PyPi.org, even when your pip.conf is correctly configured to use a private mirror. I wasted an embarrassingly long period of time on this earlier today trying to debug a problem.– Brian M. Carr
Apr 25 '18 at 11:53
|
show 1 more comment
From how I see it, your question can be interpreted in three ways:
- What is the configuration of the pip executable?
There is a quite extensive documentation for the configurations supported by pip, see here: https://pip.pypa.io/en/stable/user_guide/#configuration
- What is the configuration that pip uses when configuring and subsequently building code required by a Python module?
This is specified by the package that is being installed. The package maintainer is responsible for producing a configuration script. For example, Numpy has a Configuration class (https://github.com/numpy/numpy/blob/master/numpy/distutils/misc_util.py) that they use to configure their Cython build.
- What are the current modules installed with pip so I can reproduce a specific environment configuration?
This is easy, pip freeze > requirements.txt
. This will produce a file of all currently installed pip modules along with their exact versions. You can then do pip install -r requirements.txt
to reproduce that exact environment configuration on another machine.
I hope this helps.
add a comment |
From how I see it, your question can be interpreted in three ways:
- What is the configuration of the pip executable?
There is a quite extensive documentation for the configurations supported by pip, see here: https://pip.pypa.io/en/stable/user_guide/#configuration
- What is the configuration that pip uses when configuring and subsequently building code required by a Python module?
This is specified by the package that is being installed. The package maintainer is responsible for producing a configuration script. For example, Numpy has a Configuration class (https://github.com/numpy/numpy/blob/master/numpy/distutils/misc_util.py) that they use to configure their Cython build.
- What are the current modules installed with pip so I can reproduce a specific environment configuration?
This is easy, pip freeze > requirements.txt
. This will produce a file of all currently installed pip modules along with their exact versions. You can then do pip install -r requirements.txt
to reproduce that exact environment configuration on another machine.
I hope this helps.
add a comment |
From how I see it, your question can be interpreted in three ways:
- What is the configuration of the pip executable?
There is a quite extensive documentation for the configurations supported by pip, see here: https://pip.pypa.io/en/stable/user_guide/#configuration
- What is the configuration that pip uses when configuring and subsequently building code required by a Python module?
This is specified by the package that is being installed. The package maintainer is responsible for producing a configuration script. For example, Numpy has a Configuration class (https://github.com/numpy/numpy/blob/master/numpy/distutils/misc_util.py) that they use to configure their Cython build.
- What are the current modules installed with pip so I can reproduce a specific environment configuration?
This is easy, pip freeze > requirements.txt
. This will produce a file of all currently installed pip modules along with their exact versions. You can then do pip install -r requirements.txt
to reproduce that exact environment configuration on another machine.
I hope this helps.
From how I see it, your question can be interpreted in three ways:
- What is the configuration of the pip executable?
There is a quite extensive documentation for the configurations supported by pip, see here: https://pip.pypa.io/en/stable/user_guide/#configuration
- What is the configuration that pip uses when configuring and subsequently building code required by a Python module?
This is specified by the package that is being installed. The package maintainer is responsible for producing a configuration script. For example, Numpy has a Configuration class (https://github.com/numpy/numpy/blob/master/numpy/distutils/misc_util.py) that they use to configure their Cython build.
- What are the current modules installed with pip so I can reproduce a specific environment configuration?
This is easy, pip freeze > requirements.txt
. This will produce a file of all currently installed pip modules along with their exact versions. You can then do pip install -r requirements.txt
to reproduce that exact environment configuration on another machine.
I hope this helps.
answered Jun 22 '16 at 16:04


Jason ParhamJason Parham
328410
328410
add a comment |
add a comment |
You can run pip in pdb. Here's an example inside ipython:
>>> import pip
>>> import pdb
>>> pdb.run("pip.main()", globals())
(Pdb) s
--Call--
> /usr/lib/python3.5/site-packages/pip/__init__.py(197)main()
-> def main(args=None):
(Pdb) b /usr/lib/python3.5/site-packages/pip/baseparser.py:146
Breakpoint 1 at /usr/lib/python3.5/site-packages/pip/baseparser.py:146
(Pdb) c
> /usr/lib/python3.5/site-packages/pip/baseparser.py(146)__init__()
-> if self.files:
(Pdb) p self.files
['/etc/xdg/pip/pip.conf', '/etc/pip.conf', '/home/andre/.pip/pip.conf', '/home/andre/.config/pip/pip.conf']
The only trick here was looking up the path of the baseparser (and knowing that the files are in there). If you don't know this already you can simply step through the program or read the source. This type of exploration should work for most Python programs.
add a comment |
You can run pip in pdb. Here's an example inside ipython:
>>> import pip
>>> import pdb
>>> pdb.run("pip.main()", globals())
(Pdb) s
--Call--
> /usr/lib/python3.5/site-packages/pip/__init__.py(197)main()
-> def main(args=None):
(Pdb) b /usr/lib/python3.5/site-packages/pip/baseparser.py:146
Breakpoint 1 at /usr/lib/python3.5/site-packages/pip/baseparser.py:146
(Pdb) c
> /usr/lib/python3.5/site-packages/pip/baseparser.py(146)__init__()
-> if self.files:
(Pdb) p self.files
['/etc/xdg/pip/pip.conf', '/etc/pip.conf', '/home/andre/.pip/pip.conf', '/home/andre/.config/pip/pip.conf']
The only trick here was looking up the path of the baseparser (and knowing that the files are in there). If you don't know this already you can simply step through the program or read the source. This type of exploration should work for most Python programs.
add a comment |
You can run pip in pdb. Here's an example inside ipython:
>>> import pip
>>> import pdb
>>> pdb.run("pip.main()", globals())
(Pdb) s
--Call--
> /usr/lib/python3.5/site-packages/pip/__init__.py(197)main()
-> def main(args=None):
(Pdb) b /usr/lib/python3.5/site-packages/pip/baseparser.py:146
Breakpoint 1 at /usr/lib/python3.5/site-packages/pip/baseparser.py:146
(Pdb) c
> /usr/lib/python3.5/site-packages/pip/baseparser.py(146)__init__()
-> if self.files:
(Pdb) p self.files
['/etc/xdg/pip/pip.conf', '/etc/pip.conf', '/home/andre/.pip/pip.conf', '/home/andre/.config/pip/pip.conf']
The only trick here was looking up the path of the baseparser (and knowing that the files are in there). If you don't know this already you can simply step through the program or read the source. This type of exploration should work for most Python programs.
You can run pip in pdb. Here's an example inside ipython:
>>> import pip
>>> import pdb
>>> pdb.run("pip.main()", globals())
(Pdb) s
--Call--
> /usr/lib/python3.5/site-packages/pip/__init__.py(197)main()
-> def main(args=None):
(Pdb) b /usr/lib/python3.5/site-packages/pip/baseparser.py:146
Breakpoint 1 at /usr/lib/python3.5/site-packages/pip/baseparser.py:146
(Pdb) c
> /usr/lib/python3.5/site-packages/pip/baseparser.py(146)__init__()
-> if self.files:
(Pdb) p self.files
['/etc/xdg/pip/pip.conf', '/etc/pip.conf', '/home/andre/.pip/pip.conf', '/home/andre/.config/pip/pip.conf']
The only trick here was looking up the path of the baseparser (and knowing that the files are in there). If you don't know this already you can simply step through the program or read the source. This type of exploration should work for most Python programs.
answered Jun 22 '16 at 16:17
André LaszloAndré Laszlo
11.2k24663
11.2k24663
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f36569511%2fis-it-possible-to-get-pip-to-print-the-configuration-it-is-using%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
do you mean the pip.conf files?
– A. L. Flanagan
Jun 22 '16 at 16:20
1
Yes, the Windows equivalent to the pip.conf file is a config.ini file in a parent directory called 'pip'.
– Alexander
Jun 23 '16 at 9:18