2016-05-13 68 views
4

我正在尝试安装Jupyter - 支持Spark在的conda环境中(我使用http://conda.pydata.org/docs/test-drive.html设置)。 我想为此使用apache toree作为Jupyter Kernel如何在(ana)conda环境中的Jupyter中为Spark内核安装Apache Toree?

这里是我做过什么我装蟒蛇后:

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' 

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

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 

我(如果可能的话只)的畅达环境“jupyter”我不太清楚是怎么回事,以及如何继续得到一切运行。

回答

6

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

jupyter toree install --user 
+0

太棒了,谢谢!哪里可以阅读这些选项?我没有看到任何手册页,你提供的链接只是源代码。 – Make42

+0

下面是关于为Jupyter创建内核的文档,它描述了哪个文件夹内核创建的内容:http://jupyter-client.readthedocs.io/en/latest/kernels.html –

+0

没有提及任何'--user' ... – Make42

2

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

 
$ jupyter toree install --help 
A Jupyter kernel for talking to spark 

Options 
------- 

Arguments that take values are actually convenience aliases to full 
Configurables, whose aliases are listed on the help line. For more information 
on full configurables, see '--help-all'. 

--user 
    Install to the per-user kernel registry 
--replace 
    Replace any existing kernel spec with this name. 
--sys-prefix 
    Install to Python's sys.prefix. Useful in conda/virtual environments. 
--debug 
    set log level to logging.DEBUG (maximize logging output) 
--kernel_name= (ToreeInstall.kernel_name) 
    Default: 'Apache Toree' 
    Install the kernel spec with this name. This is also used as the base of the 
    display name in jupyter. 
--spark_home= (ToreeInstall.spark_home) 
    Default: '/usr/local/spark' 
    Specify where the spark files can be found. 
--toree_opts= (ToreeInstall.toree_opts) 
    Default: '' 
    Specify command line arguments for Apache Toree. 
--spark_opts= (ToreeInstall.spark_opts) 
    Default: '' 
    Specify command line arguments to proxy for spark config. 
--interpreters= (ToreeInstall.interpreters) 
    Default: 'Scala' 
    A comma separated list of the interpreters to install. The names of the 
    interpreters are case sensitive. 
--python_exec= (ToreeInstall.python_exec) 
    Default: 'python' 
    Specify the python executable. Defaults to "python" 
--log-level= (Application.log_level) 
    Default: 30 
    Choices: (0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL') 
    Set the log level by value or name. 
--config= (JupyterApp.config_file) 
    Default: '' 
    Full path of a config file. 

To see all available configurables, use `--help-all` 

Examples 
-------- 

    jupyter toree install 
    jupyter toree install --spark_home=/spark/home/dir 
    jupyter toree install --spark_opts='--master=local[4]' 
    jupyter toree install --kernel_name=toree_special 
    jupyter toree install --toree_opts='--nosparkcontext' 
    jupyter toree install --interpreters=PySpark,SQL 
    jupyter toree install --python=python 

使用jupyter toree install --sys-prefix是畅达和VENV环境的最佳选择。

相关问题