pyenv-virtualenv: Can not access Anaconda/Miniconda environment as virtualenv
I’m showing you the steps I use to create a virtualenv based on miniconda. Finally you will see that the virtualenv was created but I can’t access to it.
1.0. Check my initial pyenv versions:
$ pyenv versions
* system (set by /home/oscar/.python-version)
2.7.9
3.5.1
1.1 Install miniconda:
$ pyenv install miniconda3-4.0.5
$ pyenv versions
* system (set by /home/oscar/.python-version)
2.7.9
3.5.1
miniconda3-4.0.5
1.2. Create the venvtest virtualenv based on miniconda:
$ pyenv virtualenv miniconda3-4.0.5 venvtest
$ pyenv versions
* system (set by /home/oscar/.python-version)
2.7.9
3.5.1
miniconda3-4.0.5
miniconda3-4.0.5/envs/venvtest
venvtest
When I want to check if the virtualenv was created, It doesn’t show it. So I can’t no access to it 😢
$ pyenv virtualenvs
miniconda3-4.0.5 (created from /home/oscar/.pyenv/versions/miniconda3-4.0.5)
$ pyenv activate ... (autocompleting)
--help miniconda3-4.0.5 --unset
Please, I hope you can help me.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 30
Just to confirm to anyone visiting this thread. @taschini’s solution:
It seems that both
conda
andactivate
are required.I created a pyenv-virtualenv hook for this:
After the hook is installed:
For me, on conda 4.1.2 I had to run
source ~/.pyenv/versions/<env_dir>/bin/activate <env_name>
at least once to make it workCreating by hand the symbolic links within the environment bin directory to the
conda
andactivate
that you find in the conda base environment seems to fix the issue.E.g.,
Edit This work-around is no longer necessary after #290.
I’m using pyenv 2.0.0 on macOS 10.14.6.
pyenv local
still does not work for me out-of-box. To be exact, bothconda
andactivate
commands are not in thebin
directory in env created by miniconda.@taschini 's answer is a workaround, not a solution. This is something
pyenv
should do internally, so this issue should be reopened until that’s the case.@clbarnes I agree that pyenv should provide a built-in solution for this and this thread should remain open to continue tracking the issue.
#251 fixed activating an environment via conda:
But I agree that doing this via pyenv-virtualenv should also work. (Though the above workflow is sufficient for me so I probably won’t put in a PR).
conda 4.x switched to using
conda activate env-name