【问题标题】:Installing Conda on Deepnote在 Deepnote 上安装 Conda
【发布时间】:2020-12-04 23:07:00
【问题描述】:

我是一个相当缺乏经验的程序员,正在努力将 Conda 安装到 Deepnote。 Pip install 不适用于某些软件包。例如,我正在尝试安装 rdkit,这是一个化学信息学包,它具有相当复杂的 installation instructions 或通过 Anaconda/mini-conda 发行版管理的简单的 1 行代码。我真的很喜欢 Deepnote 笔记本,如果有任何帮助,我将不胜感激。

到目前为止,我在 Google Colab 上找到了这个用于安装 Conda 的有用代码:https://github.com/dataprofessor/code/blob/master/python/google_colab_install_conda.ipynb

! wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.2-Linux-x86_64.sh
! chmod +x Miniconda3-py37_4.8.2-Linux-x86_64.sh
! bash ./Miniconda3-py37_4.8.2-Linux-x86_64.sh -b -f -p /usr/local
import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/')

虽然这在 Google Colab 上成功运行,但我不确定它为什么会失败,如下所示在 Deepnote 上:

--2020-12-04 22:58:34--  https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.2-Linux-x86_64.sh
Resolving repo.anaconda.com (repo.anaconda.com)... 104.16.130.3, 104.16.131.3, 2606:4700::6810:8203, ...
Connecting to repo.anaconda.com (repo.anaconda.com)|104.16.130.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85055499 (81M) [application/x-sh]
Saving to: ‘Miniconda3-py37_4.8.2-Linux-x86_64.sh’

Miniconda3-py37_4.8 100%[===================>]  81.12M   133MB/s    in 0.6s    

2020-12-04 22:58:35 (133 MB/s) - ‘Miniconda3-py37_4.8.2-Linux-x86_64.sh’ saved [85055499/85055499]

PREFIX=/usr/local
./Miniconda3-py37_4.8.2-Linux-x86_64.sh: line 392: /usr/local/conda.exe: Permission denied
chmod: cannot access '/usr/local/conda.exe': No such file or directory
Unpacking payload ...
./Miniconda3-py37_4.8.2-Linux-x86_64.sh: line 404: /usr/local/conda.exe: No such file or directory
./Miniconda3-py37_4.8.2-Linux-x86_64.sh: line 406: /usr/local/conda.exe: No such file or directory

我也想做 conda install -c bioconda gromacs,我找不到解决办法,所以我希望有人能帮我解决这个问题。

非常感谢!

附:我在 Mac 操作系统上

【问题讨论】:

    标签: python anaconda conda deepnote


    【解决方案1】:

    你可以从 Daniel Zvara 那里查看这个笔记本

    Using Conda in Deepnote in 3 simple steps

    总之

    # 1. Install Conda and make Conda packages available in current environment
    
    !wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
    !chmod +x Miniconda3-latest-Linux-x86_64.sh
    !sudo bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
    
    import sys
    sys.path.append('/usr/local/lib/python3.7/site-packages/')
    
    # 2. Package installation
    # !sudo conda install -y [EXTRA_OPTIONS] package_name
    
    # So for example Keras from conda-forge channel
    !sudo conda install -y -c conda-forge keras
    
    # 3. Package usage
    
    import keras
    

    【讨论】:

      【解决方案2】:

      还在 Deepnote 社区找到了替代解决方案:https://community.deepnote.com/c/custom-environments/custom-environment-for-installing-conda-packages

      可以使用以下 Dockerfile 设置自定义环境(只需在占位符处填写您需要的包即可)。

      FROM gcr.io/deepnote-200602/templates/deepnote
      RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
      RUN bash ~/miniconda.sh -b -p $HOME/miniconda
      ENV PATH $HOME/miniconda/bin:$PATH
      RUN conda install python=3.7 ipykernel -y
      RUN conda install <insert packages here> -y
      RUN python -m ipykernel install --user --name=conda
      ENV DEFAULT_KERNEL_NAME "conda"
      

      Deepnote 中的自定义环境是通过侧边栏中的“环境”选项卡设置的,为您提供 Dockerfile 选项。复制并粘贴以上内容,然后单击构建并重新启动机器 - 将设置环境允许您使用 conda。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-04-06
        • 2019-11-17
        • 2019-11-13
        • 2019-12-08
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多