跳转到主要内容

在Jupyter上运行桌面环境

项目描述

Jupyter远程桌面代理

Binder Test Latest PyPI version Issue tracking - GitHub Help forum - Discourse

在Jupyter上运行XFCE(或其他桌面环境)。

这是基于https://github.com/ryanlovett/nbnovnc

当此扩展启动时,它将在Jupyter单用户服务器上运行Linux桌面,并通过Jupyter使用VNC将其代理到您的浏览器。

VNC服务器

此扩展需要系统上安装 VNC 服务器(可能在容器镜像中)。经过最多测试的 VNC 服务器是 TigerVNC,而 TurboVNC 也同样适用。任何在 $PATH 中作为 vncserver 可用的 VNC 服务器都将被使用,但在此之外的服务器尚未进行过实际测试。

例如,请参阅此存储库中的 Dockerfile,其中安装了 TigerVNC 和 XFCE4。

安装

  1. 使用来自 PyPIpip 安装此软件包本身

    pip install jupyter-remote-desktop-proxy
    
  2. 安装依赖项 websockify。不幸的是,PyPI 上的 websockify 软件包已损坏,因此您需要从 conda-forge 或使用 apt 安装它

  3. 安装提供 VNC 服务器和实际 Linux 桌面环境的所需软件包。您需要选择一个桌面环境(有很多!)——以下是在 Ubuntu 22.04 上使用 TigerVNC 和轻量级的 XFCE4 桌面环境的软件包

    dbus-x11
    xfce4
    xfce4-panel
    xfce4-session
    xfce4-settings
    xorg
    xubuntu-icon-theme
    tigervnc-standalone-server
    tigervnc-xorg-extension
    

    推荐的方式是使用您选择的 Linux 系统包管理器(例如 apt)来安装这些软件包。

Docker

首先构建容器以启动这样的笔记本

$ docker build -t $(whoami)/$(basename ${PWD}) .

现在您可以运行镜像

$ docker run --rm --security-opt seccomp=unconfined -p 8888:8888 $(whoami)/$(basename ${PWD})
Executing the command: jupyter notebook
[I 12:43:59.148 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 12:44:00.221 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab
[I 12:44:00.221 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 12:44:00.224 NotebookApp] Serving notebooks from local directory: /home/jovyan
[I 12:44:00.225 NotebookApp] The Jupyter Notebook is running at:
[I 12:44:00.225 NotebookApp] http://924904e0a646:8888/?token=40475e553b7671b9e93533b97afe584fa2030448505a7d83
[I 12:44:00.225 NotebookApp]  or http://127.0.0.1:8888/?token=40475e553b7671b9e93533b97afe584fa2030448505a7d83
[I 12:44:00.225 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:44:00.229 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///home/jovyan/.local/share/jupyter/runtime/nbserver-8-open.html
    Or copy and paste one of these URLs:
        http://924904e0a646:8888/?token=40475e553b7671b9e93533b97afe584fa2030448505a7d83
     or http://127.0.0.1:8888/?token=40475e553b7671b9e93533b97afe584fa2030448505a7d83
*snip*

现在转到显示的 URL,您将看到一个 XFCE 桌面。

注意 --security-opt seccomp=unconfined 参数 - 这是启动 Linux 桌面工作所需的守护进程(例如 dbus、pulseaudio 等)所必需的。这是 kubernetes 默认运行的选项,因此大多数基于 kubernetes 的 JupyterHubs 不需要对此进行任何修改即可工作。

限制

  1. 目前不支持需要访问 OpenGL 的桌面应用程序。

项目详情


下载文件

为您的平台下载文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。

源分发

jupyter_remote_desktop_proxy-2.0.1.tar.gz (322.5 kB 查看散列

上传时间

构建分发

jupyter_remote_desktop_proxy-2.0.1-py3-none-any.whl (326.5 kB 查看散列

上传时间 Python 3

支持者