5

I'm on Ubuntu 20.04.2 LTS.

When I want to open Jupyter-Notebook in terminal, the telegram desktop app opens.

The Jupyter-Notebook is actually opened in background. So I can open the browser and use it.

Here is the output:

(geospatial) siavash@siavash-fra:~$ jupyter-notebook 
[I 16:59:52.522 NotebookApp] Serving notebooks from local directory: /home/siavash
[I 16:59:52.522 NotebookApp] The Jupyter Notebook is running at:
[I 16:59:52.522 NotebookApp] http://localhost:8888/?token=192817dbf13703bc25bbd1f348df5e9c1c7c9275d579aef3
[I 16:59:52.522 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:59:52.526 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/siavash/.local/share/jupyter/runtime/nbserver-5326-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=192817dbf13703bc25bbd1f348df5e9c1c7c9275d579aef3

(telegram-desktop:5339): lib_base-WARNING **: 16:59:53.204: Unfortunately, GTK integration conflicts with qgtk2 platformtheme and style. Therefore, QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE will be unset.
lib_base-Message: 16:59:53.204: This can be ignored by setting DESKTOP_APP_I_KNOW_ABOUT_GTK_INCOMPATIBILITY environment variable to any value, however, if qgtk2 theme or style is used, this will lead to a crash.
lib_base-Message: 16:59:53.204: GTK integration can be disabled by setting DESKTOP_APP_DISABLE_GTK_INTEGRATION to any value. Keep in mind that this will lead to some features being unavailable.
Gtk-Message: 16:59:53.412: Failed to load module "canberra-gtk-module"
Gtk-Message: 16:59:53.413: Failed to load module "canberra-gtk-module"
[ALSOFT] (EE) Failed to set real-time priority for thread: Operation not permitted (1)

I also looked at this similar question, but it doesn't answer mine.

Lorenz Keel
  • 8,362
  • 8
  • 36
  • 49
sash_wash
  • 111
  • 7
  • 1
    Try running it [on a different port](https://jupyter.readthedocs.io/en/latest/running.html#how-do-i-start-the-notebook-using-a-custom-ip-or-port). – Pedro Maimere Jun 29 '21 at 16:30
  • @PedroMaimere Thanks. That worked! So the default port for jupyter-notebook is 8888, when I open it for example on 8889 it doesn't conflict. Does that mean telegram also use 8888? How can I change that for telegram permanently? – sash_wash Jun 30 '21 at 13:37

2 Answers2

4

I found the problem: After installing telegram, strangely enough it makes telegram the default application for opening HTML files. That's why after running jupyter-notebook in the terminal, it tries to open the link with telegram.

So to solve the problem, simply find any HTML file. Right click on it. Go to Properties. In Open With tab select your browser and click on Set as default.

The problem is solved. Next time telegram won't open. Instead you'll have jupyter-notebook running on your browser.

sash_wash
  • 111
  • 7
1

As noticed, you should run jupyter notebook through a different port.

I wasn't able to reproduce this bug, and also couldn't find a way to force telegram-desktop to use a different port, but you can configure jupyter notebook to use a port other than 8888.

First, check if the file /home/USERNAME/.jupyter/jupyter_notebook_config.py exists. If not, run jupyter notebook --generate-config.

Then, open this file and uncomment the following line, changing the port to 8889, for example:

c.NotebookApp.port = 8888
                      ^ Change this port to 8889

Save the file and run jupyter notebook again. From now on, telegram desktop should not open.

  • Thanks for the answer. But I have a strange problem now! This works in `base` environment, but in other envs, the problem still exists, no matter I open the Jupyter on which port. – sash_wash Jul 01 '21 at 10:01