Kernel does not start in jupyter notebook when using other anaconda environment then base

Kernel does not start in jupyter notebook when using other anaconda environment then base.
I created a new environment called ‘idp’ with Intel optimized libraries, but when I run ‘jupyter notebook’ , The kernel does never start up. When I go back to ‘base’ environment it works again.
What can I do to make it work in any of my personal environments ?
I am using Anaconda on Windows 10.

May you elucidate what you mean by “the kernel does never start up”? You created the conda environment, did you add the environment as a kernel using ipykernel?

1 Like

Jupyter Notebook and Jupyter kernels are different things. You write that you have installed a kernel in a separate conda env, but have you also installed notebook there?

Anaconda has some special logic that can detect kernels across all conda environments on a machine. If you want to rely on that, you have to run “jupyter notebook” from the conda environment in which Jupyter Notebook and the special Anaconda logic is installed, then create a notebook with the kernel from your separate environment.

I start my new environment as follow:
conda activate idp

I run jupyter as follow:
jupyter notebook

In Jupiter I select ‘New’ and then ‘Python (idp)’

When it starts up my new notebook there is a block above that sais:
Kernel stating . Please wait …

It never starts up , ut waits forever. After a while I get a pop up saying it can’t connect.

That doesn’t sound like a problem caused by using a different conda environment. I’d rather suspect a setup problem with the Intel optimized libraries, which causes the kernel to crash on startup.

Have you take a look at the console output or log files generated by Jupyter?

So , this is what I did when I tried with a brand new environment …

conda create -n testenv
conda activate testenv
conda install jupyter
conda install ipykernel
python -m ipykernel install --user --name=testenv

I checked to see if my kernel.json file was correct in:
C:\Users\Frank\AppData\Roaming\jupyter\kernels\testenv

then I run:
jupyter notebook

I click on New an select notebook ‘testenv’

I get a screen that sais …

500 : Internal Server Error

My terminal output …

[I 18:05:50.089 NotebookApp] Creating new notebook in
[E 18:05:50.283 NotebookApp] Uncaught exception GET /notebooks/Untitled12.ipynb?kernel_name=testenv (::1)
HTTPServerRequest(protocol=‘http’, host=‘localhost:8888’, method=‘GET’, uri=’/notebooks/Untitled12.ipynb?kernel_name=testenv’, version=‘HTTP/1.1’, remote_ip=’::1’)
Traceback (most recent call last):
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\tornado\web.py”, line 1697, in execute
result = method(*self.path_args, **self.path_kwargs)
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\tornado\web.py”, line 3174, in wrapper
return method(self, *args, **kwargs)
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\notebook\notebook\handlers.py”, line 96, in get
get_frontend_exporters=get_frontend_exporters
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\notebook\base\handlers.py”, line 519, in render_template
return template.render(**ns)
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\jinja2\asyncsupport.py”, line 76, in render
return original_render(self, *args, **kwargs)
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\jinja2\environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\jinja2\environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\jinja2_compat.py”, line 37, in reraise
raise value.with_traceback(tb)
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\notebook\templates\notebook.html”, line 1, in top-level template code
{% extends “page.html” %}
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\notebook\templates\page.html”, line 154, in top-level template code
{% block header %}
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\notebook\templates\notebook.html”, line 114, in block “header”
{% for exporter in get_frontend_exporters() %}
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\notebook\notebook\handlers.py”, line 19, in get_frontend_exporters
from nbconvert.exporters.base import get_export_names, get_exporter
File "C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\nbconvert_init
.py", line 7, in
from . import postprocessors
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\nbconvert\postprocessors_init_.py”, line 5, in
from .serve import ServePostProcessor
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\nbconvert\postprocessors\serve.py”, line 18, in
class ProxyHandler(web.RequestHandler):
File “C:\Users\Frank\Anaconda3\envs\testenv\lib\site-packages\nbconvert\postprocessors\serve.py”, line 20, in ProxyHandler
@web.asynchronous
AttributeError: module ‘tornado.web’ has no attribute ‘asynchronous’
[E 18:05:50.299 NotebookApp] {
“Host”: “localhost:8888”,
“Connection”: “keep-alive”,
“Upgrade-Insecure-Requests”: “1”,
“User-Agent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36”,
“Sec-Fetch-Mode”: “navigate”,
“Accept”: “text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3”,
“Sec-Fetch-Site”: “same-origin”,
“Referer”: “http://localhost:8888/tree”,
“Accept-Encoding”: “gzip, deflate, br”,
“Accept-Language”: “en-US,en;q=0.9”,
“Cookie”: "_xsrf=2|ee15c9e3|538bb83691e837cabe36655a0a579432|1566173182; username-localhost-8891=“2|1:0|10:1566193573|23:username-localhost-8891|44:ZGJiYTcxZmY5ZmQyNDU1ZGFmNjVjMGJlZTY2NmJlZmE=|e4a30431dc65f8117257c27919ef117928fa5156d86c527db185d2c79cbcee7b”; username-localhost-8892=“2|1:0|10:1566193718|23:username-localhost-8892|44:NjgwM2U2MGE3YzE3NDY3NWIxOGJhZWU1MmZmZDBkOGI=|55cb8608a68e2977c576c39078fc655b3740705567b01499240cf7b26ece3cf9”; username-localhost-8856=“2|1:0|10:1566193786|23:username-localhost-8856|44:ZTI3MmMwMGQwYjhiNGI3Y2I3NWZiZDdkZTE5MmYzMDI=|1e3efe4c895e55a8a261c154b7b18904bca7dac739b914290bdd665557d37864”; username-localhost-8905=“2|1:0|10:1566193967|23:username-localhost-8905|44:OTBlYWE4NjZlMDRkNDljZGFmZDNjYmI0MWNiOWJkMDU=|5b306c62434a3688de40e3284e8ae77fd88deefc06a9496fd4e3e9cdce804b6e”; username-localhost-8889=“2|1:0|10:1566519692|23:username-localhost-8889|44:YjQzZjEwNGU4NmQ5NGRlYjg5YTA2NmQzOGE3M2VkODQ=|6591585857b189548fca750d42cd6a6fc45b00c75a61e75cf210665b694cc826”; username-localhost-8890=“2|1:0|10:1566519733|23:username-localhost-8890|44:ZWQwOTNjMWM1ZWZkNDU2NGFlY2E5ZTFmYTMxMDdlNmQ=|d56fbe29175bd94ee0925064af23684a7858874c5b9fa9bb821e2475287abf76”; username-localhost-8888=“2|1:0|10:1566522345|23:username-localhost-8888|44:Mjk5Mjg5OTc5NGY4NDNjZGEzZDZhNDA3NmUzOTRkZTc=|0ac11a0abae36d7187ead4f13c7f0b1502b26bb414078bfd05c48d8400fe1494"”
}
[E 18:05:50.300 NotebookApp] 500 GET /notebooks/Untitled12.ipynb?kernel_name=testenv (::1) 169.28ms referer=http://localhost:8888/tree
[W 18:05:50.318 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (::1) 3.02ms referer=http://localhost:8888/notebooks/Untitled12.ipynb?kernel_name=testenv
[W 18:05:50.336 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (::1) 2.03ms referer=http://localhost:8888/notebooks/Untitled12.ipynb?kernel_name=testenv

FYI …

I tried all the above on my MacBook IOS , and it totally worked . On my Windows 10 I’m still totally unsucsessful …

Please compare the Tornado versions installed in testenv on Mac and Windows.

Hi, I’m facing the same issue … Did you find any solution?

When this issue originated, there was some churn to get Tornado 6 supported across the Jupyter eco-system - which is where I believe @rolweber was heading. For example, this particular issue was resolved in nbconvert 5.4.1.

I recommend upgrading the various packages listed in jupyter --version.