necaris / conda.el

Emacs helper library (and minor mode) to work with conda environments
MIT License
153 stars 49 forks source link

Fix #68 `conda-env-activate-path` for Windows #71

Closed arthurcgusmao closed 4 years ago

arthurcgusmao commented 4 years ago

The function conda-env-activate-path was using the function conda-env-is-valid-path to check the validity of a conda env. This function was probably never compatible with Windows since for those systems python.exe lays on the root of the env dir, as in https://docs.anaconda.com/anaconda/user-guide/tasks/integration/python-path/

This commit fixes this error by using an existing, older function to check the validity of environments, namely, conda--env-dir-is-valid.

arthurcgusmao commented 4 years ago

@necaris I think I agree with your statement, but, looking deeper, could one have a conda env without Python? I tried creating a new env with conda create --name test and then running tree /path/to/anaconda/envs/test and got the following:

/path/to/anaconda/envs/test/
└── conda-meta
    └── history

Even though this environment doesn't seem to be useful since there is nothing on it. Then I tested installing R and bin/python was automatically created, so, probably, when there is no such file, the environment is useless indeed.

Anyways, leaving this comment here for future reference.

necaris commented 4 years ago

@arthurcgusmao note that if you do, for instance, conda create -n node nodejs then you will have a conda environment containing nodejs. I believe most recent versions of conda are guaranteed to have a conda-meta subdirectory present (which we could use), but I'm not sure how far back that was true.