somehow the installation of python is broken in my linux OEL 6.9.

pip or easy_install are broken and I cannot do anything.

i get the same error on both sides:

# easy_install
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/setuptools-39.2.0-py2.6.egg/pkg_resources/__init__.py", line 947, in <module>
    class Environment(object):
  File "/usr/lib/python2.6/site-packages/setuptools-39.2.0-py2.6.egg/pkg_resources/__init__.py", line 951, in Environment
    self, search_path=None, platform=get_supported_platform(),
  File "/usr/lib/python2.6/site-packages/setuptools-39.2.0-py2.6.egg/pkg_resources/__init__.py", line 180, in get_supported_platform
    plat = get_build_platform()
  File "/usr/lib/python2.6/site-packages/setuptools-39.2.0-py2.6.egg/pkg_resources/__init__.py", line 380, in get_build_platform
    from sysconfig import get_platform
ImportError: No module named sysconfig

I removed python-setuptools to no avail.

I think i was trying to update latest version of pyOpenSSL and it crashed and cannot fix.

we are running Oracle enterprise Linux 6.6 in a VM.

how to fix it without resorting to installing python 2.7 which is not included in the official repos

thank you

  • BTW, Python 2.6 is no longer supported, so security updates are no longer released for it. And Python 2.7 will reach its official End of Life in 2020, so you need to seriously think about migrating to Python 3.
    – PM 2Ring
    May 30, 2018 at 11:06
  • Note that sysconfig doesn't exist in Python 2.6. It was introduced in Python 3.2 and backported to 2.7.
    – PM 2Ring
    May 30, 2018 at 11:19
  • why is it complaining then that no sysconfig? perhaps it tried to upgrade a module that is not supposed to work on python 2.6 The OS does not offer any other option. how to remove the module causing python to complain about sysconfig.
    – danidar
    May 30, 2018 at 11:33
  • What is your setuptools version atm? Did you install python-setuptools back after removal? It is vital for you to have it installed, otherwise you can forget about python packages.
    – hoefling
    May 30, 2018 at 11:58
  • Your problem is that setuptools dropped python 2.6 support since version 37, but it looks like you have version 39.2.0 for some reason. This will bork your python dist completely as you won't be able to install or uninstall anything, no matter pip or easy_install. This should be the primary issue to solve right now.
    – hoefling
    May 30, 2018 at 12:03

2 Answers 2


the solution was:

remove completely python-setuptools and delete the folder from /usr/lib/python2.6/site-packages/.

then remove manually from the site-packages folder the module: pyOpenSSL it was after trying to upgrade it that everything went south.

rm -rf pyOpenSSL-18.0.0-py2.6.egg/

install back from yum python-setuptools now pip list can list the modules and no more errors with easy_install either.


Ok, so setuptools should be installed now - can you confirm you have the pkg_resources.py module? Run ls /usr/lib/python2.6/site-packages/pkg_resources.py; echo $?.

if this command outputs 0, remove the pkg_resources package: sudo rm -rf /usr/lib/python2.6/site-packages/pkg_resources/.

Remove the dir only when the pkg_resources module is found! After that, pip should work again: run smth like pip list to check that.



python3 -m ensurepip --default-pip

pip3 install [package]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .