创建干净的conda环境

时间:2017-11-01 14:34:46

标签: python jupyter conda

我想创建一个空白/空的conda环境,但新创建的环境似乎是从root或其他环境中获取包。我已经在系统上以root用户身份安装了这些软件包(例如bedtoolsbwa等),并且还安装到其他conda环境中,但是想要创建一个干净的软件包(用于再现性) )。

这是预期的行为吗?我该怎么调试呢?

我(尝试)遵循以下答案:https://stackoverflow.com/a/37216638/3294994

$ conda env create -n test-env python
$ source activate 
$ conda env export
name: test-env
channels:
- conda-forge
- biconda
- anaconda
- defaults
dependencies
...
python=3.6.2=0
bcftools=1.6=0
bedtools=2.26.0=0
bwa=0.7.15=1
...
picard=2.14=py36_0
...

以下有关环境的一些信息:

$ conda info
Current conda install:

               platform : linux-64
          conda version : 4.3.27
       conda is private : False
      conda-env version : 4.3.27
    conda-build version : not installed
         python version : 3.6.1.final.0
       requests version : 2.14.2
       root environment : /home/obk/anaconda3  (writable)
    default environment : /home/obk/anaconda3/envs/tttest2
       envs directories : /home/obk/anaconda3/envs
                          /home/obk/.conda/envs
          package cache : /home/obk/anaconda3/pkgs
                          /home/obk/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/main/linux-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.27 requests/2.14.2 CPython/3.6.1 Linux/3.13.0-132-generic debian/jessie/sid glibc/2.19
                UID:GID : 1001:1001
$ conda deactivate
$ conda info
Current conda install:

               platform : linux-64
          conda version : 4.3.27
       conda is private : False
      conda-env version : 4.3.27
    conda-build version : not installed
         python version : 3.6.1.final.0
       requests version : 2.14.2
       root environment : /home/obk/anaconda3  (writable)
    default environment : /home/obk/anaconda3
       envs directories : /home/obk/anaconda3/envs
                          /home/obk/.conda/envs
          package cache : /home/obk/anaconda3/pkgs
                          /home/obk/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/main/linux-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.27 requests/2.14.2 CPython/3.6.1 Linux/3.13.0-132-generic debian/jessie/sid glibc/2.19
                UID:GID : 1001:1001

另外,我遇​​到的原始问题如下:

$ source activate test-env
$ conda install jupyter
Fetching package metadata ...........
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
  - imagemagick
  - jupyter
  - python 3.6*
Use "conda info <package>" to see the dependencies for each package.

我猜这是因为新创建的环境test-env已经包含了...

1 个答案:

答案 0 :(得分:0)

您可以通过键入conda create -n vEnv python

来创建一个新的环境。

这将创造一个全新的环境。顺便说一句,这与进入GUI并单击“创建”按钮一样。这样您创建的环境将被放置在随处可见的anaconda文件中的环境下,因此您只需执行以下操作即可激活它:conda activate vEnv

您可以像这样检查pip和conda软件包(一旦激活环境): pip list conda list

我希望对您有帮助