#15152·conda

Feature Request: Environment Variable Expansion in conda --prefix

Author: ryanskeithCreated Sep 3, 2025Updated Sep 19, 2026
Labelstype::featuresource::contributorstale

Checklist

  • I added a descriptive title
  • I searched open requests and couldn't find a duplicate

What is the idea?

Feature Request: Environment Variable Expansion in conda --prefix

Use Case

Currently, environment variables in --prefix paths are not expanded automatically:

bash
conda install --prefix $HOME/myenv package
# Results in literal path: "$HOME/myenv"

It would be nice to work like other automatically expand environment variables for ease of use ( /Users/username/myenv).

Proposed Change

Modify add_parser_prefix() in conda/cli/conda_argparse.py to use os.path.expandvars():

python
# In conda/cli/conda_argparse.py
def add_parser_prefix(parser):
    parser.add_argument(
        '--prefix',
        help='Full path to environment prefix (supports environment variables)',
        metavar='PATH',
        type=lambda x: super_cool_path_checking(os.path.expandvars(x)) if x else x
    )

This standardizes internally and for future plugins at what is expected.

Why is this needed?

No response

What should happen?

No response

Additional Context

No response