Install conda package from Google Datalab

断了今生、忘了曾经 提交于 2019-12-11 15:20:53

问题


I'm looking to use the ospc taxcalc package in a Google Datalab notebook. This package must be installed via conda.

Datalab doesn't have conda by default, so this method (from https://stackoverflow.com/a/33176085/1840471) fails:

%%bash
conda install -c ospc taxcalc

Installing via pip also doesn't work:

%%bash
pip install conda
conda install -c ospc taxcalc

ERROR: The install method you used for conda--probably either pip install conda or easy_install conda--is not compatible with using conda as an application. If your intention is to install conda as a standalone application, currently supported install methods include the Anaconda installer and the miniconda installer. You can download the miniconda installer from https://conda.io/miniconda.html.

Following that URL, I tried this:

%%bash
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh

wget works, but the bash command to install just kept in "Running..." state for seeming perpetuity.

This seems to be due to the conda installer prompting for several Enter keystrokes to review the license, and then for a yes indicating acceptance of the license terms. So conda's silent mode installation looked promising:

%%bash
bash Miniconda2-latest-Linux-x86_64.sh -u -b -p $HOME/miniconda

This produced the following warning:

WARNING: You currently have a PYTHONPATH environment variable set. This may cause unexpected behavior when running the Python interpreter in Miniconda2. For best results, please verify that your PYTHONPATH only points to directories of packages that are compatible with the Python interpreter in Miniconda2: /content/miniconda

And doesn't make available the conda command:

%%bash
conda install -c ospc taxcalc

bash: line 1: conda: command not found


回答1:


There is a pending github issue tracking this work - https://github.com/googledatalab/datalab/issues/1376

I believe we will need to install conda and use that for python, pip and all other python packages, and in the interim it may not be possible to mix the two python environments. However someone with more experience with conda might know otherwise.




回答2:


As of the 2018-02-21 release, Datalab supports Conda and kernels are each in their own Conda environment.



来源:https://stackoverflow.com/questions/47025059/install-conda-package-from-google-datalab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!