# Cannot install Jupyter Lab (continuation)



## martinrame (Sep 18, 2020)

Well, after solving the issue I posted on #478525, now I'm getting this after calling `jupyter notebook --generate-config`:


```
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 6, in <module>
    from notebook.notebookapp import main
  File "/usr/local/lib/python3.7/site-packages/notebook/notebookapp.py", line 51, in <module>
    from zmq.eventloop import ioloop
  File "/usr/local/lib/python3.7/site-packages/zmq/__init__.py", line 50, in <module>
    from zmq import backend
  File "/usr/local/lib/python3.7/site-packages/zmq/backend/__init__.py", line 40, in <module>
    reraise(*exc_info)
  File "/usr/local/lib/python3.7/site-packages/zmq/utils/sixcerpt.py", line 34, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/zmq/backend/__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "/usr/local/lib/python3.7/site-packages/zmq/backend/select.py", line 28, in select_backend
    mod = __import__(name, fromlist=public_api)
  File "/usr/local/lib/python3.7/site-packages/zmq/backend/cython/__init__.py", line 6, in <module>
    from . import (constants, error, message, context,
ImportError: /usr/local/lib/python3.7/site-packages/zmq/backend/cython/error.so: Undefined symbol "zmq_strerror"
```


----------



## a6h (Sep 19, 2020)

Uninstall the net/py-pyzmq. Build net/py-pyzmq from the port and try again.


----------



## martinrame (Sep 19, 2020)

Thanks, that solved the issue.

Now I can start the service and access to the user interface. Btw, this is Jupyter Notebook, not Jupyter Lab.

Here's a screenshot:






When I click run or ctrl+enter, the calc is not done, and the server's console shows this:


```
[root@jupyterlab ~]# service jupyter start
[root@jupyterlab ~]# Need to remove all those ^M characters from a DOS file? Try

    tr -d \\r < dosfile > newfile
        -- Originally by Dru <genesis@istar.ca>
[W 07:44:22.156 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 07:44:22.157 NotebookApp] Serving notebooks from local directory: /usr/home/jupyter
[I 07:44:22.157 NotebookApp] Jupyter Notebook 6.1.4 is running at:
[I 07:44:22.158 NotebookApp] http://jupyterlab:8888/
[I 07:44:22.158 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 07:44:29.710 NotebookApp] 302 POST /login?next=%2Ftree%3F (192.168.0.110) 26.92ms
^C
[root@jupyterlab ~]# [I 07:44:56.509 NotebookApp] Creating new notebook in
[I 07:44:56.569 NotebookApp] Writing notebook-signing key to /usr/home/jupyter/.local/share/jupyter/notebook_secret
/usr/local/lib/python3.7/site-packages/jupyter_client/connect.py:164: RuntimeWarning: Failed to set sticky bit on '/usr/home/jupyter/.local/share/jupyter/runtime/kernel-62f2b91b-2285-4250-b316-d9fb4e786415.json': [Errno 79] Inappropriate file type or format: '/usr/home/jupyter/.local/share/jupyter/runtime/kernel-62f2b91b-2285-4250-b316-d9fb4e786415.json'
Probably not a big deal, but runtime files may be cleaned up periodically.
  RuntimeWarning,
[I 07:44:58.331 NotebookApp] Kernel started: 62f2b91b-2285-4250-b316-d9fb4e786415, name: python3
/usr/local/lib/python3.7/site-packages/jupyter_client/connect.py:164: RuntimeWarning: Failed to set sticky bit on '/usr/home/jupyter/.local/share/jupyter/runtime/kernel-62f2b91b-2285-4250-b316-d9fb4e786415.json': [Errno 79] Inappropriate file type or format: '/usr/home/jupyter/.local/share/jupyter/runtime/kernel-62f2b91b-2285-4250-b316-d9fb4e786415.json'
Probably not a big deal, but runtime files may be cleaned up periodically.
  RuntimeWarning,
[W 07:45:19.514 NotebookApp] Replacing stale connection: 62f2b91b-2285-4250-b316-d9fb4e786415:c5d00131b1f547b780b108da491e5a77
[W 07:45:41.442 NotebookApp] Replacing stale connection: 62f2b91b-2285-4250-b316-d9fb4e786415:c5d00131b1f547b780b108da491e5a77
[W 07:45:58.426 NotebookApp] Timeout waiting for kernel_info reply from 62f2b91b-2285-4250-b316-d9fb4e786415
```


----------



## a6h (Sep 19, 2020)

A few month ago I had to learn python, to produce graphical representation of some statistical analytics result. I merely used python and pip to install 3rd library packages (seaborn). May I ask you is there any specific reason to use Jupyter Lab? I know 3rd party products such as Jupyter provide some convenient, but I'm not very familiar with them. Thanks


----------



## martinrame (Sep 19, 2020)

vigole said:


> ... May I ask you is there any specific reason to use Jupyter Lab? I know 3rd party products such as Jupyter provide some convenient, but I'm not very familiar with them. Thanks



Yes, I created a set of "notebooks" for options trading inside JupyterLab running on a Linux machine, now I'm trying to migrate it to a jail in my new home server.


----------



## Mjölnir (Sep 19, 2020)

then it's polite to set the thread to _solved_: on the 1st post, click ".."->edit thread->prefix:_solved_


----------



## martinrame (Sep 19, 2020)

mjollnir said:


> then it's polite to set the thread to _solved_: on the 1st post, click ".."->edit thread->prefix:_solved_



Why?, the issue is not solved yet.


----------



## martinrame (Sep 24, 2020)

If I create an 11.1 jail or even an older version, the packages installed using `pkg` will be older than those of 12.1?.


----------



## Mjölnir (Sep 25, 2020)

martinrame said:


> If I create an 11.1 jail or even an older version, the packages installed using `pkg` will be older than those of 12.1?.


The jail uses the same kernel as the host.  The package repository is given in /etc/pkg/FreeBSD.conf (override by creating /usr/local/etc/pkg/repos/FreeBSD.conf) via the `ABI` macro, which is autogenerated to match the kernel version by default, but can be set in /usr/local/etc/pkg.conf.


----------



## martinrame (Sep 25, 2020)

Thanks. But I would like to create a jail trying to reproduce the behavior of an old FreeBSD system, if I create an 11.1 jail it will point to 11.1 packages?. That way I could try jupyter lab or jupyter notebook from that FreeBSD version, to check if that works.


----------



## Mjölnir (Sep 25, 2020)

From jail(8):
_     osrelease
             The string for the jail's kern.osrelease sysctl and uname -r.

     osreldate
             The number for the jail's kern.osreldate and uname -K._
So that's what the userland inside the jail sees.  Still, the jail runs on exactly the host's kernel; that's what jails are about.


----------



## martinrame (Sep 25, 2020)

Ok, I created a new jail with `iocage create newjail -r 11.2-RELEASE`, but the Jupyter notebook package is exactly the same as in the 12.1 jail.


----------



## Mjölnir (Sep 26, 2020)

Maybe iocage(8) does not set these two knobs _osrelease_ & _osreldate_?  Then you can decide that's a bug and submit a PR (see @top of the forum page).  Please supply

`freebsd-version` on the host & from inside the jail
/etc/pkg/FreeBSD.conf, /usr/local/etc/pkg/repos/FreeBSD.conf (if it exists) & `grep ABI /usr/local/etc/pkg.conf`, all from inside the jail.
Remember that you have to give pkg(8) on the host the `-j` or `--jail` parameter to install packages into the jail.


----------



## martinrame (Sep 26, 2020)

Hi mjollnir, thanks for your help. I don't know if this is a bug yet.

Here are the values:

`freebsd-version`:

Host: `12.1-RELEASE-p8`
Jail: `11.2-RELEASE-p15`

From inside the jail:


```
cat /etc/pkg/FreeBSD.conf
# $FreeBSD: releng/11.2/etc/pkg/FreeBSD.conf 333474 2018-05-10 23:58:33Z gjb $
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
```


```
grep ABI /usr/local/etc/pkg.conf
#ABI = "freebsd:10:x86:64";     # Autogenerated
```


```
cat /usr/local/etc/pkg/repos/FreeBSD.conf
cat: /usr/local/etc/pkg/repos/FreeBSD.conf: No such file or directory
```

Do you see something strange?


----------



## martinrame (Sep 26, 2020)

Mmm, I think I'm having a network related issue. The Jupyter notebook web app tries to open a websocket connection, but as the jail is behind a `pf` firewall the app cannot connect to it.

Resuming, the web app runs on port `8888`, as this port is allowed on the firewall I can connect without issues, but it cannot connect to the websockets server.

Now I wonder what's the websocket server port...


----------



## a6h (Sep 26, 2020)

I'm not familiar with Jupyter web/server but AFAIK, if the server understand websocket and configure properly => it's possible that websocket uses the same ports aka 8888 (80 or 443, etc) through the Upgrade Header: _Websocket protocol handshake:_

```
Connection: Upgrade
```


----------



## martinrame (Sep 26, 2020)

vigole said:


> I'm not familiar with Jupyter web/server but AFAIK, if the server understand websocket and configure properly => it's possible that websocket uses the same ports aka 8888 (80 or 443, etc) through the Upgrade Header: _Websocket protocol handshake:_
> 
> ```
> Connection: Upgrade
> ```



Yes, you are right.

After reading here https://github.com/jupyter/notebook/issues/4457 it looks like an upgrade or downgrade of the package `py37-tornado: 5.1.1` (the websockets server) could fix the issue.

Now, how can I upgrade a package using `pkg`?.

If I do `pkg install py37-tornado6-6.0.4` I get this:


```
root@jupyter11:~ # pkg install py37-tornado6-6.0.4
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    py37-tornado6: 6.0.4

Number of packages to be installed: 1

The process will require 4 MiB more space.
582 KiB to be downloaded.

Proceed with this action? [y/N]: y
[jupyter11.1] [1/1] Fetching py37-tornado6-6.0.4.txz: 100%  582 KiB 297.7kB/s    00:02    
Checking integrity... done (1 conflicting)
  - py37-tornado6-6.0.4 conflicts with py37-tornado-5.1.1 on /usr/local/lib/python3.7/site-packages/tornado/__init__.py
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 7 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
    py37-ipykernel5: 5.3.0
    py37-jupyter_client: 6.1.3
    py37-nbconvert: 5.6.1_1
    py37-notebook: 6.0.3_2
    py37-terminado: 0.8.3
    py37-tornado: 5.1.1

New packages to be INSTALLED:
    py37-tornado6: 6.0.4

Number of packages to be removed: 6
Number of packages to be installed: 1

The operation will free 38 MiB.

Proceed with this action? [y/N]:
```

But I don't want to uninstall anything else, I just want to replace `py37-tornado: 5.1.1` with `py37-tornado6: 6.0.4`.


----------



## Mjölnir (Sep 26, 2020)

The mentioned packages need to be updated to use/work with py-tornado6.  Either wait for the maintainers and/or upstream to fix that, or help them to get it done.


----------



## martinrame (Sep 26, 2020)

After hours and hours of trying I gave up on the jail and installed right on the host. And it worked without issues, so, yes, it's a bug that only appears on jails. How can I report it?.


----------



## a6h (Sep 27, 2020)

FreeBSD Bugzilla Main Page
					






					bugs.freebsd.org
				











						Writing FreeBSD Problem Reports
					

How to best formulate and submit a problem report to the FreeBSD Project




					www.freebsd.org


----------



## martinrame (Sep 27, 2020)

Registered: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249936


----------

