Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ipython does not start -- DistributionNotFound #814

Closed
countvajhula opened this Issue · 14 comments

10 participants

@countvajhula

Hi there,
I've been using ipython for a while (awesome work!), but I just noticed that it isn't working anymore. When I run ipython, I get this output:

Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in
from pkg_resources import load_entry_point
File "/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2603, in

File "/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 666, in require

File "/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 565, in resolve

pkg_resources.DistributionNotFound: ipython==0.10.1

I installed a handful of (unrelated) packages in the last couple of weeks so that could have caused this to break somehow. In particular, I installed setuptools, and that seems to be referenced here in the error message.

Thanks,
-Sid

@takluyver
Owner

I think it is likely that installing setuptools has somehow interfered with your setup. Have you tried reinstalling IPython?

@countvajhula

Yes, I tried reinstalling by doing:

$ sudo easy_install-2.6 readline ipython

...on my mac, which is how I'd installed it the first time around. The installation completed without complaint, but running ipython results in the same error message as before.

@takluyver
Owner

Did it actually reinstall? If easy_install finds an existing installation, it won't do anything. I think you need to do sudo easy_install-2.6 -U ipython or something similar, to force it to install a new version. Note that this will also upgrade you to 0.11 - if you know you have a specific requirement for 0.10.x, you can manually download it from the website.

@countvajhula

Thanks for the tip. From a cursory look around, it appears that -U is the correct flag for upgrading a package. I tried that, and it seemed to reinstall ipython:

Best match: ipython 0.11
Downloading http://archive.ipython.org/release/0.11/ipython-0.11-py2.6.egg
Processing ipython-0.11-py2.6.egg
removing '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ipython-0.11-py2.6.egg' (and everything under it)
creating /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ipython-0.11-py2.6.egg
Extracting ipython-0.11-py2.6.egg to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
ipython 0.11 is already the active version in easy-install.pth
Installing ipcontroller script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing iptest script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipcluster script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipython script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing pycolor script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing iplogger script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing irunner script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipengine script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipython-qtconsole script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin

Installed /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ipython-0.11-py2.6.egg
Processing dependencies for ipython
Finished processing dependencies for ipython

However, running ipython still gives that error message :(

So I tried uninstalling ipython:

$ sudo easy_install-2.6 -m ipython

And then reinstalling:

$sudo easy_install-2.6 ipython
install_dir /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
Searching for ipython
Reading http://pypi.python.org/simple/ipython/
Reading http://ipython.scipy.org
Reading http://ipython.scipy.org/dist
Reading http://ipython.scipy.org/dist/0.10
Reading http://ipython.scipy.org/dist/0.9.1
Reading http://ipython.scipy.org/dist/0.8.4
Reading http://ipython.org
Reading http://archive.ipython.org/release/0.11/
Reading http://ipython.scipy.org/dist/old/0.9
Best match: ipython 0.11
Downloading http://archive.ipython.org/release/0.11/ipython-0.11-py2.6.egg
Processing ipython-0.11-py2.6.egg
creating /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ipython-0.11-py2.6.egg
Extracting ipython-0.11-py2.6.egg to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
Adding ipython 0.11 to easy-install.pth file
Installing ipcontroller script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing iptest script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipcluster script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipython script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing pycolor script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing iplogger script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing irunner script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipengine script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
Installing ipython-qtconsole script to /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin

Installed /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ipython-0.11-py2.6.egg
Processing dependencies for ipython
Finished processing dependencies for ipython

...but I still get the error:


$ipython
Traceback (most recent call last):
  File "/usr/local/bin/ipython", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 2603, in <module>

  File "/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 666, in require

  File "/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 565, in resolve

pkg_resources.DistributionNotFound: ipython==0.10.1

@takluyver
Owner

It looks like it's installing the start scripts to a location later in your path than an existing entry. You might want to try deleting /usr/local/bin/ipython.

I'm going to close this issue since I don't think it's an IPython bug. We can still comment on it after it's closed.

@takluyver takluyver closed this
@farproc

just in case someone else comes across here via google (like i did!), I too installed ipython from pip3 but the
the ipython script (/usr/local/bin/ipython on my box) wasn't correct.

The required version was wrong:

__requires__ = 'ipython==0.10.2'

instead of:

__requires__ = 'ipython==0.13.1'

and:

load_entry_point('ipython==0.10.2', 'console_scripts', 'ipython')()

instead of:

load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython3')()

I've obviously install ipython v0.13.1

I'm a complete python n00b - but hopefully that correct and helps someone...

@minrk
Owner

@farproc that means that /usr/local/bin/ipython is not actually the file that the installer wrote - check the installer output. Most significantly, pip3 will actually create ipython3, it will not create any file called ipython.

@ghost

I explicitly use pip3 instead of pip, it will work.

 pip3 install ipython
 pip3 install ipdb 
@AlishaR

I tried uninstalling with:

 sudo pip uninstall ipython

Then reinstalling with:

 sudo pip install ipython

That seemed to work for me.

@kasterma

I had the issue discussed in this thread as well, and one of the comments above fixed it. There is no way for me to tell which, since I only noticed it was fixed after starting a new shell. Some part of my system maintained a reference to the broken ipython until I did this. So, hint to people showing up here later, restart your shell to see if the changes had any effect.

@scott-maddox

Had this problem for a while now on Mac OS X, since switching to the homebrew package manager. Deleting /usr/local/bin/ipython, then reinstalling ipython did the trick. Here's a one-liner (may need to be super user, depending on your pip install):

rm -f /usr/local/bin/ipython && pip uninstall ipython -y && pip install ipython

I also found it necessary to rm -rf ~/.ipython to get rid of the warning on startup.

@albertocottica

The suggestion by @AlishaR worked for me, and took less than one minute. Thanks!

@idontgetoutmuch

@scott-maddox thanks that worked for me

@gmgauthier
OSX 10.10.1
XCODE 6.1
ITERM2 2.0.0.20141103
Brew 0.9.5
Python 2.7.8 (From Brew)
PIP 1.5.6 (from Brew)

IPython version: 2.3.1 (From PIP)
IPython commit : 1c0eb68 (installation)
IPython package: /usr/local/lib/python2.7/site-packages/IPython
Python version : 2.7.8 (default, Oct 17 2014, 19:11:06) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)]
sys.executable : /usr/local/opt/python/bin/python2.7
Platform       : Darwin-14.0.0-x86_64-i386-64bit

Tools and libraries available at test time:
   curses jinja2 numpy pexpect pygments pymongo requests sphinx sqlite3 tornado zmq

Tools and libraries NOT available at test time:
   casperjs cython matplotlib oct2py qt rpy2

I installed ipython from PIP, and after repeated uninstalls and reinstalls (using the various methods suggested here and elsewhere), I only ever got this in response:

gmgauthier@gower-2 $ iptest                                                                                                                           |
Traceback (most recent call last):
  File "/usr/local/bin/iptest", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 2880, in <module>
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 434, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 447, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/site-packages/pkg_resources.py", line 626, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: ipython==0.12

After noodling around a bit, I figured out that I could do this:

gmgauthier@gower-2 $ ls -la __old*                                                                                                  (2d23h46m)|[master]
-rwxr-xr-x 1 root 262 Mar 11  2012 __old_ipcluster*
-rwxr-xr-x 1 root 268 Mar 11  2012 __old_ipcontroller*
-rwxr-xr-x 1 root 260 Mar 11  2012 __old_ipengine*
-rwxr-xr-x 1 root 256 Mar 11  2012 __old_iptest*
-rwxr-xr-x 1 root 246 Dec 31 15:44 __old_ipython*
[16:10:05][/usr/local/bin]
gmgauthier@gower-2 $ ls -la ip*                                                                                                     (2d23h50m)|[master]
lrwxr-xr-x 1 root  10 Dec 31 16:00 ipcluster -> ipcluster2*
-rwxr-xr-x 1 root 285 Dec 31 15:44 ipcluster2*
lrwxr-xr-x 1 root  13 Dec 31 16:00 ipcontroller -> ipcontroller2*
-rwxr-xr-x 1 root 288 Dec 31 15:44 ipcontroller2*
-rwxr-xr-x 1 root 300 Dec 31 15:40 ipdb*
lrwxr-xr-x 1 root   9 Dec 31 16:01 ipengine -> ipengine2*
-rwxr-xr-x 1 root 284 Dec 31 15:44 ipengine2*
-rwxr-xr-x 1 root 260 Mar 11  2012 iplogger*
lrwxr-xr-x 1 root   7 Dec 31 15:52 iptest -> iptest2*
-rwxr-xr-x 1 root 253 Dec 31 15:44 iptest2*
lrwxr-xr-x 1 root   8 Dec 31 15:53 ipython -> ipython2*
-rwxr-xr-x 1 root 270 Mar 11  2012 ipython-qtconsole*
-rwxr-xr-x 1 root 246 Dec 31 15:44 ipython2*
[16:10:12][/usr/local/bin]

Now, when I run iptest, I get this:

gmgauthier@gower-2 $ iptest                                                                                                         

Test group: kernel
........./usr/local/lib/python2.7/site-packages/IPython/kernel/zmq/tests/test_serialize.py:89: RuntimeWarning: invalid value encountered in isnan
  A[field][numpy.isnan(A[field])] = 0
................S........................................................
----------------------------------------------------------------------
Ran 82 tests in 24.238s

OK (SKIP=1)

Test group: kernel.inprocess
S.......
----------------------------------------------------------------------
Ran 8 tests in 0.142s

OK (SKIP=1)

Test group: config
............................................................................
----------------------------------------------------------------------
Ran 76 tests in 0.080s

OK

Test group: core
............................................................................SSS........................................................................................................................................................................................................................................................................................................S.................................................................
----------------------------------------------------------------------
Ran 441 tests in 20.626s

OK (SKIP=4)

Test group: extensions
...
----------------------------------------------------------------------
Ran 3 tests in 0.014s

OK

Test group: lib
.............................SSS.............S...............
----------------------------------------------------------------------
Ran 61 tests in 0.543s

OK (SKIP=4)

Test group: terminal
...........................
----------------------------------------------------------------------
Ran 27 tests in 12.578s

OK

Test group: testing
..........................S....S...................S..
----------------------------------------------------------------------
Ran 54 tests in 3.513s

OK (SKIP=3)

Test group: utils
.........................................................................................S..................................S........SSS...S................S.......S............S..S..............................................................................................................................
----------------------------------------------------------------------
Ran 307 tests in 2.482s

OK (SKIP=10)

Test group: nbformat
..........................................................................
----------------------------------------------------------------------
Ran 74 tests in 0.121s

OK

Test group: html
................................
----------------------------------------------------------------------
Ran 103 tests in 18.007s

OK

Test group: nbconvert
...................................................................................................S.................S................SS.......S..
----------------------------------------------------------------------
Ran 146 tests in 25.684s

OK (SKIP=5)

Test group: autoreload
...
----------------------------------------------------------------------
Ran 3 tests in 6.485s

OK

Test group: parallel ----------------------------------------- NOT RUN
Test group: qt ----------------------------------------------- NOT RUN
Test group: js/base ------------------------------------------ NOT RUN
Test group: js/notebook -------------------------------------- NOT RUN
Test group: js/services -------------------------------------- NOT RUN
Test group: js/tree ------------------------------------------ NOT RUN
Test group: js/widgets --------------------------------------- NOT RUN
______________________________________________________________________
Test suite completed

It's not perfect, but it's pretty damn close to being. The qtconsole, of course, still doesn't work. But I'm not sure I'll need that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.