Create empty conda environment

PythonAnaconda

Python Problem Overview


I can create a new conda environment, with program biopython with this:

conda create --name snowflakes biopython

What if I do not want to install any program? It seems I can not do that:

» conda create --name tryout
Error: too few arguments, must supply command line package specs or --file

You can specify one or more default packages to install when creating
an environment.  Doing so allows you to call conda create without
explicitly providing any package names.

To set the provided packages, call conda config like this:

    conda config --add create_default_packages PACKAGE_NAME

Python Solutions


Solution 1 - Python

You can give a package name of just "python" to get a base, empty install.

conda create --name myenv python
conda create --name myenv python=3.4

Solution 2 - Python

If you've created a create_default_packages block in your .condarc file, @joelion's answer will install those packages. If you don't want those, use the --no-default-packages flag. For example:

conda create --name myenv python --no-default-packages

Solution 3 - Python

This is how to create a truly empty (light) conda_env with 0 packages:

conda create --name myenv --no-default-packages

it will take a few seconds to create and finish.

Solution 4 - Python

To create an environment that is absolutely empty, without python and/or any other default package, just make a new folder in envs directory in your Anaconda installation (Anaconda3 in this example):.

~\Anaconda3\envs>mkdir empy_env

The first time that you activate this environment a directory named Scripts in Windows, bin in Linux, with a few batch files are created. At the time of this post this works for Anaconda version 4.3.30 both in Windows and Linux.

I have noticed that @cel has suggested the same thing in the first comment under the question, but obviously it hasn't got the attention it deserves!

Solution 5 - Python

For Conda 2020.11 Linux, the following command will create an empty environment.

conda create --name your-env-name

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionblueFastView Question on Stackoverflow
Solution 1 - PythonjoelionView Answer on Stackoverflow
Solution 2 - PythonfarenorthView Answer on Stackoverflow
Solution 3 - PythonAymen AlsaadiView Answer on Stackoverflow
Solution 4 - PythonReza DodgeView Answer on Stackoverflow
Solution 5 - Pythonl3043YView Answer on Stackoverflow