Search code examples
pythoncontinuous-integrationcross-platformminicondapyenv

Looking for a cross-platform (Linux, MacOS, Windows) tool for managing Python environments


I was investigating the use of Anaconda environments for CI/CD (since, to my knowledge, it is the only platform that supports Linux, MacOS, and Windows). I tried to use Miniconda which is supposed to only install the bare minimum. However, I realised that, by default, Miniconda is not "mini" after all. For example, if I attempt to create a new Python environment (conda create -n py36 python=3.6 anaconda), it will install a bunch of not needed stuff like JupyterLab and others. So, before moving to pyenv (for Linux and MacOS) and pyenv-win (for Windows), I would like to ask:

  • Is there a way to setup different python environments with anaconda/miniconda without having to install a bunch of extra packages every time I create a new environment?
  • Is there any other tool for managing python environments that supports Linux, MacOS, and Windows?

Thank you.


Solution

  • Only install python and its dependencies by

    conda create -n py36 python=3.6
    

    without the anaconda package.

    Detailed Explanation

    conda create -n py36 python=3.6

    • conda create -n py36, create an environment, actually an empty folder
    • python=3.6, installed python 3.6 into this env

    conda is a package manager, both python and anaconda are packages could be installed by it.

    Unlike package python, anaconda is a meta package, which does not contain actual software and simply depends on other packages to be installed.

    Download an anaconda package here and extract content from it. The actual packages to be installed is listed in info/recipe/meta.yaml.

    package:
        name: anaconda
        version: '2019.07'
    build:
        ignore_run_exports:
            - '*'
        number: '0'
        pin_depends: strict
        string: py37_0
    requirements:
        build:
            - python 3.7.3 h8c8aaf0_1
        is_meta_pkg:
            - true
        run:
            - alabaster 0.7.12 py37_0
            - anaconda-client 1.7.2 py37_0
            - anaconda-project 0.8.3 py_0
            # ...
            # about 260 packages in total