virtualenv icon indicating copy to clipboard operation
virtualenv copied to clipboard

inconsistent home value in pyvenv.cfg between venv and virtualenv

Open jouve opened this issue 3 years ago • 2 comments

Issue

the home value in pyvenv.cfg is inconsistent when generated by venv and virtualenv :

$ python3.10 -m venv venv
$ grep home venv/pyvenv.cfg 
home = /usr/bin

vs

$ virtualenv --python python3.10 virtualenv
created virtual environment CPython3.10.0.final.0-64 in 114ms
  creator CPython3Posix(dest=/home/cyril/work/cpython/virtualenv, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/cyril/.local/share/virtualenv)
    added seed packages: pip==21.3.1, setuptools==58.5.3, wheel==0.37.0
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
$ grep home virtualenv/pyvenv.cfg 
home = /usr

home is:

  • /usr/bin with venv
  • /usr̀ with virtualenv.

I would expect to have the same value (/usr/bin).

ref

the value of the home key is the directory containing the Python executable used to create this virtual environment

Environment

Provide at least:

  • OS: ubuntu 21.10
  • pip list of the host python where virtualenv is installed:
Package                           Version
--------------------------------- -------
backports.entry-points-selectable 1.1.1
distlib                           0.3.3
filelock                          3.4.0
pip                               21.3.1
pkg_resources                     0.0.0
platformdirs                      2.4.0
setuptools                        59.4.0
six                               1.16.0
virtualenv                        20.10.0
wheel                             0.37.0

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:


jouve avatar Dec 05 '21 15:12 jouve

What's the content of /usr and /usr/bin ? Perhaps both values are valid here? Can you replicate this with a docker image?

gaborbernat avatar Dec 05 '21 23:12 gaborbernat

/usr is a standard /usr in ubuntu :)

I reproduce the same with my python in /opt/cpython: venv gives home = /opt/cpython/bin and virtualenv gives home = /opt/cpython

or with python:3.10-alpine:

venv/pyvenv.cfg:home = /usr/local/bin
virtualenv/pyvenv.cfg:home = /usr/local

so home with virtualenv is the same as venv but without the final /bin

jouve avatar Dec 05 '21 23:12 jouve

As this is 2 years old without updates closing it.

gaborbernat avatar Jun 27 '23 03:06 gaborbernat