gforsyth / xonda

DEPRECATED: (previously a thin wrapper around conda for xonsh)
BSD 3-Clause "New" or "Revised" License
11 stars 9 forks source link

Environments at non-standard locations #16

Closed HenningTimm closed 6 years ago

HenningTimm commented 7 years ago

Recently I needed to use an environment that did not reside in /home/me/miniconda3/envs. I ran out of disk quota and wanted to store the environment on the local /scratch folder on my workstation. Hence, I used

me@machine ~ $ conda create -p /scratch/envs/bigenv <lots of packages>

to create the environment. The conda way to activate it would be

me@machine ~ $ source activate /scratch/envs/bigenv

Such an environment can not be activated with Xonda, since its path can not be found in the config.envs_dirs variable. I added a check if the given environment name is an existing path with a bin folder. I created a pull request to fix this.

Potential problems:

What is not yet working:

The conda info command does not work yet. When calling conda info, xonda should pipe the command through to conda. This works, but conda looks at the wrong path. I am not sure why:

# in bash
me@machine:~$ source activate /scratch/envs/bigenv/
(/scratch/envs/bigenv/) me@machine:~$ conda list
# packages in environment at /scratch/envs/bigenv:
#
ca-certificates           2017.7.27.1                   0    conda-forge
certifi                   2017.7.27.1              py27_0    conda-forge
ncurses                   5.9                          10    conda-forge
openssl                   1.0.2l                        0    conda-forge
pip                       9.0.1                    py27_0    conda-forge
python                    2.7.13                        1    conda-forge
readline                  6.2                           0    conda-forge
setuptools                36.3.0                   py27_0    conda-forge
sqlite                    3.13.0                        1    conda-forge
tk                        8.5.19                        2    conda-forge
wheel                     0.29.0                   py27_0    conda-forge
zlib                      1.2.11                        0    conda-forge
(/scratch/envs/bigenv/) me@machine:~$ source deactivate
me@machine:~$ 

# switching to xonsh
me@machine:~$ xonsh

me@machine ~ $ conda activate /scratch/envs/bigenv/
(bigenv) me@machine ~ $ conda list

CondaEnvironmentNotFoundError: Could not find environment: /home/me/miniconda3/envs/bigenv .
You can list all discoverable environments with `conda info --envs`.

(bigenv) me@machine ~ $ /scratch/envs/bigenv/bin/conda list

CondaEnvironmentNotFoundError: Could not find environment: /home/me/miniconda3/envs/bigenv .
You can list all discoverable environments with `conda info --envs`.

(bigenv) me@machine ~ [1]$ 

Please note that this env uses Python 2.7 to better distinguish it from my other environments.

gforsyth commented 6 years ago

Fixed in #17