Skip to content

"source ./miniconda-py-3.9.20/bin/activate" does not give access to conda when running "python -m conda" #2811

Open
@0x303

Description

@0x303

Goal

I want to be able to activate my miniconda virtual environment and then run conda and jupyter like this:

# Activates miniconda virtual environment

$ python -m conda

$ python -m jupyter

I want to do this because when my virtual environment is activated I know that I am running my specified version of python, and using the verbose python -m <module_name> syntax ensures I am running the subcommand of my specified python version, and not a globally installed equivalent.

The issue is, I can't seem to get this to work reliably. After installing my specified miniconda python version with pyenv, I then create a virtual environment using the virtualenv command. This gives me access to do python -m jupyter but not python -m conda.

If I install pyenv-virtualenv as a pyenv plugin and then do pyenv install miniconda3-3.9-24.9.2-0 and then run pyenv activate <python_version_name>, like in pyenv activate miniconda3-3.9-24.9.2-0, then I will be able to run python -m conda but not python -m jupyter.

As an edge case, I noticed if I instead use pyenv-virtualenv to create a new miniconda environment (instead of using the default one) by giving it a custom name with the pyenv <python_version> <environment_name> command and then activate the environment with pyenv activate <environment_name> I will not be able to use python -m conda nor python -m jupyter.

I am not sure what I am doing wrong... I just want to be able to run both subcommands in a miniconda virtual environment using the verbose python -m <module_name> syntax.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions