How do I keep track of pip-installed packages in an Anaconda (Conda) environment?

后端 未结 10 2483
萌比男神i
萌比男神i 2020-11-28 00:35

I\'ve installed and have been using the Anaconda Python distribution, and I have started using the Anaconda (Conda) environment. I can use the standard conda install..

相关标签:
10条回答
  • 2020-11-28 01:09

    You can start by installing the below given command in the conda environment:

    conda install pip

    Followed by installing all pip packages you need in the environment.

    After installing all the conda and pip packages to export the environment use:

    conda env export -n <env-name> > environment.yml

    This will create the required file in the folder

    0 讨论(0)
  • 2020-11-28 01:10

    conda-env now does this automatically (if pip was installed with conda).

    You can see how this works by using the export tool used for migrating an environment:

    conda env export -n <env-name> > environment.yml
    

    The file will list both conda packages and pip packages:

    name: stats
    channels:
      - javascript
    dependencies:
      - python=3.4
      - bokeh=0.9.2
      - numpy=1.9.*
      - nodejs=0.10.*
      - flask
      - pip:
        - Flask-Testing
    

    If you're looking to follow through with exporting the environment, move environment.yml to the new host machine and run:

    conda env create -f path/to/environment.yml
    
    0 讨论(0)
  • 2020-11-28 01:17

    This is why I wrote Picky: http://picky.readthedocs.io/

    It's a python package that tracks packages installed with either pip or conda in either virtualenvs and conda envs.

    0 讨论(0)
  • 2020-11-28 01:19

    conda env export lists all conda and pip packages in an environment. conda-env must be installed in the conda root (conda install -c conda conda-env).

    To write an environment.yml file describing the current environment:

    conda env export > environment.yml
    

    References:

    • https://github.com/conda/conda-env/
    • https://github.com/conda/conda-env/issues/12
    0 讨论(0)
提交回复
热议问题