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

Jupyter Notebook can't execute any code in cell #10346

Closed
BLeila opened this issue Feb 25, 2017 · 34 comments
Closed

Jupyter Notebook can't execute any code in cell #10346

BLeila opened this issue Feb 25, 2017 · 34 comments
Milestone

Comments

@BLeila
Copy link

BLeila commented Feb 25, 2017

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

@ivanov
Copy link
Member

ivanov commented Feb 26, 2017

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.

@BLeila
Copy link
Author

BLeila commented Feb 26, 2017

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`

@Carreau
Copy link
Member

Carreau commented Feb 27, 2017

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

@ivanov
Copy link
Member

ivanov commented Feb 27, 2017

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

@BLeila
Copy link
Author

BLeila commented Feb 27, 2017

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

@takluyver
Copy link
Member

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

@BLeila
Copy link
Author

BLeila commented Feb 27, 2017

@takluyver still not working.

@takluyver
Copy link
Member

Can you run jupyter kernelspec list and post the output?

@BLeila
Copy link
Author

BLeila commented Feb 27, 2017

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

@takluyver
Copy link
Member

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

@BLeila
Copy link
Author

BLeila commented Feb 28, 2017

@takluyver Ohh!! That worked thank you.

@BLeila BLeila closed this as completed Feb 28, 2017
@takluyver
Copy link
Member

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.

@Carreau Carreau modified the milestone: no action May 30, 2017
@Malaratgithub
Copy link

Thank you so much, the explanation helped a lot

@s13varun
Copy link

s13varun commented Mar 1, 2018

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\kernels\python3

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

But it is not working for me

@adihk97
Copy link

adihk97 commented Mar 21, 2018

@takluyver sir i had same issue it dint resolve

@Ashutosh19986
Copy link

i have same problem please help

@tushar629
Copy link

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.

@hemanthsavasere
Copy link

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

@ActiveNeuron
Copy link

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

@ActiveNeuron
Copy link

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

@gzerveas
Copy link

gzerveas commented Sep 4, 2018

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.

@Carreau
Copy link
Member

Carreau commented Sep 4, 2018 via email

@abalter
Copy link

abalter commented Sep 13, 2018

Same problem as this?

Still unresolved.

@LunaticKiarra
Copy link

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

@abalter
Copy link

abalter commented Sep 13, 2018

See also jupyter/notebook#3910

@tarajb
Copy link

tarajb commented Sep 21, 2018

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 

@No-O-ne
Copy link

No-O-ne commented Sep 28, 2018

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.

@amnanajib
Copy link

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)?

@1kastner
Copy link

@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...

@tanejasarthak
Copy link

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.

@Amarnathpg123
Copy link

@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.

@akbarnotopb
Copy link

@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?

@AasthaTimalsina
Copy link

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

@litesam
Copy link

litesam commented Mar 29, 2019

@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

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