0

I installed jupyter notebook on my computer for a RHEL system, I installed it using the command pip3 install --user jupyter and then later due to it not working pip3 install --force-reinstall --user jupyter, so know I have my jupyter files stored in my ~/.local/bin directory. I am not an administrator or superuser for the cluster I work off of, this is why I installed in ~/.local/bin. Now whenever I launch a jupyter notebook, and open a .ipynb file, the kernel stays in `Kernel Starting, please wait..." until the kernel just exits. I've tried to see if the browser affected it, and now I've tried it on Internet Explorer 11, Chrome, and Edge and they all do the same thing. I have no idea what could be keeping the kernel from loading.

EDIT (02-DEC-2019): There seems to be a possible solution detailed here, however, these are solutions that describe how to downgrade on a windows system, where is I'm operating off a linux based operating system.

EDIT (03-DEC-2019): After investigating further, I found that the "Kernel Starting, please wait..." message on the Jupyter page corresponds to the terminal echo:

RuntimeError: Permissions assignment failed for secure file: ':/path/to/user/tmp/jupyter-kernel:/path/to/user/jupyter-kernel/kernel-66b8b6e5-5e4c-4b05-98e9-870a5b431088.json'.Got '0o1600' instead of '0o0600'

This problem seems to be talked about on the github issues page for Jupyter, and I tried doing what was prescribed, that being changing the $JUPYTER_RUNTIME_DIR to a new location and that didn't work (I actually tried to different directory locations), I made sure the kernel .json files were in the right location and everything. I still continue to get the same error. The os.name that my system gives me is POSIX so I don't know if that's the underlying problem, as the error is sourced to a file called paths.py, and seems to be a problem in secure_write(), here's a portion of the code:

@contextmanager
def secure_write(fname, binary=False):
    """Opens a file in the most restricted pattern available for
    writing content. This limits the file mode to `0o0600` and yields
    the resulting opened filed handle.

    Parameters
    ----------

    fname : unicode
        The path to the file to write

    binary: boolean
        Indicates that the file is binary
    """
    mode = 'wb' if binary else 'w'
    open_flag = os.O_CREAT | os.O_WRONLY | os.O_TRUNC
    try:
        os.remove(fname)
    except (IOError, OSError):
        # Skip any issues with the file not existing
        pass

    if os.name == 'nt':
        # Python on windows does not respect the group and public bits for chmod, so we need
        # to take additional steps to secure the contents.
        # Touch file pre-emptively to avoid editing permissions in open files in Windows
        fd = os.open(fname, os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o0600)
        os.close(fd)
        open_flag = os.O_WRONLY | os.O_TRUNC
        win32_restrict_file_to_user(fname)

    with os.fdopen(os.open(fname, open_flag, 0o0600), mode) as f:
        if os.name != 'nt':
            # Enforce that the file got the requested permissions before writing
            file_mode = get_file_mode(fname)
            if 0o0600 != file_mode:
                raise RuntimeError("Permissions assignment failed for secure file: '{file}'."
                    "Got '{permissions}' instead of '0o0600'"
                    .format(file=fname, permissions=oct(file_mode)))
        yield f

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.