Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named 'IPython.utils.colorable' #151

Closed
astrofrog opened this issue Jul 4, 2016 · 7 comments
Closed

ImportError: No module named 'IPython.utils.colorable' #151

astrofrog opened this issue Jul 4, 2016 · 7 comments
Milestone

Comments

@astrofrog
Copy link

If I create a clean conda environment with:

$ conda create -n minimal-ipython-2 python=3.5 ipykernel
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ....
Solving package specifications: .........

Package plan for installation in environment /Users/tom/miniconda3/envs/minimal-ipython-2:

The following NEW packages will be INSTALLED:

    appnope:           0.1.0-py35_0 
    backports:         1.0-py35_0   
    decorator:         4.0.10-py35_0
    get_terminal_size: 1.0.0-py35_0 
    ipykernel:         4.3.1-py35_0 
    ipython:           4.2.0-py35_1 
    ipython_genutils:  0.1.0-py35_0 
    jupyter_client:    4.3.0-py35_0 
    jupyter_core:      4.1.0-py35_0 
    openssl:           1.0.2h-1     
    path.py:           8.2.1-py35_0 
    pexpect:           4.0.1-py35_0 
    pickleshare:       0.7.2-py35_0 
    pip:               8.1.2-py35_0 
    ptyprocess:        0.5.1-py35_0 
    python:            3.5.1-5      
    python.app:        1.2-py35_4   
    pyzmq:             15.2.0-py35_1
    readline:          6.2-2        
    setuptools:        23.0.0-py35_0
    simplegeneric:     0.8.1-py35_1 
    sqlite:            3.13.0-0     
    tk:                8.5.18-0     
    tornado:           4.3-py35_1   
    traitlets:         4.2.1-py35_0 
    wheel:             0.29.0-py35_0
    xz:                5.2.2-0      
    zlib:              1.2.8-3      

...
$ source activate minimal-ipython-2
discarding /Users/tom/miniconda3/envs/minimal-ipykernel/bin from PATH
prepending /Users/tom/miniconda3/envs/minimal-ipython-2/bin to PATH

I get the following import error:

$ python -c 'from ipykernel.kernelapp import IPKernelApp'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/ipykernel/connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/IPython/core/application.py", line 24, in <module>
    from IPython.core import release, crashhandler
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/IPython/core/ultratb.py", line 117, in <module>
    from IPython.core import debugger
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/IPython/core/debugger.py", line 35, in <module>
    from IPython.utils import PyColorize, ulinecache
  File "/Users/tom/miniconda3/envs/minimal-ipython-2/lib/python3.5/site-packages/IPython/utils/PyColorize.py", line 57, in <module>
    from .colorable import Colorable
ImportError: No module named 'IPython.utils.colorable'

Is there a missing dependency?

@takluyver
Copy link
Member

In another environment, you've overwritten the ipython conda package with a newer IPython installed another way, e.g. from pip. Because conda uses hardlinks to save space, files that were overwritten affect all environments with that version of IPython installed, while files that were added are only added to the environment where you installed it. So you have an incomplete installation of IPython in that env.

Simplest workaround: conda uninstall ipython and pip install ipython.

@astrofrog
Copy link
Author

@takluyver - ok, thanks - I think I must indeed have installed the ipython 5.0.0b1 release to try it out in another environment.

@minrk minrk added this to the no action milestone Aug 8, 2016
@talkaminker
Copy link

For future users who have this problem:
conda remove ipython - will uninstall ipython
conda clean -p - will clean the cached packages (with pip ruined)
conda install ipython will redownload the package and properly install it
running all 3 fixed the problem for me

@pglezen
Copy link

pglezen commented May 25, 2017

The tip from @talkaminker got me going for my Mac at home. I experienced the same problem with my work Mac. Instead of removing and reinstalling ipython, I tried

conda update ipykernel

since ipykernel is the name of this repo. I received the message

ipykernel: 4.3.1-py35_0 --> 4.6.1-py35_0

and jupyter notebook worked fine after that (no more

ImportError: No module named 'IPython.utils.warn'
[W 10:31:19.814 NotebookApp] KernelRestarter: restart failed

errors).

@piprads
Copy link

piprads commented Jun 20, 2017

Thanks @pglezen. This helps.

The other suggestion didn't work for me on my mac.

@keflavich
Copy link

I don't know how I broke this differently from others, but I was unable to get ipython to work at all with conda after rm -r'ing site-packages/ipython* (bad move).

I had to remove all traces of ipython then pip installing both ipython and ipython_genutils.

@jianning-li
Copy link

@pglezen
it helped !thank you so much. :-) . I almost went crazy with this mysterious problem until I came across your solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants