My username was changed and all the required permissions were applied. From aviralsrivastava, it is now aviral.s. Now that I am running the notebook, it is unable to use the Python3 kernel.

I tried looking into which python3 but in vain. I tried running normal Python3 terminal and it is working just fine. On these lines, I tried to change the hardcoded value but could not find any file where I have written this. Cannot grep the whole PC, it will be too expensive.

I run jupyter-notebook, it pops up and then I select the kernel, when the new file opens, I receive the kernel error; traceback is:

➜  leetcode git:(master) ✗ jupyter-notebook
[I 15:49:25.524 NotebookApp] Serving notebooks from local directory: /Users/aviral.s/dev/leetcode
[I 15:49:25.524 NotebookApp] The Jupyter Notebook is running at:
[I 15:49:25.524 NotebookApp] http://localhost:8888/?token=f90b585261f38a2d81363612c04ac29e3b703fa29e0275d3
[I 15:49:25.524 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 15:49:25.529 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///Users/aviral.s/Library/Jupyter/runtime/nbserver-10556-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=f90b585261f38a2d81363612c04ac29e3b703fa29e0275d3
[I 15:49:35.075 NotebookApp] Creating new notebook in
[W 15:49:36.786 NotebookApp] 404 GET /nbextensions/preload_import_code/main.js?v=20190513154924 (::1) 15.98ms referer=http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=python3
[E 15:49:36.843 NotebookApp] Failed to run command:
    ['/Users/aviralsrivastava/.pyenv/versions/3.5.2/bin/python3', '-m', 'ipykernel_launcher', '-f', '/Users/aviral.s/Library/Jupyter/runtime/kernel-42f7f33f-607b-4969-9a29-e3d4b130b104.json']
        PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin'
        with kwargs:
    {'stdin': -1, 'stdout': None, 'stderr': None, 'cwd': '/Users/aviral.s/dev/leetcode', 'start_new_session': True}

[E 15:49:36.844 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 "/usr/local/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
        result = await result
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 736, in run
        yielded = self.gen.throw(*exc_info)  # type: ignore
      File "/usr/local/lib/python3.7/site-packages/notebook/services/sessions/handlers.py", line 73, in post
        type=mtype))
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 729, in run
        value = future.result()
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 736, in run
        yielded = self.gen.throw(*exc_info)  # type: ignore
      File "/usr/local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session
        kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 729, in run
        value = future.result()
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 736, in run
        yielded = self.gen.throw(*exc_info)  # type: ignore
      File "/usr/local/lib/python3.7/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session
        self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 729, in run
        value = future.result()
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 209, in wrapper
        yielded = next(result)
      File "/usr/local/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 160, in start_kernel
        super(MappingKernelManager, self).start_kernel(**kwargs)
      File "/usr/local/lib/python3.7/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
        km.start_kernel(**kwargs)
      File "/usr/local/lib/python3.7/site-packages/jupyter_client/manager.py", line 259, in start_kernel
        **kw)
      File "/usr/local/lib/python3.7/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel
        return launch_kernel(kernel_cmd, **kw)
      File "/usr/local/lib/python3.7/site-packages/jupyter_client/launcher.py", line 138, in launch_kernel
        proc = Popen(cmd, **kwargs)
      File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 775, in __init__
        restore_signals, start_new_session)
      File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 1522, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '/Users/aviralsrivastava/.pyenv/versions/3.5.2/bin/python3': '/Users/aviralsrivastava/.pyenv/versions/3.5.2/bin/python3'
[W 15:49:36.852 NotebookApp] Unhandled error
[E 15:49:36.853 NotebookApp] {
      "Host": "localhost:8888",
      "Connection": "keep-alive",
      "Content-Length": "92",
      "Origin": "http://localhost:8888",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36",
      "Content-Type": "application/json",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "X-Requested-With": "XMLHttpRequest",
      "X-Xsrftoken": "2|3bff0b40|9294760095b41e1a569c200e6723723a|1557737196",
      "Dnt": "1",
      "Referer": "http://localhost:8888/notebooks/Untitled4.ipynb?kernel_name=python3",
      "Accept-Encoding": "gzip, deflate, br",
      "Accept-Language": "en-US,en;q=0.9,la;q=0.8",
      "Cookie": "_xsrf=2|3bff0b40|9294760095b41e1a569c200e6723723a|1557737196; username-localhost-8888=\"2|1:0|10:1557742767|23:username-localhost-8888|44:ZDNkYTM2MGU3Njc2NDVmZWI1YTUzMDhhZThjMDc4NGQ=|242760a043486b6685663ba3ed9845fc7d5546f1de615436dd139ced53131ade\""
    }

I expect the notebook to run normally and that I am able to determine from where this path /Users/aviralsrivastava/.pyenv/versions/3.5.2/bin/python3 is coming.

0 Answers