pyenv / pyenv-virtualenv

a pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
MIT License
6.18k stars 399 forks source link

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

Open hubitor opened 6 years ago

hubitor commented 6 years ago

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

djinnome commented 6 years ago

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

davidlealxyz commented 5 years ago

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

hubitor commented 5 years ago

@jesuslemus : didn't work for me.

TitorX commented 5 years ago

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. :<

jxxiao commented 5 years ago

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?

tshu-w commented 5 years ago

same issue here

yssource commented 5 years ago

same issue here

yssource commented 5 years ago

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

ksseono commented 4 years ago

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) $
MoadRAZZAKI commented 2 months ago

i had the same issue in my kali linux virtual machine, you have to type these commands :

pyenv virtualenv "name of your virtual environement" pyenv activate "name of your virtual environement"