0

I am trying to install pip and am getting some issues with configparser. Somehow the import configparser is pointing to the system version of python, python 2.7 instead of python 3.5

>> pip install -U pip
Traceback (most recent call last):
  File "/Users/../anaconda3/bin/pip", line 9, in <module>
    load_entry_point('pip==8.1.2', 'console_scripts', 'pip')()
  File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 542, in load_entry_point
  File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 2569, in load_entry_point
  File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 2229, in load
  File "/Users/../anaconda3/lib/python3.5/site-packages/setuptools-23.0.0-py3.5.egg/pkg_resources/__init__.py", line 2235, in resolve
  File "/Users/../anaconda3/lib/python3.5/site-packages/pip/__init__.py", line 14, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/Users/../anaconda3/lib/python3.5/site-packages/pip/utils/__init__.py", line 23, in <module>
    from pip.locations import (
  File "/Users/../anaconda3/lib/python3.5/site-packages/pip/locations.py", line 10, in <module>
    from distutils.command.install import install, SCHEME_KEYS  # noqa
  File "/Users../anaconda3/lib/python3.5/distutils/command/install.py", line 9, in <module>
    from distutils.core import Command
  File "/Users/../anaconda3/lib/python3.5/distutils/core.py", line 18, in <module>
    from distutils.config import PyPIRCCommand
  File "/Users/../anaconda3/lib/python3.5/distutils/config.py", line 7, in <module>
    from configparser import RawConfigParser
  File "/Library/Python/2.7/site-packages/configparser.py", line 12, in <module>
    from backports.configparser import (
Lex Scarisbrick
  • 1,540
  • 1
  • 24
  • 31
praju05
  • 13
  • 4

2 Answers2

0

I'm assuming you are using Linux OS based on the command. Give it a try to install with apt-get:

apt-get install python-pip

when not logged in as root use, you must know root password:

sudo apt-get install python-pip

I used the same command to install it on my Raspberry Pi and Ubuntu 16

keyur
  • 77
  • 1
  • 6
  • It is Mac OS X.. I am using a wrong command? I am trying to update pip and conda, but everytime I am getting the same configparser error. Do I have to change the pythonpath? – praju05 Jul 31 '16 at 23:51
  • try this for Mac OS: `sudo easy-install pip` ref: http://stackoverflow.com/a/18947390/5954600 – keyur Aug 01 '16 at 00:02
  • Thanks! But after installation, pip install --upgrade pip gives the same error i.e. No module named 'backports.configparser' – praju05 Aug 01 '16 at 00:15
0

Modify PYTHONPATH to have python 3.x packages path before 2.x packages path

be_good_do_good
  • 4,311
  • 3
  • 28
  • 42