【问题标题】:How to install Apache Toree for Spark Kernel in Jupyter in (ana)conda environment?如何在 (ana)conda 环境中的 Jupyter 中为 Spark 内核安装 Apache Toree?
【发布时间】:2016-09-09 22:08:39
【问题描述】:

我正在尝试在anaconda distributionconda 环境(我使用http://conda.pydata.org/docs/test-drive.html 设置)中安装Jupyter-support for Spark。 我正在尝试将apache toree 用作Jupyter Kernel

这是我安装 Anaconda 后所做的:

conda create --name jupyter python=3
source activate jupyter
conda install jupyter
pip install --pre toree
jupyter toree install

在我到达最后一行之前一切正常。我明白了

PermissionError: [Errno 13] Permission denied: '/usr/local/share/jupyter'

这引出了一个问题:为什么它甚至在那个目录中查找?毕竟它应该留在环境中。因此我执行

jupyter --paths

得到

config:
    /home/user/.jupyter
    ~/anaconda2/envs/jupyter/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/user/.local/share/jupyter
    ~/anaconda2/envs/jupyter/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /run/user/1000/jupyter

我不太清楚发生了什么以及如何继续让所有东西都在 conda 环境“jupyter”中运行(如果可能的话)。

【问题讨论】:

    标签: apache-spark anaconda jupyter-notebook conda apache-toree


    【解决方案1】:

    您可以使用--help 查看所有可用选项:

    $ jupyter toree 安装 --help 用于与 spark 对话的 Jupyter 内核 选项 -------- 取值的参数实际上是 full 的方便别名 可配置项,其别名列在帮助行中。了解更多信息 关于完整的可配置项,请参阅“--help-all”。 - 用户 安装到每用户内核注册表 - 代替 用此名称替换任何现有的内核规范。 --sys-前缀 安装到 Python 的 sys.prefix。在 conda/虚拟环境中很有用。 --调试 将日志级别设置为 logging.DEBUG(最大化日志输出) --kernel_name= (ToreeInstall.kernel_name) 默认值:'Apache Toree' 使用此名称安装内核规范。这也被用作 在 jupyter 中显示名称。 --spark_home= (ToreeInstall.spark_home) 默认值:'/usr/local/spark' 指定可以找到 spark 文件的位置。 --toree_opts= (ToreeInstall.toree_opts) 默认: '' 为 Apache Toree 指定命令行参数。 --spark_opts= (ToreeInstall.spark_opts) 默认: '' 指定命令行参数以代理 spark 配置。 --interpreters= (ToreeInstall.interpreters) 默认值:“斯卡拉” 要安装的解释器的逗号分隔列表。的名字 口译员区分大小写。 --python_exec= (ToreeInstall.python_exec) 默认值:“蟒蛇” 指定 python 可执行文件。默认为“蟒蛇” --log-level= (Application.log_level) 默认值:30 选择:(0、10、20、30、40、50、'DEBUG'、'INFO'、'WARN'、'ERROR'、'CRITICAL') 按值或名称设置日志级别。 --config= (JupyterApp.config_file) 默认: '' 配置文件的完整路径。 要查看所有可用的可配置项,请使用 `--help-all` 例子 -------- jupyter toree 安装 jupyter toree 安装 --spark_home=/spark/home/dir jupyter toree install --spark_opts='--master=local[4]' jupyter toree 安装 --kernel_name=toree_special jupyter toree install --toree_opts='--nosparkcontext' jupyter toree 安装 --interpreters=PySpark,SQL jupyter toree 安装 --python=python

    使用jupyter toree install --sys-prefix 是 conda 和 venv 环境的最佳选择。

    【讨论】:

      【解决方案2】:

      默认情况下,Jupyter 会尝试将内核安装到系统范围的内核注册表中。您可以传递 --user 标志,它将使用用户内核目录。更多详细信息,请访问kernelspec.py。 以下命令将 toree 内核安装到用户内核中

      jupyter toree install --user
      

      【讨论】:

      • 太棒了,谢谢!在哪里可以阅读这些选项?我没有看到任何手册页,您提供的链接只是源代码。
      • 这里是有关为 Jupyter 创建内核的文档,其中描述了内核创建的文件夹:jupyter-client.readthedocs.io/en/latest/kernels.html
      • 这实际上是一个关于一些合理文档的好问题。我还没有看到任何描述安装新内核的特殊情况。我一直在寻找解决与您相同的问题并遇到一些讨论 jupyter 数据目录的论坛。这就是我最终在 jupyter_client github repo github.com/jupyter/jupyter_client/blob/master/jupyter_client/… 的方式,追逐必须通过的用户标志。
      • 有没有人收到这个错误。 stackoverflow.com/questions/40700347/… 感谢您的帮助。谢谢
      • 是的,这是 Three 和 Scala 2.11 的兼容性问题。降级到 Scala 2.10 将解决这个问题。
      猜你喜欢
      • 1970-01-01
      • 2018-08-14
      • 2019-05-12
      • 2017-04-11
      • 1970-01-01
      • 2022-11-23
      • 1970-01-01
      • 1970-01-01
      • 2016-09-16
      相关资源
      最近更新 更多