Kernel Error in Jupyter Notebook

When I first started to use the Jupyter notebook for academic research, I got this error:
File “/opt/anaconda3/lib/python3.7/site-packages/tornado/web.py”, line 1699, in _execute
result = await result
File “/opt/anaconda3/lib/python3.7/site-packages/tornado/gen.py”, line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File “/opt/anaconda3/lib/python3.7/site-packages/notebook/services/sessions/handlers.py”, line 72, in post
type=mtype))
File “/opt/anaconda3/lib/python3.7/site-packages/tornado/gen.py”, line 735, in run
value = future.result()
File “/opt/anaconda3/lib/python3.7/site-packages/tornado/gen.py”, line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File “/opt/anaconda3/lib/python3.7/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 “/opt/anaconda3/lib/python3.7/site-packages/tornado/gen.py”, line 735, in run
value = future.result()
File “/opt/anaconda3/lib/python3.7/site-packages/tornado/gen.py”, line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File “/opt/anaconda3/lib/python3.7/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 “/opt/anaconda3/lib/python3.7/site-packages/tornado/gen.py”, line 735, in run
value = future.result()
File “/opt/anaconda3/lib/python3.7/site-packages/tornado/gen.py”, line 209, in wrapper
yielded = next(result)
File “/opt/anaconda3/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py”, line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File “/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/multikernelmanager.py”, line 110, in start_kernel
km.start_kernel(**kwargs)
File “/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/manager.py”, line 240, in start_kernel
self.write_connection_file()
File “/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/connect.py”, line 547, in write_connection_file
kernel_name=self.kernel_name
File “/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/connect.py”, line 212, in write_connection_file
with secure_write(fname) as f:
File “/opt/anaconda3/lib/python3.7/contextlib.py”, line 112, in enter
return next(self.gen)
File “/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/connect.py”, line 105, in secure_write
assert ‘0600’ == oct(stat.S_IMODE(os.stat(fname).st_mode)).replace(‘0o’, ‘0’)
AssertionError

When I tried to remotely connect to the Jupyter Notebook, I got an error along the lines of:
RuntimeError: Permissions assignment failed for secure file: ‘/u/ryotainagaki/temporary/kernel-0285403c-1fa0-4e0b-b092-0c1a21f183de.json’.Got ‘33279’ instead of ‘600’

I have tried renaming the files with the Kernels and I have tried changing the JUPYTER_RUNTIME_DIRRECTORY to a temporary file using the .bash_profile

These do not seem to prevent the error from being thrown, what should I do?

1 Like

I have the same problem facing

Hi - A couple of things here.

  1. It looks like you’re using older versions of jupyter_client and jupyter_core and, for this issue, it’s important to be updated. Please upgrade both modules. You should see the issue, if it still occurs, coming from jupyter_core following the update.
  2. Those permission bits (33279) correspond to Unix file permissions (o100777) and I suspect this is a mounted filesystem (like CIFS) which always creates files with execute bits enabled. I believe there are ways to configure CIFS to not do this. At any rate, one of the changes that you should receive by upgrading will tolerate execute bits in this particular check.

However, you may still get an error even after that fix due to the group/others perms. Unless the mounted filesystem configuration can be altered to reveal expected behavior (i.e., no fixed set of bits), you’re only recourse may be to set the environment variable JUPYTER_ALLOW_INSECURE_WRITES=true (or 1) and relaunch the notebook server. This will essentially bypass the enforcement of ensuring the kernel’s connection file is read-only by the owner (and, of course, is not recommended).