Search code examples
cygwinanacondacondaminicondababun

Conda with Cygwin: Environment created but location not found and unusable after activation


On Windows 10 I have Miniconda3 installed under C:/home/miniconda3

I'm using Cygwin (bash shell emulator) and within the Cygwin shell (at the command line) I'm trying to create a virtual environment using Conda.

I am creating an environment using Conda and it appears to be created OK, however when I activate and then try to use the environment I get an error that appears to show that there's something amiss with the environment that's been created. Here's what I've tried so far:

Start with a fresh Miniconda installation (downloaded and installed today), and list the environments:

$ conda env list
# conda environments:
#
base                  *  C:\home\miniconda3

Create an environment:

$ conda create -n test_env
Solving environment: ...working... done

## Package Plan ##

  environment location: C:\home\miniconda3\envs\test_env


Proceed ([y]/n)?

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
#
# To activate this environment, use:
# > activate test_env
#
# To deactivate an active environment, use:
# > deactivate
#
# * for power-users using bash, you must source
#

Display the environments again, showing that the environment was created:

$ conda env list
# conda environments:
#
base                  *  C:\home\miniconda3
test_env                 C:\home\miniconda3\envs\test_env

Activate the new environment, using source (since Cygwin is running bash). Now when I list the environments I expect to see an asterisk next to the test environment's name, indicating that it's now the active environment, but that's missing:

$ source activate test_env
$ conda env list
# conda environments:
#
base                     C:\home\miniconda3
test_env                 C:\home\miniconda3\envs\test_env

At this point I can try using Conda commands and they'll all fail since the environment's not being found and/or the environment itself is incomplete/malformed/corrupted:

$ conda list

EnvironmentLocationNotFound: Not a conda environment: C:\home\miniconda3\envs\test_env

$ conda install pandas

EnvironmentLocationNotFound: Not a conda environment: C:\home\miniconda3\envs\test_env

$ conda update pandas
PackageNotInstalledError: Package is not installed in prefix.
  prefix: C:\home\miniconda3\envs\test_env
  package name: pandas

When I try to deactivate the environment I get the following errors:

$ source deactivate
': not a valid identifierULT_ENV
': not a valid identifier
': not a valid identifierIX
': not a valid identifierPT_MODIFIER
': not a valid identifierON_EXE

What might be going wrong, and how can I fix this?


Solution

  • Running conda under Cygwin is not fully supported, and the recommended solution for users who want to run conda and associated conda environments in a Linux like shell on Windows is to use the bash shell that comes included with the git client for Windows