Can't install scala kernel for jupyter notebook (toree)

Can’t install scala kernel for jupyter notebook

  1. Create project

  2. Create and activate virtual enviroment

  3. Install jupyter
    (jupyter_note) niki@zZ:~/jupyter_notebooker$ pip install jupyter

  4. jupyter notebook launching without problems

  5. Install toree according to instruction
    (jupyter_note) niki@zZ:~/jupyter_notebooker$ pip install https://dist.apache.org/repos/dist/release/incubator/toree/0.2.0-incubating/toree-pip/toree-0.2.0.tar.gz

    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 27.2/27.2 MB 4.7 MB/s eta 0:00:00
    Preparing metadata (setup.py) … done
    Requirement already satisfied: jupyter_client>=4.0 in ./jupyter_note/lib/python3.10/site-packages (from toree==0.4.0) (7.3.4)
    Requirement already satisfied: jupyter_core>=4.0 in ./jupyter_note/lib/python3.10/site-packages (from toree==0.4.0) (4.11.1)
    Collecting traitlets<5.0,>=4.0
    Downloading traitlets-4.3.3-py2.py3-none-any.whl (75 kB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.7/75.7 KB 1.0 MB/s eta 0:00:00
    Requirement already satisfied: tornado>=6.0 in ./jupyter_note/lib/python3.10/site-packages (from jupyter_client>=4.0->toree==0.4.0) (6.2)
    Requirement already satisfied: nest-asyncio>=1.5.4 in ./jupyter_note/lib/python3.10/site-packages (from jupyter_client>=4.0->toree==0.4.0) (1.5.5)
    Requirement already satisfied: pyzmq>=23.0 in ./jupyter_note/lib/python3.10/site-packages (from jupyter_client>=4.0->toree==0.4.0) (23.2.1)
    Requirement already satisfied: entrypoints in ./jupyter_note/lib/python3.10/site-packages (from jupyter_client>=4.0->toree==0.4.0) (0.4)
    Requirement already satisfied: python-dateutil>=2.8.2 in ./jupyter_note/lib/python3.10/site-packages (from jupyter_client>=4.0->toree==0.4.0) (2.8.2)
    Requirement already satisfied: six in ./jupyter_note/lib/python3.10/site-packages (from traitlets<5.0,>=4.0->toree==0.4.0) (1.16.0)
    Requirement already satisfied: decorator in ./jupyter_note/lib/python3.10/site-packages (from traitlets<5.0,>=4.0->toree==0.4.0) (5.1.1)
    Requirement already satisfied: ipython-genutils in ./jupyter_note/lib/python3.10/site-packages (from traitlets<5.0,>=4.0->toree==0.4.0) (0.2.0)
    Using legacy ‘setup.py install’ for toree, since package ‘wheel’ is not installed.
    Installing collected packages: traitlets, toree
    Attempting uninstall: traitlets
    Found existing installation: traitlets 5.3.0
    Uninstalling traitlets-5.3.0:
    Successfully uninstalled traitlets-5.3.0
    Running setup.py install for toree … done
    ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
    nbformat 5.4.0 requires traitlets>=5.1, but you have traitlets 4.3.3 which is incompatible.
    nbconvert 6.5.3 requires traitlets>=5.0, but you have traitlets 4.3.3 which is incompatible.
    nbclient 0.6.6 requires traitlets>=5.2.2, but you have traitlets 4.3.3 which is incompatible.
    ipython 8.4.0 requires traitlets>=5, but you have traitlets 4.3.3 which is incompatible.
    ipykernel 6.15.1 requires traitlets>=5.1.0, but you have traitlets 4.3.3 which is incompatible.
    Successfully installed toree-0.4.0 traitlets-4.3.3

  6. (jupyter_note) niki@zZ:~/jupyter_notebooker$ jupyter toree install --spark_home=“${SPARK_HOME}” --kernel_name=“Spark 2.x” --interpreters=“Scala”

[ToreeInstall] Installing Apache Toree version 0.4.0
[ToreeInstall]
Apache Toree is an effort undergoing incubation at the Apache Software
Foundation (ASF), sponsored by the Apache Incubator PMC.

Incubation is required of all newly accepted projects until a further review
indicates that the infrastructure, communications, and decision making process
have stabilized in a manner consistent with other successful ASF projects.

While incubation status is not necessarily a reflection of the completeness
or stability of the code, it does indicate that the project has yet to be
fully endorsed by the ASF.
[ToreeInstall] Creating kernel Scala
Traceback (most recent call last):
File “/home/niki/jupyter_notebooker/jupyter_note/bin/jupyter-toree”, line 33, in
sys.exit(load_entry_point(‘toree==0.4.0’, ‘console_scripts’, ‘jupyter-toree’)())
File “/home/niki/jupyter_notebooker/jupyter_note/lib/python3.10/site-packages/toree/toreeapp.py”, line 157, in main
ToreeApp.launch_instance()
File “/home/niki/jupyter_notebooker/jupyter_note/lib/python3.10/site-packages/traitlets/config/application.py”, line 664, in launch_instance
app.start()
File “/home/niki/jupyter_notebooker/jupyter_note/lib/python3.10/site-packages/toree/toreeapp.py”, line 154, in start
return self.subapp.start()
File “/home/niki/jupyter_notebooker/jupyter_note/lib/python3.10/site-packages/toree/toreeapp.py”, line 117, in start
install_dir = self.kernel_spec_manager.install_kernel_spec(self.sourcedir,
File “/home/niki/jupyter_notebooker/jupyter_note/lib/python3.10/site-packages/jupyter_client/kernelspec.py”, line 408, in install_kernel_spec
shutil.copytree(source_dir, destination)
File “/usr/lib/python3.10/shutil.py”, line 556, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
File “/usr/lib/python3.10/shutil.py”, line 457, in _copytree
os.makedirs(dst, exist_ok=dirs_exist_ok)
File “/usr/lib/python3.10/os.py”, line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File “/usr/lib/python3.10/os.py”, line 215, in makedirs
makedirs(head, exist_ok=exist_ok)
File “/usr/lib/python3.10/os.py”, line 225, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/usr/local/share/jupyter’

6a.
(jupyter_note) niki@zZ:~/jupyter_notebooker$ sudo jupyter toree install --spark_home=“${SPARK_HOME}” --kernel_name=“Spark 2.x” --interpreters=“Scala”
[sudo] password for niki:
sudo: jupyter: command not found

same issue happens when I installing spylon-kernel (but without virtual enviroment)
python -m spylon_kernel install

Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy