pyenv activate <venv> does not work properly

Abierto
#329 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python, shell
Área
cli, tooling

Línea de trabajo

Start by reproducing the reported pyenv activate test380, python -V, pyenv which python, and exec "$SHELL" sequence in a fresh shell. Inspect how shell initialization and activation affect command selection; done means the activated environment consistently reports Python 3.8.0 without requiring a shell reset.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I have just noticed recently, that the above mentioned command does not switch to a virtual environment as before.
Here how it looks like atm:

(base) art@HP:~$ python --version
Python 3.7.4
(base) art@HP:~$ python -V
Python 3.7.4
(base) art@HP:~$ pyenv versions
* system (set by /home/art/.python-version)
  3.7.5
  3.8.0
  3.8.0/envs/cuda380
  cuda380
(base) art@HP:~$ pyenv virtualenv 3.8.0 test380
Looking in links: /tmp/tmp49kcmsng
Requirement already satisfied: setuptools in /home/art/.pyenv/versions/3.8.0/envs/test380/lib/python3.8/site-packages (41.2.0)
Requirement already satisfied: pip in /home/art/.pyenv/versions/3.8.0/envs/test380/lib/python3.8/site-packages (19.2.3)
(base) art@HP:~$ pyenv activate test380
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(test380) (base) art@HP:~$ python --version
Python 3.7.4
(test380) (base) art@HP:~$ python -V
Python 3.7.4
(test380) (base) art@HP:~$

From the code above you can see that I created virtual environment called "test380" which is based on 3.8.0 version of python. But when I activate it and check the version it says 3.7.4 - i.e. global version. Same if I will try pip list for example - it will show me the packages of the global python, not the virtual active one. Interesting thing is that if I go to pycharm and add the test380 venv as an interpreter, it will be 3.8.0. I am a bit confused, whats wrong in here, any idea?

I have tried deleting the .pyenv folder and installing it again with

$ curl https://pyenv.run | bash

Now I get some additional messages when I try to display the python version, but the version it shows me is still the global one:

(base) art@HP:~$ pyenv versions
* system (set by /home/art/.python-version)
  3.8.0
  3.8.0/envs/test380
  test380
(base) art@HP:~$ pyenv activate test380
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(test380) (base) art@HP:~$ python -V
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 3.7.4

After shell reset with '$ exec "$SHELL"" it finally shows the correct venv version, but it works only once, if I reopen the terminal, the problem with wrong version remains until I execute shell reset again. Moreover after shell reset it is not shown which venv is active in the brackets, it only shows (base).

(base) art@HP:~$ pyenv activate test380
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(test380) (base) art@HP:~$ python -V
Python 3.7.4
(test380) (base) art@HP:~$ exec "$SHELL"
(base) art@HP:~$ python -V
Python 3.8.0
(base) art@HP:~$ pyenv which python
/home/art/.pyenv/versions/test380/bin/python
(base) art@HP:~$
Lenguaje dominante
Shell
Estrellas
6.7k
Forks
433
Merge medio
1 d 8 h
PR fusionados (30 d)
11

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pyenv/pyenv-virtualenv

Todos los issues de pyenv/pyenv-virtualenv

Issues similares

Más issues de Shell/Bash

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.