-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Running jupyter notebook
opens visual studio code, not a browser
#4304
Comments
@yuvipanda is this resolved? if so what did you do? |
@bharathgs nope! I just run --no-browser now and copy the URL manually |
Same thing happened to me - I suspect vscode has been set as the default handler for html files and jupyter notebook uses the default association. |
We use the python webbrowser module to pop up the browser. You can check with something like You can also set the BROWSER environment variable for your command invocation, with something like: BROWSER=/path/to/browser jupyter notebook |
@jasongrout 'python -m webbrowser -t "http://www.python.org"' loads in a browser, but I don't personally have a problem with setting browser environment, but this means the default experience for people who are told to run 'jupyter lab' on their terminal and a 'browser will pop up' is going to fail. That seems confusing and unideal. |
Gah, that's annoying. Which platform(s) are people seeing that on? I had assumed |
We can't launch the browser to an HTTP URL which then redirects to a file, because redirecting to file:// URLs is not allowed. |
@takluyver I'm on Ubuntu Linux |
@takluyver platform:Ubuntu 18.10 |
OK, I'm assuming that the webbrowser module is calling Can you both check I haven't thought of any good way to avoid this, given that launching with Of course, with problems like this it's always tempting to add a config option to 'do it the old way'. I'm trying to avoid that. Settings shouldn't make it too easy to remove security, because in a few years people will follow instructions they find to change the setting without understanding the implications. You can already solve this problem with configuration by setting e.g. Any better ideas before I start trying to code a workaround? |
I can reproduce this on mac if I associate html files with an editor (doesn't appear to be the default). Mac uses I think discovering the default browser on all platforms is going to be a pretty big pain, but I can look into it on mac, at least. |
Found the mac API for discovering the default browser and calling it via ctypes: https://nbviewer.jupyter.org/gist/minrk/0ea42a1d4bafde85c7699bac84d078a1 not sure if there's a better way. |
For Linux, the webbrowser module is already calling I was thinking of making a priority order on Linux something like this:
I don't know how many users would end up with a browser that's not their preferred default that way, but hopefully it's easy to configure your way out of that. The situation on Mac seems more complex. |
and
on my machine (Ubuntu 18.10 + GNOME) |
I had the same issue on Ubuntu linux. |
Best way to solve this problem :
|
@naushadS that does the trick, wonderful |
Same thing happened to me yesterday - after an odd event in my ubuntu 16. I opened ubuntu after leaving it on overnight. It was logged in as guest instead as myself ( nobody touched the machine). My working conda environment was gone, and launching jupyter notebook defaulted to visual studio code where before it launched firefox.
then in bash I checked
I went back to python, this time outside my environment:
So, clearly its in my conda enviro. So generated a config Fixed. |
@naushadS, it worked for me. Smart move ;-) |
Happens with Azure Data Studio, which started from a fork of Visual Studio Code as well. |
that trick does well. Thank you very much. You save a lot of time |
The above did not work for me (Ubuntu 18.04). In my case the issue was not the
worked. For Firefox you can use |
Hello everyone, |
I also had this problem on my windows. Every time I ran "jupyter notebook" in commad line, it opened a text file in sublime text! It think it happend because I had set the default program for opening html files to be sublime text! But I could solve it:) Just go to the windows setting and then go to "default apps". And then click on "reset". It solved the problem for me. |
I followed the following steps: I created the configuration file: jupyter notebook --generate-config |
yeah thankyou, lol its already solved from long time ago hehe..
…On Wed, May 13, 2020, 20:50 Luiz Carlos Muniz ***@***.*** wrote:
I followed the following steps:
I created the configuration file: jupyter notebook --generate-config
I edited the file vi ~ / .jupyter / jupyter_notebook_config.py
I uncommented the line below and changed it from True to False:
Before: # c.NotebookApp.use_redirect_file = True
After: c.NotebookApp.use_redirect_file = False
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4304 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHQZTHWIHCTMZJ7OZAESDQ3RRKQRXANCNFSM4GMMTBJQ>
.
|
Perfect and easy solution thanks |
yup, this one works |
Thanks you very much! |
Thanks for reporting this issue. This is something we will need to be aware of for Notebook 7.0 based on JupyterLab. It seems like these could annoy some folks. We may need to update the documentation to include these work arounds. |
Best Method: Jupyter not opening in browser but opens in some other software (vscode, pdf viewer etc)
|
I am on windows and was facing the same issue. Simply go to default app in settings and set your browser as the default option. You will notice that for .html files VS code was earlier set as the default. Just choose your preferred browser as the default. |
Thanks @Samarth12121 for commenting. Maybe this could be added to the documentation in a FAQ / Troubleshooting section? |
I also had this problem on my windows. Every time I launched "Jupyter notebook" from Anaconda, it opened an HTML file in VS Code! I think it happened because I had set the default program for opening html files to be VS code! Here is what I did to resolve it:
Once I did this, I could launch Jupyter Notebook and it immediately opened in my Chrome Browser. |
@naushadS Thanks worked for me....really helpful |
What's the reason for opening the redirection HTML (e.g. jpserver-3468-open.html) page itself? Why not just open the http://localhost:8888/... directly when the notebook server starts? |
found a 100% Solution for this and it's too simple. Just follow the tips. As you launch the Jupyter Notebook with the Anaconda, if It opens with VS Code or other. And then Follow my Steps to fix it.
Or Follow on this source : deepdecide |
It happens when VS Code has been set as the default handler for html file. You need to reset to your browser |
If I run
jupyter notebook
, it pops up an empty instance of vscode for me - rather than a browser. I believe this is because .html files are opened in vscode on my system, rather than via the browser.It took me a few tries to figure out why this was happening. We should maybe have better browser detection?
The text was updated successfully, but these errors were encountered: