cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
78 stars 26 forks source link

Cannot open Jupyter notebook, multiple errors. #646

Open DrBanana419 opened 2 years ago

DrBanana419 commented 2 years ago

When I try to run sage -n jupyter I get this (excluding the banner):

`Please wait while the Sage Jupyter Notebook server starts... Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/traitlets/traitlets.py", line 535, in get value = obj._trait_values[self.name] KeyError: 'allow_remote_access'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/notebook/notebookapp.py", line 1129, in _default_allow_remote addr = ipaddress.ip_address(self.ip) File "/usr/lib/python3.9/ipaddress.py", line 53, in ip_address raise ValueError('%r does not appear to be an IPv4 or IPv6 address' % ValueError: 'localhost' does not appear to be an IPv4 or IPv6 address

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python-exec/python3.9/sage-notebook", line 218, in launcher(unknown) File "/usr/lib/python-exec/python3.9/sage-notebook", line 39, in init main(argv) File "/usr/lib/python3.9/site-packages/jupyter_core/application.py", line 254, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, kwargs) File "/usr/lib/python3.9/site-packages/traitlets/config/application.py", line 844, in launch_instance app.initialize(argv) File "/usr/lib/python3.9/site-packages/traitlets/config/application.py", line 87, in inner return method(app, *args, *kwargs) File "/usr/lib/python3.9/site-packages/notebook/notebookapp.py", line 2130, in initialize self.init_webapp() File "/usr/lib/python3.9/site-packages/notebook/notebookapp.py", line 1759, in init_webapp self.web_app = NotebookWebApplication( File "/usr/lib/python3.9/site-packages/notebook/notebookapp.py", line 179, in init settings = self.init_settings( File "/usr/lib/python3.9/site-packages/notebook/notebookapp.py", line 282, in init_settings allow_remote_access=jupyter_app.allow_remote_access, File "/usr/lib/python3.9/site-packages/traitlets/traitlets.py", line 575, in get return self.get(obj, cls) File "/usr/lib/python3.9/site-packages/traitlets/traitlets.py", line 538, in get default = obj.trait_defaults(self.name) File "/usr/lib/python3.9/site-packages/traitlets/traitlets.py", line 1578, in trait_defaults return self._get_trait_default_generator(names[0])(self) File "/usr/lib/python3.9/site-packages/traitlets/traitlets.py", line 975, in call return self.func(args, kwargs) File "/usr/lib/python3.9/site-packages/notebook/notebookapp.py", line 1138, in _default_allow_remote parsed = ipaddress.ip_address(addr.split('%')[0]) AttributeError: 'int' object has no attribute 'split'`

Although I'm not sure if this is a sage issue or a jupyter issue. Here are my installed Jupyter packages (got from emerge -s jupyter):

`* dev-python/jupyter Latest version available: 1.0.0-r3 Latest version installed: [ Not Installed ] Size of files: 15 KiB Homepage: https://jupyter.org Description: Jupyter metapackage. Install all the Jupyter components in one go License: BSD

[ Applications found : 11 ]`

kiwifb commented 2 years ago

It looks like a network configuration problem on your machine. Do you have some kind of firewall running?

DrBanana419 commented 2 years ago

It looks like a network configuration problem on your machine. Do you have some kind of firewall running?

I didn't explicitly install a firewall, so no.

kiwifb commented 2 years ago

Have you ever run a standard jupyter notebook on that machine (i.e. not a sagemath kernel but a python or possibly other kernel)?

DrBanana419 commented 2 years ago

Have you ever run a standard jupyter notebook on that machine (i.e. not a sagemath kernel but a python or possibly other kernel)?

I have done it on another Linux distribution, but not on Gentoo.

kiwifb commented 2 years ago

You should be able to do so with jupyter notebook on the command line, I am curious to see if it will behave differently.

DrBanana419 commented 2 years ago

You should be able to do so with jupyter notebook on the command line, I am curious to see if it will behave differently.

Unfortunately jupyter notebook returns the same errors.

kiwifb commented 2 years ago

Which means it is not a sage specific problem, as I expected. Can you post the content of /etc/hosts and possibly the result of ip address?

DrBanana419 commented 2 years ago

These are the contents of /etc/hosts (minus the comments):

127.0.0.1   localhost
::1             localhost
127.0.1.1   my-linux-pc.localdomain my-linux-pc

And this is ip address:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether a8:a1:59:3c:87:65 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.4/24 brd 192.168.0.255 scope global dynamic noprefixroute enp4s0
       valid_lft 4798sec preferred_lft 4798sec
    inet6 fe80::b545:860e:c7f5:5fb4/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

By the way I tried jupyter notebook --ip="0.0.0.0" and that worked.

kiwifb commented 2 years ago

Then sage -n jupyter --ip="0.0.0.0" may work, although I must say I am confused by the fact that address works. Shows my ignorance on network stuff I guess.

DrBanana419 commented 2 years ago

I think that this should be kept open since workarounds like this should not be needed.

kiwifb commented 2 years ago

If you wish, but you should seek assistance from a jupyter help channel. They are more likely to figure out the issue.