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
No module named shutil_get_terminal_size #9656
Comments
Looks like you've installed IPython without getting its dependencies somehow. Given that I see eggs, this probably means that you have a too-old version of setuptools, and might be using
Then, try reinstalling IPython with pip (do not ever use easy_install, unless you know that there is a good reason why pip won't/can't work. These cases are rare):
|
Specifically in this case, we have added a dependency on the package backports.shutil_get_terminal_size. |
Thanks for your quick feedback! However, the mystery deepens. It looks like installing Jupyter through pip on the command line yields a different result than having Jupyter set as a requirement when using setuptools. While the first approach succeeds, the second approach fails for me. Here are the steps to reproduce this issue: First we start with a barebone Python 2.7.11 interpreter, with only three packages installed: $ pip list
pip (8.1.2)
setuptools (23.1.0)
virtualenv (15.0.2) If I install Jupyter using pip everything works fine, and I get the following packages: $ pip install jupyter
<long output>
$ pip list
appnope (0.1.0)
backports-abc (0.4)
backports.shutil-get-terminal-size (1.0.0)
backports.ssl-match-hostname (3.5.0.1)
certifi (2016.2.28)
configparser (3.5.0)
decorator (4.0.10)
entrypoints (0.2.2)
functools32 (3.2.3.post2)
gnureadline (6.3.3)
ipykernel (4.3.1)
ipython (4.2.0)
ipython-genutils (0.1.0)
ipywidgets (5.1.5)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.3.0)
jupyter-console (4.1.1)
jupyter-core (4.1.0)
MarkupSafe (0.23)
mistune (0.7.2)
nbconvert (4.2.0)
nbformat (4.0.1)
notebook (4.2.1)
pathlib2 (2.1.0)
pexpect (4.1.0)
pickleshare (0.7.2)
pip (8.1.2)
ptyprocess (0.5.1)
Pygments (2.1.3)
pyzmq (15.2.0)
qtconsole (4.2.1)
setuptools (23.1.0)
simplegeneric (0.8.1)
singledispatch (3.4.0.3)
six (1.10.0)
terminado (0.6)
tornado (4.3)
traitlets (4.2.1)
wheel (0.29.0)
widgetsnbextension (1.2.3) However, if I try to install Jupyter as a requirement for a project by having the following #!/usr/bin/env python
import setuptools
setuptools.setup(
...
install_requires = [
"jupyter"],
... ... then it fails: $ pip list
pip (8.1.2)
setuptools (23.1.0)
virtualenv (15.0.2)
$ ./setup.py install
<long output>
Searching for entrypoints
Reading https://pypi.python.org/simple/entrypoints/
No local packages or download links found for entrypoints
error: Could not find suitable distribution for Requirement.parse('entrypoints')
make: *** [install] Error 1 Interestingly, when listing the packages that did get installed we can see that $ pip list
ipykernel (4.3.1)
ipython (5.0.0b4)
ipywidgets (5.1.5)
jupyter (1.0.0)
jupyter-client (4.3.0)
jupyter-console (5.0.0b1)
nbconvert (4.2.0)
notebook (4.2.1)
pip (8.1.2)
qtconsole (4.2.1)
setuptools (23.1.0)
tornado (4.3)
traitlets (4.2.1)
wheel (0.29.0)
widgetsnbextension (1.2.3) I may be missing something here, but I'm not sure what. Any idea why having Best, |
That suggests that perhaps setuptools is getting a different version when imported than pip is listing (a known bug caused by old setuptools). What do you get from:
And also:
It's also something that may not be familiar that if you use setuptools in setup.py, you should never do |
Here are the outputs: $ python -c 'import setuptools; print(setuptools, setuptools.__version__)'
(<module 'setuptools' from '/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/setuptools/__init__.pyc'>, '23.1.0') and $ python -m site
sys.path = [
'/Users/ajmazurie/Data/Professional-MSU/2015.07-MSU-me-Jupyter_in_Classroom/Projects/Callysto/callysto',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/jupyter-1.0.0-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/ipywidgets-5.1.5-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/ipykernel-4.3.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/nbconvert-4.2.0-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/jupyter_console-5.0.0b1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/qtconsole-4.2.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/notebook-4.2.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/widgetsnbextension-1.2.3-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/traitlets-4.2.1-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/ipython-5.0.0b4-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/tornado-4.3-py2.7-macosx-10.10-x86_64.egg',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages/jupyter_client-4.3.0-py2.7.egg',
'/Users/ajmazurie/<path to python>/lib/python27.zip',
'/Users/ajmazurie/<path to python>/lib/python2.7',
'/Users/ajmazurie/<path to python>/lib/python2.7/plat-darwin',
'/Users/ajmazurie/<path to python>/lib/python2.7/plat-mac',
'/Users/ajmazurie/<path to python>/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/ajmazurie/<path to python>/lib/python2.7/lib-tk',
'/Users/ajmazurie/<path to python>/lib/python2.7/lib-old',
'/Users/ajmazurie/<path to python>/lib/python2.7/lib-dynload',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/plat-darwin',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/lib-tk',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/plat-mac',
'/Users/ajmazurie/.direnv/pyenv/versions/2.7.11/lib/python2.7/plat-mac/lib-scriptpackages',
'/Users/ajmazurie/<path to python>/lib/python2.7/site-packages',
]
USER_BASE: '/Users/ajmazurie/.local' (doesn't exist)
USER_SITE: '/Users/ajmazurie/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: False |
This is very interesting, and may be the sign that I need to update my knowledge on setuptools. Regardless, this fixed my issue! By typing As a side question, why did it not work with Best, Aurélien |
|
I only get this error if I install ipython in a virtualvenv that is shared on NFS. Any clues why installing in a venv on NFS can cause this issue? |
Not sure why NFS would make a difference, but check the version of pip inside the virtualenv, and if it's not the latest, try updating it:
|
@takluyver The same pip that install ipython fine in the "normal" filesystem, doesn't install it properly on NFS. And yes, it is the latest version of pip. |
Bizarre. No idea why NFS would affect that. |
Also running into this issue with Python 2.7 using the latest |
Installing |
As mentioned elsewhere, put PR ( paulgb/runipy#125 ) together to show the |
Looks like a problem in setuptools. Installing with pip (as should always be done) will fix it. I'm not 100% sure what setuptools is failing to do, though. |
I've just had the same sort of problem installing IPython (not Jupyter) in a fresh 2.7.3 virtualenv. IPython appeared to install but was missing
|
Can you do a |
Yes you are correct. I was on pip 1.4.1. I repeated the exercise after upgrading my virtualenv to pip 8.1.2 and IPython 5.0.0 installed without a problem.
|
I'm also having this problem on OS X:
I've tried doing |
After some investigating, I believe the
Interestingly, the
and patching IPython/utils/terminal.py to use shutil_backports.get_terminal_size works. Go figure. |
Hello, I was getting the same error in virtualenv. I had been using pip to install jupyter. I was getting "pip freeze" showed backports.shutil-get-terminal-size==1.0.0 So i tried upgrading. It showed: pip install --upgrade backports.shutil-get-terminal-size So it was somehow accessing my global libraries and not the one in my venv. Then I uninstalled backports.shutil-get-terminal-size from the global python and installed it in my venev. Now it's working fine. |
I can reproduce this 100% of the time with this install
I can reproduce this 0% of the time with this install
Note that with |
@AndrewHoos and for me, both commands get the dependencies correctly. What do you get from
|
I'm hit with this issue with notebook 4.2.2 and ipython 5.1.0 installed with
However, in regular python shell, the |
Ok, I found a crude but simple solution: uninstall and install again. Now ipython works....
|
Also ran into this problem ImportError: No module named shutil_get_terminal_size Uninstalling and installing IPython and back ports was no joy. The problem was I have Jupyter & friends installed globally, and shutil_get_terminal_size installed globally. i.e. in /Library/Python/2.7/site-packages/shutil_backports/ However I also had backports.functools_lru_cache installed locally, this actually blocked the import of shutil_backports. To test if this is the problem: ls ~/Library/Python/2.7/lib/python/site-packages (On OSX, if you see a folder back ports, thats probably at fault. I uninstalled the library from the user library and added it into the system library. Either way you an't mix & match your back ports. It must be global or local to work fully. |
Same problem in Debian Sid (Unstable) fully updated. I updated pip; tried to uninstall and install again from fresh; etc. Nothing worked.
|
uninstall and install backports.shutil_get_terminal_size again works. |
+1 in osx. Same problem, - UnInstall global and install in virtualenv works and points to local. |
@ihincks I tried all the posts but none worked. It was only yours that worked. You are a life saver :) |
fix by ihincks also works on windows 10 |
I hope it can help somebody.
I don't know how it can happened because I don't have a python3 version at all.
I've reinstalled python and make sure that pip has has correct version and location. |
This is the only right answer for me. |
sudo pip uninstall backports.shutil_get_terminal_size |
Pip should likely not get used with sudo.
Using sudo with pip is what leads systems to be broken in the way this
issue describes.
If you need to use sudo then something is wrong with your system.
--
M
… |
@ihincks On FreeBSD only your solution worked! Thanks a ton! |
FYI, I ran into the same issue, but could only get around the
|
@AllanDaemon 's response solved the problem for me! |
Faced a similar problem and it got resolved by uninstalling and reinstalling backports.shutil_get_terminal_size pip uninstall backports.shutil_get_terminal_size |
I had the same problem. To test whether it is problem with you $PATH, you can simply try import sys
print sys.path |
The issue is caused by having "backports" in both "System" and "User" locations. |
|
@takluyver Have you seen https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843898? The last 2-3 posts are interesting. |
Unfortunately that more or less seems like what I found - something is messing up the |
I commented here chrippa/backports.shutil_get_terminal_size#9 (comment) and referenced above on finding a diffference between the wheel vs. non-wheel (non-binary) install via pip, is that anything relevant? |
What about vendoring as fallback for next version of IPython?
|
Is this something that could be backported into CPython's shutil? |
Likely no, we are already not using the |
Got it. Thanks @Carreau. Glad it's only going to be a temporary issue. |
Deleting the global installation, uninstalling in virtualenv, and reinstalling in virtualenv fixed the problem for me. |
What you need just typing the below commands:
I used to have the same problem, and this solve it. |
Hi
|
@nicola-lunghi please do not advise people to use That's the equivalent of removing the battery from your Carbon Monoxide alarm because it regularly wakes you up at night. There is something wrong with your heater; you need a proper fix. |
Thanks @Carreau Ps please fix the "heather" -> deb dependancies |
The easiest fix is probably to install a newer version of IPython with |
In case someone encounters the same problem with Cygwin and python2 the solution is to run Cygwin setup.exe (or one of the apt-cyg utls) and install ipython3 is fine out of the box. |
Good day,
I am contributing to a small project to create a kernel on top of ipykernel. It has been a while since I touched it, and today when I deployed a new dev environment by installing Jupyter I got the following stack trace when calling ipykernel:
Obviously something changed since my last use of IPython and ipykernel. Any idea what the problem is? I'm working on a OSX box with Python 2.7.10.
Best, Aurélien
The text was updated successfully, but these errors were encountered: