2016-05-13 113 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環境的最佳選擇。

相關問題