Description
Issue
Debian has set the sysconfig default scheme from posix_prefix
to posix_local
(https://lists.debian.org/debian-python/2022/03/msg00039.html). And when posix_local
being chosen, the default ./venv/bin/activate
is set to ./venv/local/bin/activate
-- AND, it is BROKEN.
Reproduce:
Open an empty directory and use the command virtualenv venv
$ virtualenv venv
created virtual environment CPython3.10.4.final.0-64 in 101ms
creator CPython3Posix(dest=/home/yingmanwumen/Desktop/test/venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/yingmanwumen/.local/share/virtualenv)
added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
the sysconfig scheme is posix_local
:
$ python -m sysconfig
Platform: "linux-x86_64"
Python version: "3.10"
Current installation scheme: "posix_local"
Paths:
data = "/usr/local"
include = "/usr/include/python3.10"
platinclude = "/usr/include/python3.10"
platlib = "/usr/local/lib/python3.10/dist-packages"
platstdlib = "/usr/lib/python3.10"
purelib = "/usr/local/lib/python3.10/dist-packages"
scripts = "/usr/local/bin"
stdlib = "/usr/lib/python3.10"
...
And the directories:
$ tree -L 3
.
└── venv
├── lib
│ └── python3.10
├── local
│ ├── bin
│ └── lib
└── pyvenv.cfg
6 directories, 1 file
Activate the venv
by source ./venv/local/bin/activate
, then use the command pip list
:
pip list
Package Version
------------------- --------------
appdirs 1.4.4
asciinema 2.2.0
attrs 21.2.0
beautifulsoup4 4.11.1
Brlapi 0.8.3
Brotli 1.0.9
bs4 0.0.1
certifi 2020.6.20
chardet 4.0.0
charset-normalizer 2.0.6
click 8.1.3
colorama 0.4.4
commonmark 0.9.1
cppman 0.5.3
cupshelpers 1.0
cycler 0.11.0
dbus-python 1.2.18
decorator 4.4.2
distlib 0.3.4
distro 1.7.0
distro-info 1.1
dlib 19.23.1
filelock 3.6.0
Flask 2.1.2
fonttools 4.32.0
fs 2.4.12
fuse-python 1.0.5
gpg 1.16.0-unknown
greenlet 1.1.2
gyp 0.1
html5lib 1.1
idna 3.3
importlib-metadata 4.6.4
iniconfig 1.1.1
itsdangerous 2.1.2
Jinja2 3.1.2
jsonschema 3.2.0
kaggle 1.5.12
kiwisolver 1.3.2
louis 3.21.0
lxml 4.8.0
lz4 4.0.0+dfsg
Mako 1.1.3
Markdown 3.3.7
MarkupSafe 2.1.1
matplotlib 3.5.1
memray 1.0.3
mercurial 6.1.2
more-itertools 8.10.0
mpmath 0.0.0
msgpack 1.0.3
mutagen 1.45.1
numpy 1.21.5
olefile 0.46
opencv-python 4.5.5.64
packaging 21.3
pbr 5.9.0
perf 0.1
pexpect 4.8.0
Pillow 9.0.1
pip 22.1.1
pip-review 1.1.1
pip-search 0.0.12
platformdirs 2.5.2
pluggy 1.0.0
psutil 5.9.0
ptyprocess 0.7.0
py 1.11.0
PyAudio 0.2.11
pycairo 1.20.1
pycryptodomex 3.11.0
pycups 2.0.1
pycurl 7.44.1
Pygments 2.11.2
PyGObject 3.42.1
pylibacl 0.6.0
pynvim 0.4.2
pyparsing 3.0.7
PyQt5 5.15.6
PyQt5-sip 12.10.1
PyQtWebEngine 5.15.5
pyrsistent 0.18.1
pysmbc 1.0.23
pyte 0.8.0
pytest 7.1.2
pytest-memray 1.0.0
python-apt 2.3.0+b1
python-dateutil 2.8.1
python-debian 0.1.44
python-slugify 6.1.2
pytz 2022.1
pyxattr 0.7.2
pyxdg 0.27
PyYAML 5.4.1
requests 2.27.1
rich 10.16.2
scipy 1.8.1
screenkey 1.5
Send2Trash 1.8.1b0
setuptools 62.3.2
six 1.16.0
soupsieve 2.3.2.post1
specan 0.0.0
stevedore 3.5.0
sympy 1.10.1
text-unidecode 1.3
tomli 2.0.1
tornado 6.1
tqdm 4.64.0
trash-cli 0.22.4.16
ufoLib2 0.13.1
unattended-upgrades 0.1
unicodedata2 14.0.0
urllib3 1.26.9
virtualenv 20.14.1
virtualenv-clone 0.5.7
virtualenvwrapper 4.8.4
wcwidth 0.2.5
webencodings 0.5.1
websockets 10.3
Werkzeug 2.1.2
wheel 0.37.1
xdg 5.1.1
xxh-xxh 0.8.10
yt-dlp 2022.5.18
zipp 3.8.0
It is the result of the host pip list
!!
I have found the same issue #2340.
It is easy to solve this by add export DEB_PYTHON_INSTALL_LAYOUT='deb'
to ~/.bashrc
to change sysconfig scheme from posix_local
to deb_system
, but I think a proper solution is needed ^_^
Environment
Provide at least:
- OS: Debian testing bookworm
pip list
of the host python wherevirtualenv
is installed:
Package Version
------------------- --------------
appdirs 1.4.4
asciinema 2.2.0
attrs 21.2.0
beautifulsoup4 4.11.1
Brlapi 0.8.3
Brotli 1.0.9
bs4 0.0.1
certifi 2020.6.20
chardet 4.0.0
charset-normalizer 2.0.6
click 8.1.3
colorama 0.4.4
commonmark 0.9.1
cppman 0.5.3
cupshelpers 1.0
cycler 0.11.0
dbus-python 1.2.18
decorator 4.4.2
distlib 0.3.4
distro 1.7.0
distro-info 1.1
dlib 19.23.1
filelock 3.6.0
Flask 2.1.2
fonttools 4.32.0
fs 2.4.12
fuse-python 1.0.5
gpg 1.16.0-unknown
greenlet 1.1.2
gyp 0.1
html5lib 1.1
idna 3.3
importlib-metadata 4.6.4
iniconfig 1.1.1
itsdangerous 2.1.2
Jinja2 3.1.2
jsonschema 3.2.0
kaggle 1.5.12
kiwisolver 1.3.2
louis 3.21.0
lxml 4.8.0
lz4 4.0.0+dfsg
Mako 1.1.3
Markdown 3.3.7
MarkupSafe 2.1.1
matplotlib 3.5.1
memray 1.0.3
mercurial 6.1.2
more-itertools 8.10.0
mpmath 0.0.0
msgpack 1.0.3
mutagen 1.45.1
numpy 1.21.5
olefile 0.46
opencv-python 4.5.5.64
packaging 21.3
pbr 5.9.0
perf 0.1
pexpect 4.8.0
Pillow 9.0.1
pip 22.1.1
pip-review 1.1.1
pip-search 0.0.12
platformdirs 2.5.2
pluggy 1.0.0
psutil 5.9.0
ptyprocess 0.7.0
py 1.11.0
PyAudio 0.2.11
pycairo 1.20.1
pycryptodomex 3.11.0
pycups 2.0.1
pycurl 7.44.1
Pygments 2.11.2
PyGObject 3.42.1
pylibacl 0.6.0
pynvim 0.4.2
pyparsing 3.0.7
PyQt5 5.15.6
PyQt5-sip 12.10.1
PyQtWebEngine 5.15.5
pyrsistent 0.18.1
pysmbc 1.0.23
pyte 0.8.0
pytest 7.1.2
pytest-memray 1.0.0
python-apt 2.3.0+b1
python-dateutil 2.8.1
python-debian 0.1.44
python-slugify 6.1.2
pytz 2022.1
pyxattr 0.7.2
pyxdg 0.27
PyYAML 5.4.1
requests 2.27.1
rich 10.16.2
scipy 1.8.1
screenkey 1.5
Send2Trash 1.8.1b0
setuptools 62.3.2
six 1.16.0
soupsieve 2.3.2.post1
specan 0.0.0
stevedore 3.5.0
sympy 1.10.1
text-unidecode 1.3
tomli 2.0.1
tornado 6.1
tqdm 4.64.0
trash-cli 0.22.4.16
ufoLib2 0.13.1
unattended-upgrades 0.1
unicodedata2 14.0.0
urllib3 1.26.9
virtualenv 20.14.1
virtualenv-clone 0.5.7
virtualenvwrapper 4.8.4
wcwidth 0.2.5
webencodings 0.5.1
websockets 10.3
Werkzeug 2.1.2
wheel 0.37.1
xdg 5.1.1
xxh-xxh 0.8.10
yt-dlp 2022.5.18
zipp 3.8.0
Output of the virtual environment creation
Make sure to run the creation with -vvv --with-traceback
:
390 setup logging to NOTSET [DEBUG report:39]
397 find interpreter for spec PythonSpec(path=/usr/bin/python) [INFO builtin:62]
397 proposed PythonInfo(spec=CPython3.10.4.final.0-64, exe=/usr/bin/python, platform=linux, version='3.10.4 (main, Mar 24 2022, 13:07:27) [GCC 11.2.0]', encoding_fs_io=utf-8-utf-8) [INFO builtin:69]
397 accepted PythonInfo(spec=CPython3.10.4.final.0-64, exe=/usr/bin/python, platform=linux, version='3.10.4 (main, Mar 24 2022, 13:07:27) [GCC 11.2.0]', encoding_fs_io=utf-8-utf-8) [DEBUG builtin:71]
400 filesystem is case-sensitive [DEBUG info:29]
426 create virtual environment via CPython3Posix(dest=/home/yingmanwumen/Desktop/test/venv, clear=False, no_vcs_ignore=False, global=False) [INFO session:52]
426 create folder /home/yingmanwumen/Desktop/test/venv/lib/python3.10 [DEBUG _sync:24]
426 create folder /home/yingmanwumen/Desktop/test/venv/local/bin [DEBUG _sync:24]
427 create folder /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages [DEBUG _sync:24]
427 write /home/yingmanwumen/Desktop/test/venv/pyvenv.cfg [DEBUG pyenv_cfg:34]
428 home = /usr [DEBUG pyenv_cfg:38]
428 implementation = CPython [DEBUG pyenv_cfg:38]
428 version_info = 3.10.4.final.0 [DEBUG pyenv_cfg:38]
428 virtualenv = 20.14.1 [DEBUG pyenv_cfg:38]
428 include-system-site-packages = false [DEBUG pyenv_cfg:38]
428 base-prefix = /usr [DEBUG pyenv_cfg:38]
428 base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
428 base-executable = /usr/bin/python [DEBUG pyenv_cfg:38]
428 symlink /usr/bin/python to /home/yingmanwumen/Desktop/test/venv/local/bin/python [DEBUG _sync:43]
428 create virtualenv import hook file /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/_virtualenv.pth [DEBUG api:95]
428 create /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/_virtualenv.py [DEBUG api:98]
429 ============================== target debug ============================== [DEBUG session:54]
429 debug via /home/yingmanwumen/Desktop/test/venv/local/bin/python /home/yingmanwumen/.local/lib/python3.10/site-packages/virtualenv/create/debug.py [DEBUG creator:224]
429 {
"sys": {
"executable": "/home/yingmanwumen/Desktop/test/venv/local/bin/python",
"_base_executable": "/home/yingmanwumen/Desktop/test/venv/local/bin/python",
"prefix": "/usr",
"base_prefix": "/usr",
"real_prefix": null,
"exec_prefix": "/usr",
"base_exec_prefix": "/usr",
"path": [
"/usr/lib/python310.zip",
"/usr/lib/python3.10",
"/usr/lib/python3.10/lib-dynload",
"/home/yingmanwumen/.local/lib/python3.10/site-packages",
"/usr/local/lib/python3.10/dist-packages",
"/usr/lib/python3/dist-packages",
"/usr/lib/python3.10/dist-packages"
],
"meta_path": [
"<class '_distutils_hack.DistutilsMetaFinder'>",
"<class '_frozen_importlib.BuiltinImporter'>",
"<class '_frozen_importlib.FrozenImporter'>",
"<class '_frozen_importlib_external.PathFinder'>"
],
"fs_encoding": "utf-8",
"io_encoding": "utf-8"
},
"version": "3.10.4 (main, Mar 24 2022, 13:07:27) [GCC 11.2.0]",
"makefile_filename": "/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/Makefile",
"os": "<module 'os' from '/usr/lib/python3.10/os.py'>",
"site": "<module 'site' from '/usr/lib/python3.10/site.py'>",
"datetime": "<module 'datetime' from '/usr/lib/python3.10/datetime.py'>",
"math": "<module 'math' (built-in)>",
"json": "<module 'json' from '/usr/lib/python3.10/json/__init__.py'>"
} [DEBUG session:55]
468 add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/yingmanwumen/.local/share/virtualenv) [INFO session:59]
470 got embed update of distribution wheel from /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/embed/3/wheel.json [DEBUG via_disk_folder:135]
470 got embed update of distribution setuptools from /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/embed/3/setuptools.json [DEBUG via_disk_folder:135]
470 got embed update of distribution pip from /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/embed/3/pip.json [DEBUG via_disk_folder:135]
473 got embed update of distribution pip from /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/embed/3/pip.json [DEBUG via_disk_folder:135]
473 got embed update of distribution setuptools from /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/embed/3/setuptools.json [DEBUG via_disk_folder:135]
474 got embed update of distribution wheel from /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/embed/3/wheel.json [DEBUG via_disk_folder:135]
474 install pip from wheel /home/yingmanwumen/.local/lib/python3.10/site-packages/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
474 install setuptools from wheel /home/yingmanwumen/.local/lib/python3.10/site-packages/virtualenv/seed/wheels/embed/setuptools-62.1.0-py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
474 install wheel from wheel /home/yingmanwumen/.local/lib/python3.10/site-packages/virtualenv/seed/wheels/embed/wheel-0.37.1-py2.py3-none-any.whl via CopyPipInstall [DEBUG via_app_data:49]
475 Attempting to acquire lock 139837408603792 on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any.lock [DEBUG _api:169]
475 Attempting to acquire lock 139837408607248 on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.4-py3-none-any.lock [DEBUG _api:169]
475 Attempting to acquire lock 139837408607104 on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:169]
475 Lock 139837408603792 acquired on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any.lock [DEBUG _api:173]
475 Lock 139837408607248 acquired on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.4-py3-none-any.lock [DEBUG _api:173]
475 Lock 139837408607104 acquired on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:173]
475 Attempting to release lock 139837408603792 on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any.lock [DEBUG _api:203]
475 Attempting to release lock 139837408607248 on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.4-py3-none-any.lock [DEBUG _api:203]
475 Lock 139837408603792 released on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any.lock [DEBUG _api:206]
475 Attempting to release lock 139837408607104 on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:203]
475 Lock 139837408607248 released on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.4-py3-none-any.lock [DEBUG _api:206]
476 Lock 139837408607104 released on /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any.lock [DEBUG _api:206]
476 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.4-py3-none-any/pip to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/pip [DEBUG _sync:51]
476 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any/setuptools-62.1.0.dist-info to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/setuptools-62.1.0.dist-info [DEBUG _sync:51]
476 copy /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any/wheel-0.37.1.virtualenv to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/wheel-0.37.1.virtualenv [DEBUG _sync:51]
477 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any/wheel-0.37.1.dist-info to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/wheel-0.37.1.dist-info [DEBUG _sync:51]
478 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any/setuptools to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/setuptools [DEBUG _sync:51]
479 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/wheel-0.37.1-py2.py3-none-any/wheel to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/wheel [DEBUG _sync:51]
486 generated console scripts wheel wheel3.10 wheel-3.10 wheel3 [DEBUG base:45]
528 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any/_distutils_hack to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/_distutils_hack [DEBUG _sync:51]
529 copy /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any/distutils-precedence.pth to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/distutils-precedence.pth [DEBUG _sync:51]
529 copy /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any/setuptools-62.1.0.virtualenv to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/setuptools-62.1.0.virtualenv [DEBUG _sync:51]
529 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/setuptools-62.1.0-py3-none-any/pkg_resources to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/pkg_resources [DEBUG _sync:51]
540 generated console scripts [DEBUG base:45]
580 copy /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.4-py3-none-any/pip-22.0.4.virtualenv to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/pip-22.0.4.virtualenv [DEBUG _sync:51]
580 copy directory /home/yingmanwumen/.local/share/virtualenv/wheel/3.10/image/1/CopyPipInstall/pip-22.0.4-py3-none-any/pip-22.0.4.dist-info to /home/yingmanwumen/Desktop/test/venv/local/lib/python3.10/dist-packages/pip-22.0.4.dist-info [DEBUG _sync:51]
586 generated console scripts pip pip3 pip-3.10 pip3.10 [DEBUG base:45]
586 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [INFO session:64]
588 write /home/yingmanwumen/Desktop/test/venv/pyvenv.cfg [DEBUG pyenv_cfg:34]
588 home = /usr [DEBUG pyenv_cfg:38]
588 implementation = CPython [DEBUG pyenv_cfg:38]
588 version_info = 3.10.4.final.0 [DEBUG pyenv_cfg:38]
588 virtualenv = 20.14.1 [DEBUG pyenv_cfg:38]
588 include-system-site-packages = false [DEBUG pyenv_cfg:38]
588 base-prefix = /usr [DEBUG pyenv_cfg:38]
588 base-exec-prefix = /usr [DEBUG pyenv_cfg:38]
588 base-executable = /usr/bin/python [DEBUG pyenv_cfg:38]
588 created virtual environment CPython3.10.4.final.0-64 in 200ms
creator CPython3Posix(dest=/home/yingmanwumen/Desktop/test/venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/yingmanwumen/.local/share/virtualenv)
added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator [WARNING __main__:19]