Ipython: Jupyter Notebook can't execute any code in cell

Created on 25 Feb 2017  Â·  34Comments  Â·  Source: ipython/ipython

Hello,
I need Graphlab for my text mining course. I'm new to python.
I followed the instructions in this URL: https://turi.com/download/install-graphlab-create-command-line.html
when I use IPython everything seems to work, but when I use Jupyter Notebook. the code inside the cells won't execute and I get these empty brackets ([ ])
Please tell me if I should provide more informations.
platform : win-64
conda version : 4.0.5
conda-build version : 1.20.0
python version : 2.7.11.final.0
requests version : 2.9.1

py

Most helpful comment

Can you try python -m ipykernel install --user and then using the notebook again?

All 34 comments

Hi @BLeila - sorry you're having trouble. Did you try executing the cell by either pressing Shift-Enter while selecting that 1+1 cell, or selecting one of the Run.. options in the Cell menu?

If so, try looking in the javascript console to see if there are any error messages there.
Judging by the filled circle in the upper right, your Python 2 kernel is not running. You can try restarting it from the Kernel menu, or see if you have another kernel installed and try switching to that.

I did try the two ways to execute my code,restarted the kernel but nothing. And I have one kernel This is what I get while running Jupyter notebook:

`[I 10:50:38.714 NotebookApp] Serving notebooks from local directory: C:\Users\3D Informatique
[I 10:50:38.717 NotebookApp] 0 active kernels
[I 10:50:38.717 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 10:50:38.717 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[E 10:50:49.525 NotebookApp] Failed to run command:
    ['C:\\Users\\3D Informatique\\Anaconda3\\envs\\py27\\python.exe', '-m', 'ipykernel', '-f', 'C:\\Users\\3D Informatique\\AppData\\Roaming\\jupyter\\runtime\\kernel-ebdd578a-840c-417c-bb86-b406bf3f9b85.json']
        PATH='C:\\Users\\3D Informatique\\Anaconda2\\envs\\gl-env\\Library\\bin;C:\\Users\\3D Informatique\\Anaconda2\\envs\\gl-env;C:\\Users\\3D Informatique\\Anaconda2\\envs\\gl-env\\Scripts;C:\\Users\\3D Informatique\\Anaconda2\\envs\\gl-env\\Library\\bin;C:\\Users\\3D Informatique\\Anaconda2\\envs\\gl-env\\Library\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Skype\\Phone\\;C:\\Users\\3D Informatique\\Anaconda2;C:\\Users\\3D Informatique\\Anaconda2;C:\\Users\\3D Informatique\\Anaconda2\\Scripts;C:\\Users\\3D Informatique\\Anaconda2\\Library\\bin;'
        with kwargs:
    {'stdin': -1, 'cwd': 'C:\\Users\\3D Informatique', 'stderr': None, 'stdout': None}

[E 10:50:49.536 NotebookApp] Unhandled error in API request
    Traceback (most recent call last):
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\notebook\base\handlers.py", line 458, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 1008, in run
        value = future.result()
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\concurrent.py", line 232, in result
        raise_exc_info(self._exc_info)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 1014, in run
        yielded = self.gen.throw(*exc_info)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\notebook\services\sessions\handlers.py", line 58, in post
        sm.create_session(path=path, kernel_name=kernel_name))
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 1008, in run
        value = future.result()
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\concurrent.py", line 232, in result
        raise_exc_info(self._exc_info)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 1014, in run
        yielded = self.gen.throw(*exc_info)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 73, in create_session
        self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 1008, in run
        value = future.result()
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\concurrent.py", line 232, in result
        raise_exc_info(self._exc_info)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 282, in wrapper
        yielded = next(result)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 87, in start_kernel
        super(MappingKernelManager, self).start_kernel(**kwargs)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
        km.start_kernel(**kwargs)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\jupyter_client\manager.py", line 257, in start_kernel
        **kw)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\jupyter_client\manager.py", line 203, in _launch_kernel
        return launch_kernel(kernel_cmd, **kw)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
        proc = Popen(cmd, **kwargs)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\subprocess.py", line 390, in __init__
        errread, errwrite)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\subprocess.py", line 640, in _execute_child
        startupinfo)
    'WindowsError: [Error 2] Le fichier sp\xe9cifi\xe9 est introuvable'
[E 10:50:49.553 NotebookApp] Uncaught exception POST /api/sessions (::1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='POST', uri='/api/sessions', version='HTTP/1.1', remote_ip='::1', headers={'Content-Length': '76', 'Accept-Language': 'fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3', 'Accept-Encoding': 'gzip, deflate', 'Host': 'localhost:8888', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0', 'Connection': 'keep-alive', 'X-Requested-With': 'XMLHttpRequest', 'Referer': 'http://localhost:8888/notebooks/Untitled.ipynb', 'Cookie': '_xsrf=2|8f1f4156|dd4db6f438afb5f69f025202cd831b99|1488024209; username-localhost-8888="2|1:0|10:1488047383|23:username-localhost-8888|44:MjgwYTViMDg0NWY5NDZhOThmY2UzMTYwYWVkMjI5OTY=|10df9ac0ad30797453aec7fe7f1b7e57def598a8f4157be9ae4998b3f76bc548"', 'Content-Type': 'application/json'})
    Traceback (most recent call last):
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\web.py", line 1445, in _execute
        result = yield result
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 1008, in run
        value = future.result()
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\concurrent.py", line 232, in result
        raise_exc_info(self._exc_info)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\tornado\gen.py", line 1014, in run
        yielded = self.gen.throw(*exc_info)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\site-packages\notebook\base\handlers.py", line 476, in wrapper
        self.finish(json.dumps(reply))
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\json\__init__.py", line 244, in dumps
        return _default_encoder.encode(obj)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\json\encoder.py", line 207, in encode
        chunks = self.iterencode(o, _one_shot=True)
      File "C:\Users\3D Informatique\Anaconda2\envs\gl-env\lib\json\encoder.py", line 270, in iterencode
        return _iterencode(o, 0)
    UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 3058: invalid continuation byte
[E 10:50:49.621 NotebookApp] {
      "Content-Length": "76",
      "Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3",
      "Accept-Encoding": "gzip, deflate",
      "Host": "localhost:8888",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0",
      "Connection": "keep-alive",
      "X-Requested-With": "XMLHttpRequest",
      "Referer": "http://localhost:8888/notebooks/Untitled.ipynb",
      "Cookie": "_xsrf=2|8f1f4156|dd4db6f438afb5f69f025202cd831b99|1488024209; username-localhost-8888=\"2|1:0|10:1488047383|23:username-localhost-8888|44:MjgwYTViMDg0NWY5NDZhOThmY2UzMTYwYWVkMjI5OTY=|10df9ac0ad30797453aec7fe7f1b7e57def598a8f4157be9ae4998b3f76bc548\"",
      "Content-Type": "application/json"
    }
[E 10:50:49.624 NotebookApp] 500 POST /api/sessions (::1) 372.00ms referer=http://localhost:8888/notebooks/Untitled.ipynb`

Le fichier sp\xe9cifi\xe9 est introuvable is Le fichier spécifié est introuvable, which is Cannot find file.

It seems like your Python 2.7 conda environement is gone, so Python2.7.exe is not found.
You seem to be in an env called "gl-env" though.

What are the "kernel" >"Change Kernel" options ?

screen shot 2017-02-26 at 17 53 51

As @Carreau mentioned, it looks like your ipython kernel is failing to start.

What happens if you try running python -m ipykernel - that's the part that the jupyter notebook server is trying to do and failing on its own. If that command does indeed fail for you outside of the notebook, try python -m ipykernel --log-level DEBUG to get more information about why it fails.

It looks like you're running the notebook server using the gl-env environment. While having that environment active, you can re-install the ipython kernel using python -m ipykernel install

Like I said before I followed the stepss to install graphlab. That's why I'm using thin gl-env. But the same thing happens when I'm not using the environment. @Carreau for the "kernel" >"Change Kernel" options I only have Python 2.
@ivanov python -m ipykernel has been stuck for too long after printing

NOTE: When using the 'ipython kernel' entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


To connect another client to this kernel, use:
    --existing kernel-2896.json

and for python -m ipykernel --log-level DEBUG get stuck too in [IPKernelApp] Loading IPython extension: storemagic for too long
python -m ipykernel install give this: Installed kernelspec python2 in C:\ProgramData\jupyter\kernels\python2

It looks like python -m ipykernel install succeeded - can you try using the notebook again?

@takluyver still not working.

Can you run jupyter kernelspec list and post the output?

@takluyver
jupyter kernelspec list output:
Available kernels: python2 C:\Users\3D Informatique\AppData\Roaming\jupyter\kernels\python2

Can you try python -m ipykernel install --user and then using the notebook again?

@takluyver Ohh!! That worked thank you.

Great! For the record, I think the problem was that you'd done that previously in another environment which you'd deleted. Running that command tells it to use the environment you ran it from to start the kernel. So if you run that command and then delete the environment, it's trying to start a kernel that it can't find.

Running the same command from a new environment tells it to use that for the kernel, so it works again.

Thank you so much, the explanation helped a lot

I am having the same problem. When I use Jupyter Notebook the code inside the cells won't execute and I get these empty brackets ([ ]).
I had executed jupyter kernelspec list and output is
Available kernels:
python3 C:Users\USER\Anaconda3\share\jupyter\kernelspython3

then executed python -m ipykernel install --user
Installed kernelspec python3 in C:Users\USER\AppData\Roaming\jupyter\kernelspython3

But it is not working for me

@takluyver sir i had same issue it dint resolve

i have same problem please help

Following the above steps didn't solve my problem either, i have installed python 2 as well as python 3 but my notebook doesn't pick either kernel.

I had the same issue, looks like my code was exceeding recursion limit set by python. That's why it was crashing.

Even I encountered the same error!! Dono how to fix!!

@takluyver I tried all the method but still unable to fix the error.

On Ubuntu 18.04.1, I was able to solve this problem by running:

sudo pip uninstall jupyter
sudo apt install jupyter-notebook jupyter-core python-ipykernel
sudo python2 -m pip install --upgrade ipykernel

Change python2 to python3 if needed.

Just as a warning, if you are using sudo and pip, you risk breaking you
system and overwrite critical components. You should avoid using sudo with
pip unless you know what you are doing.

On Tue, Sep 4, 2018, 22:13 gzerveas notifications@github.com wrote:

On Ubuntu 18.04.1, I was able to solve this problem by running:

sudo pip uninstall jupyter
sudo apt install jupyter-notebook jupyter-core python-ipykernel
sudo python2 -m pip install --upgrade ipykernel

Change python2 to python3 if needed.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ipython/ipython/issues/10346#issuecomment-418502356,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAUez0zoWZasgMArnWJgAaHmKkJhvFmaks5uXt7egaJpZM4MMKul
.

Same problem as this?

Still unresolved.

i have same problem, i already try python -m ipykernel install --user and still cant run any code, please help :v

i faced the same problem while running jupyter notebook in my pc.
it was showing square brackets with an asterisk in between [*] .
platform : win-32
i didn't download anaconda and had manually downloaded jupyter notebook.
changing port jupyter notebook --port=8889 didn't work.
when i was using python -m ipykernel command, it was showing some kind of IO loop error.
that command was using tornado and i had tornado version 5.
it worked after i downgraded my tornado to version 4.5.1 like this

pip install tornado==2.6.2

On Ubuntu 18.04.1, I was able to solve this problem by running:

sudo pip uninstall jupyter
sudo apt install jupyter-notebook jupyter-core python-ipykernel
sudo python2 -m pip install --upgrade ipykernel

Change python2 to python3 if needed.

Same problem of the topic and;

pip install --upgrade ipykernel

Solved the problem here on windows 10.

Hey,
i have the following problem.
My notebook is not connected and i get * and no number for each cell, meaning it does not execute the commands. Any help around that and suggestions of tutos to understand the concept of jupyter, kernels etc (basics level)?

@amnanajib: Please create an own issue and describe your exact setup. For some reason the WebSocket communication seems to fail. But it could be any part of it...

This is a problem with Jupyter Notebook. Suddenly your codes will stop executing. Just go to Kernal in Jupyter Notebook and Click on Restart and Run All.
Your problem will be solved.

@takluyver I tried all the method but still unable to fix the error.

I was also troubling with same problem but I tried changing my environment variables, it solved everything.

@takluyver I tried all the method but still unable to fix the error.

I was also troubling with same problem but I tried changing my environment variables, it solved everything.

what variable?

I cannot execute my code in the cell, It appears [*] while running the code
How can I fix this?

@AasthaTimalsina I too had the same problem I fixed it with a solution of uninstalling tornado server and reinstalling with pip install tornado=4.5

Was this page helpful?
0 / 5 - 0 ratings