Bug report
https://bugs.python.org/issue21197 added a lib64 symlink for compatibility on POSIX systems. venv's behaviour differs from virtualenvs in that virtualenv does a check to see if the filesystem is able to symlink (https://github.com/pypa/virtualenv/blob/b85542c31ca8afcff317e618da434f59fa06d122/src/virtualenv/info.py#L28-L47)
https://bugs.python.org/msg219258
If the filesystem does not support symlinks (i.e. FAT) the exception is unhandled and the process exits - leaving the virtual environment structure unfinished. The issue can be worked around by creating a directory in the symlink's location before invoking venv (
|
if not os.path.exists(link_path): # Issue #21643 |
).
Ideally venv would do a similar check to virtualenv or silently ignore the exception as this is just for POSIX compatibility purposes anyway (and the edge-case is already ignored of the directory existing).
Your environment
root@650ae388ee44:~# python --version
Python 3.10.4
root@650ae388ee44:~# python -m venv venv --copies # Throws an exception on FAT fs, venv unfinished
root@650ae388ee44:~# find venv/ -type l # gah, a symlink
venv/lib64
root@650ae388ee44:~# rm -rf venv/
root@650ae388ee44:~# mkdir -p venv/lib64 # Workaround
root@650ae388ee44:~# python -m venv venv --copies
root@650ae388ee44:~# find venv/ -type l
root@650ae388ee44:~#
Bug report
https://bugs.python.org/issue21197 added a
lib64symlink for compatibility on POSIX systems.venv's behaviour differs fromvirtualenvsin thatvirtualenvdoes a check to see if the filesystem is able to symlink (https://github.com/pypa/virtualenv/blob/b85542c31ca8afcff317e618da434f59fa06d122/src/virtualenv/info.py#L28-L47)https://bugs.python.org/msg219258
If the filesystem does not support symlinks (i.e. FAT) the exception is unhandled and the process exits - leaving the virtual environment structure unfinished. The issue can be worked around by creating a directory in the symlink's location before invoking
venv(cpython/Lib/venv/__init__.py
Line 152 in a508631
Ideally
venvwould do a similar check tovirtualenvor silently ignore the exception as this is just for POSIX compatibility purposes anyway (and the edge-case is already ignored of the directory existing).Your environment