Listing environment variables in conda 4.7?
Asked Answered
M

2

6

I am using conda 4.7.12 and trying to list my environment variables according to the documentation by running conda env config vars list however I get the error

usage: conda-env [-h] {create,export,list,remove,update} ... > conda-env: error: invalid choice: 'config' (choose from 'create', 'export', 'list', 'remove', 'update')

I have a feeling it is because the documentation is pointing to "latest" which is no 4.7 but rather 4.8 (I believe). I can't find the old docs for 4.7 so trying to find a similar command to list environment variables in version 4.7.

Mascia answered 21/2, 2020 at 18:34 Comment(0)
M
3

Yes, your hunch is right: it is a v4.8 feature. Previous to this, env-specific environment variables could only be managed through scripts under $PREFIX/conda-meta/{de}activate.d/, so if there are env-specific variables you'd find them there. E.g., try greping around in activate.d/ scripts for ^EXPORT commands.

This is a brand-new feature and I haven't seen it used much yet, so I'd be surprised if it even turned anything up. It's blank for all my envs. I'm not sure that the mechanism for packages to specify env vars through this interface exists yet. For now, I think the only way to use it is to do conda env config vars set.

More generally, there is conda info --system, which lists the system's environment variables.

Mook answered 21/2, 2020 at 19:3 Comment(0)
S
0

Using miniconda, it now seems to work:

$ conda --version
conda 24.5.0

$ conda env config vars set LD_LIBRARY_PATH=/usr/local/cuda-12.5/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

$ conda env config vars list
LD_LIBRARY_PATH = /usr/local/cuda-12.5/lib64:
Shaia answered 22/7, 2024 at 15:4 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.