3

Out of the blue my IPython Kernel stopped working, repeatedly failing to restart. The error message is shown below. I have no idea what triggered this, and how to fix it. I tried upgrading setuptools and distribute as some other posts had mentioned, but no success. I appreciate your help!

WARNING:root:kernel 0abd40d4-471d-4eef-ba76-0aacea899699 restarted
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 151, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 109, in _get_module_details
    return _get_module_details(pkg_main_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 101, in _get_module_details
    loader = get_loader(mod_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 464, in get_loader
    return find_loader(fullname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 474, in find_loader
    for importer in iter_importers(fullname):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 430, in iter_importers
    __import__(pkg)
  File "/Library/Python/2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/Library/Python/2.7/site-packages/ipykernel/connect.py", line 12, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .terminal.embed import embed
  File "/Library/Python/2.7/site-packages/IPython/terminal/embed.py", line 16, in <module>
    from IPython.core.interactiveshell import DummyMod
  File "/Library/Python/2.7/site-packages/IPython/core/interactiveshell.py", line 31, in <module>
    from pickleshare import PickleShareDB
  File "/Library/Python/2.7/site-packages/pickleshare.py", line 41, in <module>
    from path import path as Path
  File "/Library/Python/2.7/site-packages/path.py", line 126, in <module>
    except pkg_resources.DistributionNotFound:
NameError: name 'pkg_resources' is not defined
Nazaf Anwar
  • 339
  • 1
  • 8
  • 17
shayne13
  • 31
  • 1
  • 3
  • https://bitbucket.org/bkroeze/django-livesettings/issues/38/nameerror-global-name-pkg_resources-is-not Did you check this out? – Nazaf Anwar Dec 22 '15 at 10:42
  • Yeah, it seems the fix there was a full reinstallation of python. I was hoping to avoid that - it seems excessive and if I miss something it could lead to worse problems. Any chance there's a more straightforward fix? -Thanks – shayne13 Dec 22 '15 at 11:11
  • In addition, I tried using ipython through a virtualenv ($ virtualenv --distribute --no-site-packages venv) but encountered the exact same problem. – shayne13 Dec 22 '15 at 11:45

2 Answers2

1

I get a similar error recently after installing a specific package with anaconda using "sudo". The installation upgraded some core package used by ipython and obviously changed the permission associated with them. Using "sudo" while lauching ipython solved the issue.

Tsilavina
  • 799
  • 5
  • 8
1

I also got this error after installing specific packages in an anaconda distribution as root. This was fixed by changing ownership of the anaconda directory ie

chown -R myname:mygroup anaconda_dir

Should be prevented by installing packages as user rather than as root

drneel
  • 2,887
  • 5
  • 30
  • 48
Anne M
  • 11
  • 2