No web browser found: could not locate runnable browser

I am using Nvidia’s transfer learning toolkit. The installation was successful.
But running jupyter notebook as follow
root@6e9d369f9c5c:/workspace/examples# jupyter notebook --ip 0.0.0.0 --allow-root

gave

`[W 10:45:34.406 NotebookApp] No web browser found: could not locate runnable browser.
[C 10:45:34.406 NotebookApp]

To access the notebook, open this file in a browser:
    file:///root/.local/share/jupyter/runtime/nbserver-157-open.html
Or copy and paste one of these URLs:
    http://(6e9d369f9c5c or 127.0.0.1):8888/?token=ba2c6f93e8665e55a85827c3f40b25e5db435beda2c09bd9`

Then copied the link to browser, but no notebook displayed.
How can I do that? Docker is running in Ubuntu18 OS.

Please copy one of below links into your browser and try again.

http://6e9d369f9c5c:8888/?token=ba2c6f93e8665e55a85827c3f40b25e5db435beda2c09bd9

http://127.0.0.1:8888/?token=ba2c6f93e8665e55a85827c3f40b25e5db435beda2c09bd9

I did what you mentioned. But still the same.

Please also try the third way.
For example, if your PC’s ip is 192.168.202.78, then copy below into the browser.
http://192.168.202.78:8888/?token=ba2c6f93e8665e55a85827c3f40b25e5db435beda2c09bd9

I tried all three ways using my pc’s ip address, docker container id, 127.0.0.1. All failed.

Can you exit the docker and retry again? There should be no issue since other users can work.

$ docker run --runtime=nvidia -it -v <your_folder>:/workspace/tlt-experiments -p 8888:8888 nvcr.io/nvidia/tlt-streamanalytics:v1.0.1_py2

root@dbb00d4523cc:/workspace# jupyter notebook --ip 0.0.0.0 --allow-root

Yes yes thanks.
This url works.
http://127.0.0.1:8888/?token=4835378f9f3696ee4a3ce00b046559bdad4e83f3a4f98c64.

I did your docker command as follows and it works.

itc@itc-Precision-7920-Tower:~$ docker run --runtime=nvidia -it -v /home/itc/NVIDIA-tft/tlt-experiments:/workspace/tlt-experiments -p 8888:8888 nvcr.io/nvidia/tlt-streamanalytics:v1.0.1_py2 /bin/bash
root@5afd81fed17f:/workspace#  jupyter notebook --ip 0.0.0.0 --allow-root
[I 09:28:29.971 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[I 09:28:30.096 NotebookApp] Serving notebooks from local directory: /workspace
[I 09:28:30.097 NotebookApp] The Jupyter Notebook is running at:
[I 09:28:30.097 NotebookApp] http://(5afd81fed17f or 127.0.0.1):8888/?token=4835378f9f3696ee4a3ce00b046559bdad4e83f3a4f98c64
[I 09:28:30.097 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 09:28:30.100 NotebookApp] No web browser found: could not locate runnable browser.
[C 09:28:30.101 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///root/.local/share/jupyter/runtime/nbserver-10-open.html
    Or copy and paste one of these URLs:
        http://(5afd81fed17f or 127.0.0.1):8888/?token=4835378f9f3696ee4a3ce00b046559bdad4e83f3a4f98c64
[I 09:29:33.808 NotebookApp] 302 GET /?token=4835378f9f3696ee4a3ce00b046559bdad4e83f3a4f98c64 (172.17.0.1) 0.78ms
[I 09:30:30.703 NotebookApp] 302 GET /?token=4835378f9f3696ee4a3ce00b046559bdad4e83f3a4f98c64 (172.17.0.1) 0.88ms

If you directly use webbrowser.open() - it will always open the link in the default browser. What you can do is to register the any other browser and then launch a new tab. Something like this:

webbrowser.register(name, constructor, instance=None)

Once a python browser type is registered, the get() function can return a controller for that browser type. You can run open, open_new and open_new_tab on the controller object. This will ensure the commands are executed on the same browser instance you opened.

import webbrowser    
url='https://www.google.com'
chrome_path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(chrome_path),1)
webbrowser.get('chrome').open_new_tab(url)

If you want to get recognized browsers on your system:

import webbrowser
print webbrowser._browsers
1 Like