python anaconda conda-pack - environment doesn't exist

34 Views Asked by At

I am trying to migrate my environment to a new machine that does not have internet access using the Anaconda command “conda pack.” However, the command returns that the environment was not found

I am using windows

env list

$ conda env list
# conda environments:
#
base                     C:\User

enter image description here

comando conda pack

$ conda pack -n base
Collecting packages...
CondaPackError: Environment name 'base' doesn't exist

enter image description here

Do you have any ideas on how to make the command work?

1

There are 1 best solutions below

0
merv On BEST ANSWER

conda-pack is not intended for base

The base environment is special and doesn't live in the envs/ folder, where conda pack is going to look for an environment to package. Generally, you should not be working with base as an environment for redeployment.1 Instead, create a new environment with the packages you wish to bundle and use conda pack on that.

Use constructor for custom base installers

If you want to create an installer that doesn't assume a base installation and will instead create one, then this should be done with Conda's constructor tool. This is what Miniforge uses to bundle its custom Conda deployments and provides additional control over configuration settings, not just package installation.


[1]: The conda-pack tool assumes that an existing Conda installation is present, i.e., there should already be a base on the target system. Hence, it wouldn't make sense to deploy a new "base" to the system - either overwriting the existing one, or creating an new environment with conda installed. One should only have conda installed in base.