Skip to main content

Export conda env dependencies and pip requirements to ONE yml file.

Project description

Conda Env Export

https://img.shields.io/pypi/v/conda_env_export.svg https://api.travis-ci.com/luffy-yu/conda_env_export.svg?branch=master Documentation Status https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png

Export conda env dependencies and pip requirements to ONE yml file.

Features

  • Easy to use

  • Flexible options to export

  • Support Windows, Linux, and Mac

  • Remove duplicated packages automatically

Usage

To use Conda Env Export in a project:

import conda_env_export

To use Conda Env Export in a terminal:

$ conda-env-export --help
Usage: conda-env-export [OPTIONS]

Options:
  -n, --name TEXT           Name of environment  [default: `{activated}`]
  --conda-all               Output all conda deps  [default: False]
  --pip-all                 Output all pip deps  [default: False]
  --separate                Output to separate files  [default: False]
  --reserve-duplicates      Reserve duplicates  [default: False]
  --include TEXT            Force to include deps (ignore case)
  --exclude TEXT            Force to exclude deps (ignore case)
  --extra-pip-requirements  Output an extra `requirements.txt`  [default: False]
  --no-prefix               Remove `prefix` in target yml file  [default: False]
  --to-folder DIRECTORY     Where to output the file(s)  [default: ./]
  --to-file FILE            Filename of the output yml file  [default: `{activated}`]
  --help                    Show this message and exit.

[RECOMMEND]

Export current activated env, just run:

$ conda-env-export

[RECOMMEND]

Export a named env, e.g. py37, run:

$ conda-env-export -n py37

[RECOMMEND]

Export current activated env to separate files (activated.yml and requirements.txt), just run:

$ conda-env-export --separate

NOTE: –separate is different from –extra-pip-requirements in the output yml file, where the yml from –separate doesn’t explicitly list pip dependencies. It will use -r requirements.txt instead.

[RECOMMEND]

Export current activated env and output an EXTRA pip requirements file, just run:

$ conda-env-export --extra-pip-requirements

WHY: Sometimes it’ll fail to install some pip deps when executing conda env create -f env.yml, so it’s much more convenient to install pip deps via pip install -r requirements.txt rather than conda env update -f env.yml –prune.

Export a named env and ensure that output MUST include pip and PyYAML, run:

$ conda-env-export -n py37 --include pip --include pyyaml

Export a named env and ensure that output MUST exclude pip and PyYAML, run:

$ conda-env-export -n py37 --exclude pip --exclude pyyaml

Export with all conda deps and all pip deps of py37

$ conda-env-export -n py37 --conda-all --pip-all

Export with all conda deps and all pip deps of py37, and DO NOT remove duplicates

$ conda-env-export -n py37 --conda-all --pip-all --reserve-duplicates

Note: The operation of remove duplicates refers to remove those deps in pip, which are already in conda deps.

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.6.2 (2025-11-20)

  • Fix https://github.com/luffy-yu/conda_env_export/issues/11

0.6.1 (2024-10-03)

  • Remove menuinst dependency by using conda==v4.3.16.2

0.6.0 (2024-09-04)

  • MAJOR UPDATE: Support Python 3.11

0.5.1 (2024-08-07)

  • Fix https://github.com/luffy-yu/conda_env_export/issues/8

0.5.0 (2024-02-05)

  • Fix https://github.com/luffy-yu/conda_env_export/issues/5 and https://github.com/luffy-yu/conda_env_export/issues/6

0.4.5 (2022-07-26)

  • Fix https://github.com/luffy-yu/conda_env_export/issues/3 and https://github.com/luffy-yu/conda_env_export/issues/4

0.4.4 (2022-07-18)

  • Fix https://github.com/luffy-yu/conda_env_export/issues/2

0.4.3 (2021-12-20)

  • Add python output in conda section

0.4.2 (2021-12-18)

  • Fix bugs in Windows

0.4.1 (2021-12-17)

  • Replace f’{}’ with ‘’%

0.4.0 (2021-12-17)

  • MAJOR UPDATE: Support Windows

0.3.2 (2021-04-14)

  • Add option: no-prefix.

0.3.1 (2021-03-07)

  • Update document.

0.3.0 (2021-03-07)

  • Add options: include and exclude.

  • Add option: extra-pip-requirements.

0.2.2 (2020-12-19)

  • Update document.

0.2.1 (2020-12-18)

  • Specify pip version.

0.2.0 (2020-12-05)

  • Refactor.

0.1.4 (2020-11-30)

  • Specify pyyaml verison.

0.1.3 (2020-11-29)

  • Fix typo.

0.1.2 (2020-11-29)

  • Overwrite PyPI verison.

0.1.1 (2020-11-29)

  • Update documents.

0.1.0 (2020-11-29)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

conda_env_export-0.6.2-py2.py3-none-any.whl (9.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file conda_env_export-0.6.2-py2.py3-none-any.whl.

File metadata

  • Download URL: conda_env_export-0.6.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0.post20201006 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.7.9

File hashes

Hashes for conda_env_export-0.6.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c949662d31494643dd2da6ffc5fa24dba0b9cf98ad417eed72e54e927cde8ffc
MD5 e9e5ca0fc857ebc434eaf9f0aee53b23
BLAKE2b-256 0ec042e2bd156e6369a8e0058d31e8623ee632cc4d81ad22158f2346f1650e6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page