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

JupyterLab fails looking for old Anaconda installation, not new (Homebrew) location #4363

Closed
bobtodd opened this issue Apr 11, 2018 · 7 comments
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@bobtodd
Copy link

bobtodd commented Apr 11, 2018

Howdy y'all,

I used to have Anaconda installed via the Mac OS installer in my home folder in the default location ($HOME/anaconda). Referring to this thread, which itself refers to the official Anaconda instructions, I uninstalled Anaconda.

I reinstalled Anaconda from the Homebrew Cask (placing export PATH=/usr/local/anaconda3/bin:"$PATH" in my .bashrc). Now when I

  • run jupyter-lab,
  • create a new notebook, and
  • select a Python 3 kernel,

the process fails with the following output:

Traceback (most recent call last):
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
    result = yield result
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 73, in post
    type=mtype))
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/usr/local/anaconda3/lib/python3.6/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/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/usr/local/anaconda3/lib/python3.6/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/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper
    yielded = next(result)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 148, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 259, in start_kernel
    **kw)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "/usr/local/anaconda3/lib/python3.6/site-packages/jupyter_client/launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "/usr/local/anaconda3/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/local/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '~/anaconda/bin/python': '~/anaconda/bin/python'

I'm not sure why this error is occurring: I specifically removed all of the $HOME/anaconda references from my path. Does anyone happen to know why the program would be searching $HOME/anaconda (my old install location), when Homebrew installed (without error) into /usr/local/anaconda3? I'm not clear on where JupyterLab could be looking, such that it finds a reference to that old path, when I've removed it from my user setup. Everything else in the traceback is correctly looking in /usr/local/anaconda3/.

I've tried using grep to find what file might have that old path stored in it, and all I find is Library/Caches/com.apple.Safari/WebKitCache/Version 12/Records/. Presumably that's because JupyterLab opened with my default browser as Safari. But when I try to run in Chrome, I get the same error.

I tried seeking help with the folks at Homebrew, but it seems this is not quite in their purview.

Any suggestions would be greatly appreciated.

Peace out,
Todd

@bobtodd
Copy link
Author

bobtodd commented Apr 11, 2018

It was suggested that I post the question to StackOverflow, so as not to take up project bandwidth here. I've asked the question here. Closing the issue.

@bobtodd bobtodd closed this as completed Apr 11, 2018
@jasongrout jasongrout added this to the Reference milestone Apr 11, 2018
@jasongrout
Copy link
Contributor

Perhaps it is a kernel config file pointing there? Try doing jupyter kernelspec list to see where your kernels are defined, and look at those to see if one references the old path.

@bobtodd
Copy link
Author

bobtodd commented Apr 12, 2018

Super. Thanks for pointing out that command. My output is

> jupyter kernelspec list
Available kernels:
  python3    ~/Library/Jupyter/kernels/python3

Looking in that directory, there's a file kernel.json (which is roughly a year old, so older than my new install) with the following contents:

{
 "display_name": "Python 3",
 "argv": [
  "~/anaconda/bin/python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "language": "python"
}

It looks like you're right that that's (at least one of the places) where JupyterLab is picking up that path from.

How do you suggest I fix this? Should I edit the file directly inserting the output of which

> which python3
/usr/local/anaconda3/bin/python3

which is what I'd be expecting given the setup with Anaconda installed via Homebrew? Or should I remove the file... and perhaps let the system rebuild it (if it does that)?

Thanks very much for the help.

@bobtodd bobtodd reopened this Apr 12, 2018
@jasongrout
Copy link
Contributor

If I were you, I'd just delete that directory. Then check to see if jupyter kernelspec list gives another kernel.

@bobtodd
Copy link
Author

bobtodd commented Apr 13, 2018

Great suggestion. I removed the directory and re-ran jupyter kernelspec list. That yielded

> jupyter kernelspec list
Available kernels:
  python3    /usr/local/anaconda3/share/jupyter/kernels/python3

as hoped. Things seem to be working now. Thanks for the help.

@tzuhsuancheng
Copy link

Thanks for the help!!!!

@jasongrout
Copy link
Contributor

No problem!

@lock lock bot added the status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Aug 8, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

No branches or pull requests

3 participants