Is it possible to get pip to print the configuration it is using?












27















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:




  1. config.ini files are in the correct place and pip is finding them.

  2. The precedence of the config settings is treated in the way one would expect from the docs










share|improve this question

























  • 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
















27















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:




  1. config.ini files are in the correct place and pip is finding them.

  2. The precedence of the config settings is treated in the way one would expect from the docs










share|improve this question

























  • 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














27












27








27


5






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:




  1. config.ini files are in the correct place and pip is finding them.

  2. The precedence of the config settings is treated in the way one would expect from the docs










share|improve this question
















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:




  1. config.ini files are in the correct place and pip is finding them.

  2. The precedence of the config settings is treated in the way one would expect from the docs







python pip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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



















  • 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












3 Answers
3






active

oldest

votes


















32





+100









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:







share|improve this answer





















  • 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 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











  • 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



















0














From how I see it, your question can be interpreted in three ways:




  1. 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




  1. 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.




  1. 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.






share|improve this answer































    0














    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.






    share|improve this answer























      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
      });


      }
      });














      draft saved

      draft discarded


















      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









      32





      +100









      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:







      share|improve this answer





















      • 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 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











      • 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
















      32





      +100









      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:







      share|improve this answer





















      • 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 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











      • 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














      32





      +100







      32





      +100



      32




      +100





      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:







      share|improve this answer















      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:








      share|improve this answer














      share|improve this answer



      share|improve this answer








      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 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











      • 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





        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













      • 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













      0














      From how I see it, your question can be interpreted in three ways:




      1. 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




      1. 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.




      1. 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.






      share|improve this answer




























        0














        From how I see it, your question can be interpreted in three ways:




        1. 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




        1. 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.




        1. 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.






        share|improve this answer


























          0












          0








          0







          From how I see it, your question can be interpreted in three ways:




          1. 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




          1. 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.




          1. 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.






          share|improve this answer













          From how I see it, your question can be interpreted in three ways:




          1. 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




          1. 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.




          1. 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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 22 '16 at 16:04









          Jason ParhamJason Parham

          328410




          328410























              0














              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.






              share|improve this answer




























                0














                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.






                share|improve this answer


























                  0












                  0








                  0







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 22 '16 at 16:17









                  André LaszloAndré Laszlo

                  11.2k24663




                  11.2k24663






























                      draft saved

                      draft discarded




















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      MongoDB - Not Authorized To Execute Command

                      How to fix TextFormField cause rebuild widget in Flutter

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith