pip package installer sometimes fails when ran in a directory with a setup.cfg file #1531

Closed
micptolshaw opened this Issue Feb 4, 2014 · 6 comments

Projects

None yet

5 participants

@micptolshaw
micptolshaw commented Feb 4, 2014 edited by dstufft

using pip 1.5.2 to install python packages appears to be inappropriately affected by having a setup.cfg file in your local directory when you install some packages.

sudo pip install see <--- works
sudo pip install wheel <-- fails

e.g.

[core]$ sudo pip install wheel
Downloading/unpacking wheel
  Downloading wheel-0.22.0-py2.py3-none-any.whl (54kB): 54kB downloaded
Installing collected packages: wheel
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 279, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/site-packages/pip/req.py", line 1380, in install
    requirement.install(install_options, global_options, _args, *_kwargs)
  File "/usr/lib/python2.7/site-packages/pip/req.py", line 664, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python2.7/site-packages/pip/req.py", line 894, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 135, in move_wheel_files
    scheme = distutils_scheme(name, user=user, home=home, root=root)
  File "/usr/lib/python2.7/site-packages/pip/locations.py", line 147, in distutils_scheme
    d.parse_config_files()
  File "/usr/lib/python2.7/distutils/dist.py", line 397, in parse_config_files
    val = parser.get(section,opt)
  File "/usr/lib/python2.7/ConfigParser.py", line 623, in get
    return self._interpolate(section, option, value, d)
  File "/usr/lib/python2.7/ConfigParser.py", line 669, in _interpolate
    option, section, rawval, e.args[0])
InterpolationMissingOptionError: Bad value substitution:
    section: [pytest]
    option : addopts
    key    : levelname
    rawval : -s --log-format="%(levelname)-8s [%(name)s (%(module)s:%(lineno)d)] %(message)s"
## setup.cfg contains:

[pytest]
## addopts = -s --log-format="%(levelname)-8s [%(name)s (%(module)s:%(lineno)d)] %(message)s"
Member
Ivoz commented Feb 4, 2014

A setup.cfg present in the current directory is designed to modify how a package installs, afaik

You can find documentation for it under distutils, which comes from python

http://docs.python.org/2/distutils/configfile.html

If we were talking about a file setup.cfg in the package we were installing, or if we were running the setup.py script in the current directory to install the package in our directory then this would make sense.

However, using pip to install a package from pypa, and having its installation modified because you happen to be in the directory of a package you are developing seems wrong, and dangerous.

dmick commented May 21, 2014

This is still breaking.

jcsp commented May 21, 2014

The culprit appears to be ab21c1d

@qwcode can you explain the intent of that change, is it meant to be reading setup.cfg from the package being installed, or is it really meant to look for a setup.cfg in the directory pip is run from?

the use case to consider is this:

working on a new package, and needing to install a dependency using pip.
If you are in the top level directory of the new python package under
development, you really do not want that under development package
setup.cfg file to influence how the third party package should be
installed.

Mic

@jcsp jcsp added a commit to ceph/calamari that referenced this issue May 30, 2014
@jcsp jcsp doc: remove setup.cfg, broke RTD build
Known pip bug, certain versions dislike a
setup.cfg in source dir.  Removing our
CFG is harmless because it was only
setting test log format.

pypa/pip#1531

Signed-off-by: John Spray <john.spray@inktank.com>
9ae0e65
@jcsp jcsp added a commit to ceph/calamari that referenced this issue Jun 2, 2014
@jcsp @jcsp jcsp + jcsp doc: remove setup.cfg, broke RTD build
Known pip bug, certain versions dislike a
setup.cfg in source dir.  Removing our
CFG is harmless because it was only
setting test log format.

pypa/pip#1531

Signed-off-by: John Spray <john.spray@inktank.com>
f490b55
@jcsp jcsp added a commit to ceph/calamari that referenced this issue Jun 2, 2014
@jcsp @jcsp jcsp + jcsp doc: remove setup.cfg, broke RTD build
Known pip bug, certain versions dislike a
setup.cfg in source dir.  Removing our
CFG is harmless because it was only
setting test log format.

pypa/pip#1531

Signed-off-by: John Spray <john.spray@inktank.com>
2752cdd
@jcsp jcsp added a commit to ceph/calamari that referenced this issue Jun 3, 2014
@jcsp @jcsp jcsp + jcsp doc: remove setup.cfg, broke RTD build
Known pip bug, certain versions dislike a
setup.cfg in source dir.  Removing our
CFG is harmless because it was only
setting test log format.

pypa/pip#1531

Signed-off-by: John Spray <john.spray@inktank.com>
5b3a1f0
@jcsp jcsp added a commit to ceph/calamari that referenced this issue Jun 3, 2014
@jcsp @jcsp jcsp + jcsp doc: remove setup.cfg, broke RTD build
Known pip bug, certain versions dislike a
setup.cfg in source dir.  Removing our
CFG is harmless because it was only
setting test log format.

pypa/pip#1531

Signed-off-by: John Spray <john.spray@inktank.com>
256881d
@jcsp jcsp added a commit to ceph/calamari that referenced this issue Jun 3, 2014
@jcsp @jcsp jcsp + jcsp doc: remove setup.cfg, broke RTD build
Known pip bug, certain versions dislike a
setup.cfg in source dir.  Removing our
CFG is harmless because it was only
setting test log format.

pypa/pip#1531

Signed-off-by: John Spray <john.spray@inktank.com>
b536e49
@marthjod marthjod added a commit to marthjod/hipy that referenced this issue Jul 21, 2016
@marthjod marthjod Python 3 support
- minor version bump
- rm setup.cfg (pypa/pip#1531)
875c4b9
Owner
dstufft commented Mar 31, 2017

I'm going to close this. As long as we're using distutils to parse these files there isn't much we can do about this.

@dstufft dstufft closed this Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment