pyenv-virtualenv icon indicating copy to clipboard operation
pyenv-virtualenv copied to clipboard

pyenv-virtualenv: version `myvenv' is not a virtualenv

Open hubitor opened this issue 6 years ago • 9 comments

When I create a venv like this:

$ pyenv virtualenv python_version myvenv e.g. python_version: anaconda3-5.2.0

and try to activate the venv with either:

$ pyenv activate myvenv or

$ source activate myvenv I get this error:

pyenv-virtualenv: version `myvenv' is not a virtualenv

When I do $ conda info --envs venv appears with the full path but its name (myvenv) is empty.

I can still activate it by using the full path but it was working fine just with the name before. I have no idea why it doesn't work anymore.

EDIT: Now it doesn't work with the full path either. This doesn't work too: $ pyenv activate anaconda3-5.2.0/envs/myenv

EDIT 2: I tried to create a new venv with conda like this: conda create -n myenv anaconda=5.2.0 and the venv now appears normally with $ conda info --envs and gets activated normally with: conda activate myenv

hubitor avatar Jul 04 '18 15:07 hubitor

I am having very similar problems. I'll see if the conda create -n myenv anaconda=5.2.0 works

djinnome avatar Jul 11 '18 05:07 djinnome

I was having the same problem, what actually worked for me was just updating the following git repos

~/.pyenv --> git pull origin master ~/.pyenv/plugins/pyenv-installer --> git pull origin master ~/.pyenv/plugins/pyenv-virtualenv --> git pull origin master

davidlealxyz avatar Jul 30 '18 14:07 davidlealxyz

@jesuslemus : didn't work for me.

hubitor avatar Aug 02 '18 10:08 hubitor

I found the correct way to use pyenv manage anaconda.

Install anaconda using pyenv.

pyenv install anaconda-xxx

Then activate anaconda environment. DO NOT use pyenv virtualenv anaconda xxx to create virtualenv. Just do this:

pyenv activate anaconda-xxx

Now, you can use conda to create virtualenv:

conda create -n myenv python=3.6
conda activate myenv
conda deactivate

I guess that pyenv can no longer directly manage the virtualenv of anaconda. So we have to activate anaconda env first, and then use conda to manage anaconda virtualenv.

It works for me. Hope it helps you.

But I still like the old way. :<

TitorX avatar Oct 18 '18 17:10 TitorX

I found the correct way to use pyenv manage anaconda.

Install anaconda using pyenv.

pyenv install anaconda-xxx

Then activate anaconda environment. DO NOT use pyenv virtualenv anaconda xxx to create virtualenv. Just do this:

pyenv activate anaconda-xxx

Now, you can use conda to create virtualenv:

conda create -n myenv python=3.6
conda activate myenv
conda deactivate

I guess that pyenv can no longer directly manage the virtualenv of anaconda. So we have to activate anaconda env first, and then use conda to manage anaconda virtualenv.

It works for me. Hope it helps you.

But I still like the old way. :<

I found the correct way to use pyenv manage anaconda.

Install anaconda using pyenv.

pyenv install anaconda-xxx

Then activate anaconda environment. DO NOT use pyenv virtualenv anaconda xxx to create virtualenv. Just do this:

pyenv activate anaconda-xxx

Now, you can use conda to create virtualenv:

conda create -n myenv python=3.6
conda activate myenv
conda deactivate

I guess that pyenv can no longer directly manage the virtualenv of anaconda. So we have to activate anaconda env first, and then use conda to manage anaconda virtualenv.

It works for me. Hope it helps you.

But I still like the old way. :<

I am thinking why I need pyenv-virtualenv? It seems that I just need pyenv + conda?

jxxiao avatar Dec 14 '18 03:12 jxxiao

same issue here

tshu-w avatar Dec 19 '18 16:12 tshu-w

same issue here

yssource avatar Mar 26 '19 17:03 yssource

EDIT 2: works for me. The following works also.

  • conda create -n myenv anaconda=5.2.0 python=3.7
  • pyenv activate myenv

yssource avatar Mar 27 '19 00:03 yssource

I've done as follows which is similar to @TitorX 's recommendation but to use with pyenv-virtualenv.

Create a conda environment within anaconda3 activated status.

# set pyenv global with anaconda3. 
$ pyenv global anaconda3-5.3.1 

# create a conda env
(anaconda3-5.3.1) $ conda create -n test-conda-env python=3.7

# restore global env to exit from the anaconda3 env
(anaconda3-5.3.1) $ pyenv global system

Create virtualenv with the created environment.

# create virtualenv with the created conda env
$ pyenv virtualenv anaconda3-5.3.1/envs/test-conda-env test-conda-env

# set local env (as default env in the current path)
$ pyenv local test-conda-env

Now the conda environment is automatically activated whenever you visit the path. But you should manually activate the newly created conda environment within the path :(

(test-conda-env) $ conda activate test-conda-env
(test-conda-env) (test-conda-env) $

ksseono avatar Feb 15 '20 14:02 ksseono