Search code examples
pythonpandasinstallationpippyopenssl

Updates of pyOpenSSL and pandas using 'pip' fail with "TypeError: resolve() got an unexpected keyword argument 'replace_conflicting'"


When I attempt to update or install any version of pandas or pyOpenSSL(with any instance of sudo pip --[un]install|update [--no-use-wheel] [pandas|pyOpenSSL|xattr|stevedore], using pip 1.5.4) I get:

Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/pandas
Storing debug log for failure in /Users/Rax/Library/Logs/pip.log
...
TypeError: resolve() got an unexpected keyword argument 'replace_conflicting'

Why am I getting this error and what can I do to avoid it?


OSX 10.9.2; Python 2.7.5; setuptools 3.4.3.

More detail on the error report (for pandas):

Downloading/unpacking pandas
  Downloading pandas-0.13.1.tar.gz (6.1MB): 6.1MB downloaded
  Running setup.py (path:/private/tmp/pip_build_root/pandas/setup.py) egg_info for package pandas
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/private/tmp/pip_build_root/pandas/setup.py", line 590, in <module>
        **setuptools_kwargs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 239, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 264, in fetch_build_eggs
        replace_conflicting=True
    TypeError: resolve() got an unexpected keyword argument 'replace_conflicting'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/private/tmp/pip_build_root/pandas/setup.py", line 590, in <module>

    **setuptools_kwargs)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 239, in __init__

    self.fetch_build_eggs(attrs.pop('setup_requires'))

  File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 264, in fetch_build_eggs

    replace_conflicting=True

TypeError: resolve() got an unexpected keyword argument 'replace_conflicting'

Contents of /Users/Rax/Library/Logs/pip.log:

Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 274, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 1215, in prepare_files
    req_to_install.run_egg_info()
  File "/Library/Python/2.7/site-packages/pip/req.py", line 321, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/Library/Python/2.7/site-packages/pip/util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/pandas

Cython          - 0.20.1       - active 
Flask           - 0.10.1       - active 
Jinja2          - 2.7.2        - active 
MarkupSafe      - 0.19         - active 
PyRSS2Gen       - 1.1          - active 
Pygments        - 1.6          - active 
Python          - 2.7.5        - active development (/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload)
Sphinx          - 1.2.2        - active 
Twisted         - 13.2.0       - active 
Werkzeug        - 0.9.4        - active 
altgraph        - 0.11         - active 
astropy         - 0.3          - active 
backports.ssl-match-hostname - 3.4.0.2      - active 
bdist-mpkg      - 0.5.0        - active 
brewer2mpl      - 1.3.2        - active 
cffi            - 0.8.2        - active 
colorama        - 0.2.7        - active 
configobj       - 5.0.1        - active 
dill            - 0.2b1        - active 
distribute      - 0.7.3        - active 
docutils        - 0.11         - active 
ggplot          - 0.4.7        - active 
ipython         - 1.2.1        - active 
itsdangerous    - 0.23         - active 
macholib        - 1.6          - active 
matplotlib      - 1.3.1        - active 
modulegraph     - 0.11         - active 
mpltools        - 0.1          - active 
nose            - 1.3.0        - active 
numexpr         - 2.3.1        - active 
numpy           - 1.8.0        - active 
numpydoc        - 0.4          - active 
pandas          - 0.13.1       - active 
patsy           - 0.2.1        - active 
pika            - 0.9.13       - active 
pip             - 1.5.4        - active 
prettytable     - 0.7.2        - active 
progressbar     - 2.2          - active 
py2app          - 0.8          - active 
pycparser       - 2.10         - active 
pyparsing       - 2.0.1        - active 
python-dateutil - 2.2          - active 
pytz            - 2014.1.1     - active 
pyzmq           - 14.0.1       - active 
readline        - 6.2.4.1      - active 
rpy2            - 2.3.9        - active 
scikit-learn    - 0.14.1       - active 
scipy           - 0.13.3       - active 
setuptools      - 3.4.3        - active 
sphinx-argparse - 0.1.9        - active 
sphinxcontrib-napoleon - 0.2.6        - active 
sphinxcontrib-programoutput - 0.8          - active 
statsmodels     - 0.5.0        - active 
stevedore       - 0.14.1       - active 
sympy           - 0.7.5        - active 
tornado         - 3.2          - active 
virtualenv-clone - 0.2.4        - active 
virtualenv      - 1.11.4       - active 
virtualenvwrapper - 4.2          - active 
websocket-client - 0.12.0       - active 
wsgiref         - 0.1.2        - active development (/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7)
xattr           - 0.7.4        - active 
yhat            - 0.6.14       - active 
yolk            - 0.4.3        - active 
zope.interface  - 4.0.5        - active 

FWIW, I can install pandas successfully in a virtual environment. If I copy it from there back into the environment where I get this error and run nosetests pandas I get:

..SS..SS..SS..SS/Library/Python/2.7/site-packages/pandas/core/index.py:910: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
  result.sort()
..SS..SS..SS..SS..SSSSSSSSSS..SS..SS..SSSS.S.S...........SS..SS..SS..........................SSSSSSSSSS.SSSS.....SSSSSSSSSSSSSS.SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS.SSSS..................S.....S........................................................................................................................................................................................................................................................................SS......................................................................................................SSSS.......................SSS..............................................................................................................................................S.......................SSSSSSS...........................................................................................S......................................................................................................................................................S.........................................S..S..S....S........................................................S......S.S.......S...S..S............S............................................................................................................................................................................................S............................................................................S........................................./Library/Python/2.7/site-packages/numpy/core/_methods.py:55: RuntimeWarning: Mean of empty slice.
  warnings.warn("Mean of empty slice.", RuntimeWarning)
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................S...............................................
----------------------------------------------------------------------
Ran 4466 tests in 230.555s

OK (SKIP=330)

This is also what I get if I run the tests in the virtual environment.


Solution

  • A likely cause is the presence of multiple versions of setuptools, with an older version earlier on the Python path than the newer one. This can be temporarily overcome for the purposes of installation by beginning your invocations of pip with

    PYTHONPATH=/PATH_TO_YOUR_CURRENT_PACKAGES/site-packages pip ...
    

    You can confirm that this is the case by executing

    import pkg_resources
    pkg_resources.__file__
    

    in Python and noting that the pkg_resources.pyc returned is not in the location of your current site packages.

    In some cases this can also be corrected by ensuring that the pkg_resources.pyc in your site packages directory in executed, rather than the one in your system packages directory (e.g., by deleting the latter).