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

Kernel error in jupyter notebook #4909

Closed
Khushu06 opened this issue Sep 23, 2019 · 56 comments

Comments

@Khushu06
Copy link

@Khushu06 Khushu06 commented Sep 23, 2019

    km.start_kernel(**kwargs)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\manager.py", line 240, in start_kernel
    self.write_connection_file()
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
    kernel_name=self.kernel_name
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
    with secure_write(fname) as f:
  File "C:\Users\Khushboo.Girotra\anaconda3\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 100, in secure_write
    win32_restrict_file_to_user(fname)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 53, in win32_restrict_file_to_user
    import win32api
ImportError: DLL load failed: The specified procedure could not be found.``` 

I have re-install the anaconda as well . but still It is showing the same kernel error.
 Kernel json file shows :
{
 "argv": [
  "C:\\Users\\Khushboo.Girotra\\python.exe",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
} 

I have tried lot of solution which are already there but nothing works out . Kindly help
@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 23, 2019

Kindly respond

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 23, 2019

You might want to be sure the latest version (5.3.3) of jupyter_client is fully installed. Looks like this portion of its setup.py didn't run pywin32 >=1.0 ; sys_platform == 'win32'.

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 23, 2019

It's 5.3.3 version only but there is no file = setup.py under jupyter _client. Kindle elaborate

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 23, 2019

jupyter core : 4.5.0
jupyter-notebook : 6.0.1
qtconsole : 4.5.5
ipython : 7.8.0
ipykernel : 5.1.2
jupyter client : 5.3.3
jupyter lab : 1.1.3
nbconvert : 5.6.0
ipywidgets : 7.5.1
nbformat : 4.4.0
traitlets : 4.3.2

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 23, 2019

I'm referring to the setup.py that's in the repository: https://github.com/jupyter/jupyter_client/blob/5.3.3/setup.py
This file isn't laid down during installation but it's what is used during jupyter_client's installation.

You might try pip install --upgrade jupyter_client. You should have pywin32 installed.

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 23, 2019

I have installed anaconda , under that jupyter notebook also get installed .
I have 5.3.3 version and pywin32 is installed . Still there is kernel error.

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 23, 2019

I have 5.3.3 version and pywin32 is installed . Still there is kernel error.

Is the kernel failure still due to a DLL load failure - or something different now?
ImportError: DLL load failed: The specified procedure could not be found.

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 23, 2019

It's a same error of DLL load failed

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 23, 2019

       file:///C:/Users/Khushboo.Girotra/AppData/Roaming/jupyter/runtime/nbserver-13148-open.html
   Or copy and paste one of these URLs:
       http://localhost:8888/?token=ecaf07a435edebf1a26c758893d1dac7c4996693520529ff
    or http://127.0.0.1:8888/?token=ecaf07a435edebf1a26c758893d1dac7c4996693520529ff
[W 22:08:54.472 NotebookApp] Notebook Documents/Analytics bootcamp/python_decision_trees/decision_trees/decision_trees.ipynb is not trusted
[E 22:08:58.108 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')
   Traceback (most recent call last):
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\web.py", line 1699, in _execute
       result = await result
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
       yielded = self.gen.throw(*exc_info)  # type: ignore
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\handlers.py", line 72, in post
       type=mtype))
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
       value = future.result()
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
       yielded = self.gen.throw(*exc_info)  # type: ignore
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
       kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
       value = future.result()
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
       yielded = self.gen.throw(*exc_info)  # type: ignore
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
       self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
       value = future.result()
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 209, in wrapper
       yielded = next(result)
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
       super(MappingKernelManager, self).start_kernel(**kwargs)
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
       km.start_kernel(**kwargs)
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\manager.py", line 240, in start_kernel
       self.write_connection_file()
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
       kernel_name=self.kernel_name
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
       with secure_write(fname) as f:
     File "C:\Users\Khushboo.Girotra\anaconda3\lib\contextlib.py", line 112, in __enter__
       return next(self.gen)
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 100, in secure_write
       win32_restrict_file_to_user(fname)
     File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 53, in win32_restrict_file_to_user
       import win32api
   ImportError: DLL load failed: The specified procedure could not be found.
[W 22:08:58.140 NotebookApp] Unhandled error
[E 22:08:58.140 NotebookApp] {
     "Content-Type": "application/json",
     "Accept": "application/json, text/javascript, */*; q=0.01",
     "X-Xsrftoken": "2|272e5111|35d3dd9abc94bc322626eb0226eb4688|1568606969",
     "X-Requested-With": "XMLHttpRequest",
     "Referer": "http://localhost:8888/notebooks/Documents/Analytics%20bootcamp/python_decision_trees/decision_trees/decision_trees.ipynb",
     "Accept-Language": "en-IN",
     "Accept-Encoding": "gzip, deflate",
     "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",
     "Host": "localhost:8888",
     "Content-Length": "163",
     "Connection": "Keep-Alive",
     "Cache-Control": "no-cache",
     "Cookie": "_xsrf=2|272e5111|35d3dd9abc94bc322626eb0226eb4688|1568606969; username-localhost-8890=\"2|1:0|10:1569241500|23:username-localhost-8890|44:NjhmYTcwN2UyOWU3NGZkN2EzNDg2NWNkYWRiYjAwM2M=|2dd0b3cbedd7aec9ddb5a5487f6431906a442b75380dd0587e1d1b3e9f5f7475\"; username-localhost-8889=\"2|1:0|10:1569253558|23:username-localhost-8889|44:Mjg4OTcwZjIyMzJiNDkzMDkwZmVhZGY1Mzk2MGIwMGQ=|16708bbdcf21858ebb05eb126eea8fd1d1d23a770dd78f4c00427469bfa17d3c\"; username-localhost-8888=\"2|1:0|10:1569256712|23:username-localhost-8888|44:YjZkM2JjZDAwZmEyNDllMWI0NThhNzg0OTQ1YTRjM2M=|4d33dac2a071434c20d5ed0e0320c827950ec822c40925d68aa42b936e1e39e7\""
   }
[E 22:08:58.155 NotebookApp] 500 POST /api/sessions (::1) 312.31ms referer=http://localhost:8888/notebooks/Documents/Analytics%20bootcamp/python_decision_trees/decision_trees/decision_trees.ipynb```
@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 23, 2019

Thanks for the update. You'll need to figure out why import win32api is not working. There are a number of SO hits on this issue, some of which state that pip install pypiwin32 resolved the issue. I don't have access to a windows machine, so can't really help much more than this - sorry.

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 23, 2019

Thanks for giving me the directions !

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

Now it shows me the error of dead kernel. Kindly help on this

[I 10:33:32.182 NotebookApp] Loading IPython parallel extension
[I 10:33:32.292 NotebookApp] JupyterLab extension loaded from C:\Users\Khushboo.Girotra\anaconda3\lib\site-packages\jupyterlab
[I 10:33:32.292 NotebookApp] JupyterLab application directory is C:\Users\Khushboo.Girotra\anaconda3\share\jupyter\lab
[I 10:33:32.297 NotebookApp] Serving notebooks from local directory: C:\Users\Khushboo.Girotra
[I 10:33:32.298 NotebookApp] The Jupyter Notebook is running at:
[I 10:33:32.299 NotebookApp] http://localhost:8888/?token=8e24cc355a607b399fedca623643ddf1b2ebb428f69c39bc
[I 10:33:32.300 NotebookApp]  or http://127.0.0.1:8888/?token=8e24cc355a607b399fedca623643ddf1b2ebb428f69c39bc
[I 10:33:32.301 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:33:32.755 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/Khushboo.Girotra/AppData/Roaming/jupyter/runtime/nbserver-8844-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=8e24cc355a607b399fedca623643ddf1b2ebb428f69c39bc
     or http://127.0.0.1:8888/?token=8e24cc355a607b399fedca623643ddf1b2ebb428f69c39bc
[W 10:33:50.064 NotebookApp] Notebook Documents/Analytics bootcamp/python_decision_trees/decision_trees/decision_trees.ipynb is not trusted
[I 10:33:53.885 NotebookApp] Kernel started: a869e91b-d19d-478e-b2a7-6fda11ce89f5
Traceback (most recent call last):
  File "C:\Users\Khushboo.Girotra\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\Khushboo.Girotra\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\ipykernel_launcher.py", line 16, in <module>
    app.launch_new_instance()
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\traitlets\config\application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<C:\Users\Khushboo.Girotra\lib\site-packages\decorator.py:decorator-gen-125>", line 2, in initialize
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\ipykernel\kernelapp.py", line 530, in initialize
    self.write_connection_file()
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\ipykernel\kernelapp.py", line 227, in write_connection_file
    iopub_port=self.iopub_port, control_port=self.control_port)
  File "C:\Users\Khushboo.Girotra\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
    with secure_write(fname) as f:
  File "C:\Users\Khushboo.Girotra\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\Khushboo.Girotra\lib\site-packages\jupyter_client\connect.py", line 100, in secure_write
    win32_restrict_file_to_user(fname)
  File "C:\Users\Khushboo.Girotra\lib\site-packages\jupyter_client\connect.py", line 53, in win32_restrict_file_to_user
    import win32api
ImportError: DLL load failed: The specified procedure could not be found.
[I 10:33:59.591 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
[IPKernelApp] ERROR | Failed to load connection file: 'C:\\Users\\Khushboo.Girotra\\AppData\\Roaming\\jupyter\\runtime\\kernel-a869e91b-d19d-478e-b2a7-6fda11ce89f5.json'
Traceback (most recent call last):
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\ipykernel\kernelapp.py", line 252, in init_connection_file
    self.load_connection_file()
  File "C:\Users\Khushboo.Girotra\lib\site-packages\jupyter_client\connect.py", line 569, in load_connection_file
    info = json.load(f)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[I 10:34:02.637 NotebookApp] KernelRestarter: restarting kernel (2/5), keep random ports
[IPKernelApp] ERROR | Failed to load connection file: 'C:\\Users\\Khushboo.Girotra\\AppData\\Roaming\\jupyter\\runtime\\kernel-a869e91b-d19d-478e-b2a7-6fda11ce89f5.json'
Traceback (most recent call last):
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\ipykernel\kernelapp.py", line 252, in init_connection_file
    self.load_connection_file()
  File "C:\Users\Khushboo.Girotra\lib\site-packages\jupyter_client\connect.py", line 569, in load_connection_file
    info = json.load(f)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[I 10:34:05.668 NotebookApp] KernelRestarter: restarting kernel (3/5), keep random ports
[IPKernelApp] ERROR | Failed to load connection file: 'C:\\Users\\Khushboo.Girotra\\AppData\\Roaming\\jupyter\\runtime\\kernel-a869e91b-d19d-478e-b2a7-6fda11ce89f5.json'
Traceback (most recent call last):
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\ipykernel\kernelapp.py", line 252, in init_connection_file
    self.load_connection_file()
  File "C:\Users\Khushboo.Girotra\lib\site-packages\jupyter_client\connect.py", line 569, in load_connection_file
    info = json.load(f)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[I 10:34:08.695 NotebookApp] KernelRestarter: restarting kernel (4/5), keep random ports
[IPKernelApp] ERROR | Failed to load connection file: 'C:\\Users\\Khushboo.Girotra\\AppData\\Roaming\\jupyter\\runtime\\kernel-a869e91b-d19d-478e-b2a7-6fda11ce89f5.json'
Traceback (most recent call last):
  File "C:\Users\Khushboo.Girotra\AppData\Roaming\Python\Python37\site-packages\ipykernel\kernelapp.py", line 252, in init_connection_file
    self.load_connection_file()
  File "C:\Users\Khushboo.Girotra\lib\site-packages\jupyter_client\connect.py", line 569, in load_connection_file
    info = json.load(f)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "C:\Users\Khushboo.Girotra\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Khushboo.Girotra\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[W 10:34:11.713 NotebookApp] KernelRestarter: restart failed
[W 10:34:11.714 NotebookApp] Kernel a869e91b-d19d-478e-b2a7-6fda11ce89f5 died, removing from map.
[W 10:34:54.178 NotebookApp] Timeout waiting for kernel_info reply from a869e91b-d19d-478e-b2a7-6fda11ce89f5
[E 10:34:54.181 NotebookApp] Error opening stream: HTTP 404: Not Found (Kernel does not exist: a869e91b-d19d-478e-b2a7-6fda11ce89f5)
[W 10:34:55.240 NotebookApp] 404 GET /api/kernels/a869e91b-d19d-478e-b2a7-6fda11ce89f5/channels?session_id=fe921aa3776f48e79b7232347f66318f (::1): Kernel does not exist: a869e91b-d19d-478e-b2a7-6fda11ce89f5
[W 10:34:55.286 NotebookApp] 404 GET /api/kernels/a869e91b-d19d-478e-b2a7-6fda11ce89f5/channels?session_id=fe921aa3776f48e79b7232347f66318f (::1) 46.89ms referer=None
[W 10:34:57.395 NotebookApp] Replacing stale connection: a869e91b-d19d-478e-b2a7-6fda11ce89f5:fe921aa3776f48e79b7232347f66318f```
@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 24, 2019

This is still the same issue, failed import of win32api. Did you try pip install pywin32 into the correct environment? Looks like you're hitting this issue: conda-forge/jupyter_client-feedstock#29 (so at least you're not alone 😄)

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

I have installed pywin32 , what does correct environment mean here?

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

How should I resolve it ? I tried a lot reading lot of stuffs on github and solving it, but nothing works out. Please help

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 24, 2019

If you're dealing with virtual envs or conda environments, where you installed pywin32 matters. I would create a one line python script that imports win32api and get that python script to not throw ModuleNotFoundError.

import win32api

save into import_win32api.py. If you invoke python import_win32api.py in the same env as you run Notebook, you should get something like ModuleNotFoundError: No module named 'win32api'. You'll know things are better when that same invocation yields nothing (indicating the import statement worked).

Also focus on where your python command is coming from (and relative to your jupyter command). The multiple envs can be confusing.

((I had also referenced pypiwin32 before since that's what SO posts used, but try pywin32 as well.))

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

I got this error when I run this :

(base) C:\Users\Khushboo.Girotra>python import_win32api.py
Traceback (most recent call last):
File "import_win32api.py", line 1, in
import win32api
ImportError: DLL load failed: The specified procedure could not be found.

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 24, 2019

That's good actually. So now try to get pywin32 installed in such a way that the import statement succeeds.

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

but how ? what's the other way

@jasongrout

This comment has been minimized.

Copy link
Member

@jasongrout jasongrout commented Sep 24, 2019

Try conda install pywin32 if you are using conda.

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

I did that , still showing the same error.

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

2 days back everything was working fine. Suddenly dead kernel issue pops up

@Khushu06

This comment has been minimized.

Copy link
Author

@Khushu06 Khushu06 commented Sep 24, 2019

ModuleNotFoundError: No module named 'win32api' . This is the error which I am getting now

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 25, 2019

@minrk updated the dependencies in conda-forge earlier today. These instructions might help get you going: https://github.com/conda-forge/jupyter_client-feedstock#installing-jupyter_client

@lemuelaspe

This comment has been minimized.

Copy link

@lemuelaspe lemuelaspe commented Sep 30, 2019

Same problem [kernel error]
I've got this error

Traceback (most recent call last):
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\Users\Lemuel\Anaconda3\lib\contextlib.py", line 112, in enter
return next(self.gen)
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 100, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\Lemuel\AppData\Roaming\Python\Python37\site-packages\jupyter_client\connect.py", line 53, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: %1 is not a valid Win32 application.

please help me. thanks

@lemuelaspe

This comment has been minimized.

Copy link

@lemuelaspe lemuelaspe commented Sep 30, 2019

I try installing pip install pypiwin32 but when i run import win32api i got this error
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: DLL load failed: %1 is not a valid Win32 application.

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Sep 30, 2019

Please try relative to pywin32. Since this is a conda env - you might be better off with conda install pywin32.

@lemuelaspe

This comment has been minimized.

Copy link

@lemuelaspe lemuelaspe commented Sep 30, 2019

It wont worked. I will try to re-install anaconda3 then create env for tensorflow-gpu then retry the process on launching jupyter notebook, I will update you if i got same error. Thank you for your response sir.

I've been following this step on installing tensorflow-gpu for object_detection but i stack while running this command (tensorflow1) C:\tensorflow1\models\research\object_detection> jupyter notebook object_detection_tutorial.ipynb. This is the github repository that i followed on installing tensorflow-gpu.

@mosharafMS

This comment has been minimized.

Copy link

@mosharafMS mosharafMS commented Oct 4, 2019

I had the same issue and was resolved by running the anaconda navigator as administrator and launched jupyter

@rbscholtus

This comment has been minimized.

Copy link

@rbscholtus rbscholtus commented Oct 4, 2019

Thanks big time Galileo-Galilei, downgrading pywin32 to 224 fixed the issue for me too. For my virtualenv, that is:
pipenv run pip install --upgrade pywin32==224
And ye, pywin32==225 was released 15 Sep, pretty much the time I updated a load of modules + when Jupyter broke, so it all makes sense now.

@AdityaJakkam

This comment has been minimized.

Copy link

@AdityaJakkam AdityaJakkam commented Oct 4, 2019

Thanks, @Galileo-Galilei, downgrading pywin32 from 225 to 224 resolved every kernel issue I'm having (ir, python2, and python3). Like @rbscholtus said the new version of pywin32 broke Jupyter completly.

@gloriamacia

This comment has been minimized.

Copy link

@gloriamacia gloriamacia commented Oct 5, 2019

Thanks a lot @Galileo-Galilei! This solved the issue for me too. As for the others, please note that if you have several conda virtual environments and you use them as a kernel in jupyter notebook. The process he mentioned needs to be repeated for each of them after activating them! So happy I got this working after 2 useless days

@ratnanil

This comment has been minimized.

Copy link

@ratnanil ratnanil commented Oct 11, 2019

Try conda install pywin32 if you are using conda.

this solved it for me

@sourcecode369

This comment has been minimized.

Copy link

@sourcecode369 sourcecode369 commented Oct 19, 2019

@minrk updated the dependencies in conda-forge earlier today. These instructions might help get you going: https://github.com/conda-forge/jupyter_client-feedstock#installing-jupyter_client

This worked for me. Thanks a bunch.

@daniellovett

This comment has been minimized.

Copy link

@daniellovett daniellovett commented Oct 24, 2019

Hello,

I got through the same error today (this is really annoying, especially because it also breaks vscode interactive window and all my kernels).

After checking, pywin32 had a release 15 days ago for the first time in one year. Downgrading in my environment make jupyter work again (but it is obviously not a fix) :
pip install --upgrade pywin32==224

Note that creating a new environment from scratch does not fix your problem : pip install jupyter reinstall pywin32==225 which is buggued and seems not to work on windows in its current state.

Thanks, confirming that downgrading solved the same issue for me as well.

@Banashree96

This comment has been minimized.

Copy link

@Banashree96 Banashree96 commented Oct 25, 2019

Traceback (most recent call last): File "E:\Anaconda\lib\site-packages\tornado\web.py", line 1699, in _execute result = await result File "E:\Anaconda\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File "E:\Anaconda\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post type=mtype)) File "E:\Anaconda\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "E:\Anaconda\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File "E:\Anaconda\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name) File "E:\Anaconda\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "E:\Anaconda\lib\site-packages\tornado\gen.py", line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File "E:\Anaconda\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name) File "E:\Anaconda\lib\site-packages\tornado\gen.py", line 735, in run value = future.result() File "E:\Anaconda\lib\site-packages\tornado\gen.py", line 209, in wrapper yielded = next(result) File "E:\Anaconda\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel super(MappingKernelManager, self).start_kernel(**kwargs) File "E:\Anaconda\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel km.start_kernel(**kwargs) File "E:\Anaconda\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel self.write_connection_file() File "E:\Anaconda\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file kernel_name=self.kernel_name File "E:\Anaconda\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file with secure_write(fname) as f: File "E:\Anaconda\lib\contextlib.py", line 112, in __enter__ return next(self.gen) File "E:\Anaconda\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f: PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Shivu\\AppData\\Roaming\\jupyter\\runtime\\kernel-a385ff0a-a21f-4f08-a75f-f22555578da2.json'

What can be the issue? Please help

@Banashree96

This comment has been minimized.

Copy link

@Banashree96 Banashree96 commented Oct 25, 2019

This is shown under kernel error. None of the notebooks are being Executed

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Oct 25, 2019

Please update jupyter_client and jupyter_core to their latest versions - 5.3.4 and 4.6.1 respectively. If that doesn't solve your issue, the error message produced has better diagnostics to help drive the exercise. Thanks.

@bayoishola20

This comment has been minimized.

Copy link

@bayoishola20 bayoishola20 commented Oct 25, 2019

Had same issue and upgrading jupyter_client worked.

pip3 install --upgrade jupyter_client

@kevin-bates

This comment has been minimized.

Copy link
Member

@kevin-bates kevin-bates commented Oct 25, 2019

Closing issue based on recent successes.

Using the latest versions of jupyter_client (>=5.3.4) and jupyter_core (>=4.6.1) should be attempted prior to opening a new issue. Thank you.

@davystrong

This comment has been minimized.

Copy link

@davystrong davystrong commented Oct 25, 2019

I encountered this problem too but I wasn't using Anaconda. Turns out there's another step (it's in the pywin32 README):

Note that if you want to use pywin32 for "system wide" features, such as registering COM objects or implementing Windows Services, then you must run the following command from an elevated command prompt:
python Scripts/pywin32_postinstall.py -install

Hope this helps someone!

@ralfhauser

This comment has been minimized.

Copy link

@ralfhauser ralfhauser commented Oct 30, 2019

$ pip3 install --upgrade pywin32==224 --force-reinstall
ERROR: Could not find a version that satisfies the requirement pywin32==224 (from versions: 225)
ERROR: No matching distribution found for pywin32==224

@MeCrazyJunkie

This comment has been minimized.

Copy link

@MeCrazyJunkie MeCrazyJunkie commented Oct 31, 2019

I encountered this problem too but I wasn't using Anaconda. Turns out there's another step (it's in the pywin32 README):

Note that if you want to use pywin32 for "system wide" features, such as registering COM objects or implementing Windows Services, then you must run the following command from an elevated command prompt:
python Scripts/pywin32_postinstall.py -install

Hope this helps someone!

Thanks! It helped me with this problem having all updated versions of python and jupyter.

@ZhentangHe

This comment has been minimized.

Copy link

@ZhentangHe ZhentangHe commented Nov 7, 2019

Please try relative to pywin32. Since this is a conda env - you might be better off with conda install pywin32.

Thx, it worked for me

@pkumar-a

This comment has been minimized.

Copy link

@pkumar-a pkumar-a commented Nov 8, 2019

My system is Windows 64 bit. This solved for me.

conda install -c conda-forge pywin32
conda install -c anaconda jupyter_client
conda install -c conda-forge jupyter_core

@andreqts

This comment has been minimized.

Copy link

@andreqts andreqts commented Nov 10, 2019

That didnt solve for me :(
I've already uninstalled and reinstalled using different options, nothing worked.
When I start Spyder the same error happens.
I already uninstalled, cleaned the registry, deleted anything I could find related to Anaconda, and reinstalled it, and the same error happens. It's very frustrating.

@andreqts

This comment has been minimized.

Copy link

@andreqts andreqts commented Nov 10, 2019

Solved now! I had to uninstall and also delete the Python folder inside C:\Users[MY USER NAME]\AppData\Roaming before reinstalling. I also deleted everything related to Anaconda and Python in the disk and registry. Thank you anyway.

@like5150

This comment has been minimized.

Copy link

@like5150 like5150 commented Nov 13, 2019

My system is Windows 64 bit. This solved for me.

conda install -c conda-forge pywin32
conda install -c anaconda jupyter_client
conda install -c conda-forge jupyter_core

OMG bro you save me!
Thanks!

@42kun

This comment has been minimized.

Copy link

@42kun 42kun commented Nov 15, 2019

pip install --upgrade pywin32==224
thank you very much,it work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.