Running Sage on WSL2 doesn't open jupyter notebook
I've installed Sage on a Windows 11 machine. I installed WSL2 and Ubuntu through the Windows Store. I then installed Sage with a package manager.
When I try to run Sage with commands like "sage -n jupyter" or "sage --notebook", it starts Sage, but doesn't automatically open the jupyter notebook in my browser. Instead, it opens a file in a text editor. I can copy the link mentioned in the terminal output (that is produced when I run Sage) into a browser and that works, but I'd like it to open automatically, so that I can create an easy shortcut to start Sage. Following some instructions I found on wiki.sagemath.org, I created a config file using "sage --jupyter notebook --generate-config", and then I opened the config file and changed the option use_redirect_file to False. But it still doesn't work. Any suggestions?
I also can't find the value of SAGE_ROOT. When I execute the command "sage -root", I just get a blank line. When I start sage and execute "SAGE_ROOT" at the sage prompt, it does nothing.
in the ~/.bashrc file try to add:
adapt to your prefered Browser
close and re-open Ubuntu
for the shortcut problem I'm waiting an answer: question on learn.microsoft.com
see also for info:look at this ask sageMath question
I added
to the end of ~/.bashrc, since that is where Chrome is located for me. Then I closed and re-opened Ubuntu. That definitely changed something. Running Sage now gives less output. The last line gives the urls to open. (Before it had some other output after that.) And it doesn't open anything in the text editor. But it still doesn't open the browser automatically.
so the last thing I can propose try to add in jupyter_notebook_config.py with
adapt to your browser, if it does not work , sorry that I can't help you
tell me if it does not work and I will delete my answer, in order to give someone the opportunity to provide a good answer
what is your Ubuntu version ?
Somehow I got it to work by reseting my jupyter config file and starting again. I must have been making a typo somewhere. I changed "use_redirect_file" to False in my jupyter config file, then added the "export BROWSER" command to my .bashrc file. Now running sage from Ubuntu launches the browser. But the Window shortcut doesn't work. Based on the question you posted on learn.microsoft.com, I think you're having the same problem. I'm running Ubuntu 22.04.