Zijun Zhang Bioinformatics Researcher @ Simons Foundation

Anaconda ipython/jupyter notebook: ImportError: No module named shutil_get_terminal_size

2017-04-22
ZijunZhang_

If you are using Anaconda 64-bit Ver. Dec. 20 2016 and try to start jupyter notebook by typing in your shell:

ipython notebook

This will likely throw an error message “ImportError: No module named shutil_get_terminal_size”. To solve this problem, simply do the following 3 steps:

Step 1

a) use vim to open this file (in my case, it is ~/.local/lib/python2.7/site-packages/IPython/utils/terminal.py) that throws this error, find the line that tries to import get_terminal_size module, and then make the following changes:

try:
    import backports.shutil_get_terminal_size
except ImportError:
    from shutil_backports import get_terminal_size as shutil_get_terminal_size

Step 2

b) Now try ipython notebook; still doesn’t work. The error message is now “ImportError: No module named notebook.notebookapp”. To solve this, simple use pip in your shell:

pip install jupyter

Step 3

c) Now type ipython notebook in your shell.

Hooray!! You are ready to go!


Similar Posts

Comments