Skip to content

venv.create() fails when sys._base_executable is empty #96861

@meeuw

Description

@meeuw

Bug report

venv.create() fails when sys._base_executable is empty.

This happens when Python cannot determine the base_executable when it's started without a full path and PATH is empty:

$ env -i python
Python 3.10.6 (main, Aug  2 2022, 00:00:00) [GCC 12.1.1 20220507 (Red Hat 12.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys ; print(sys._base_executable)

>>> 
$ env -i python -mvenv /tmp/dmtest
Unable to symlink '' to '/tmp/dmtest/bin/meeuw'
Error: [Errno 2] No such file or directory: ''

Your environment

  • CPython versions tested on: 3.10.6
  • Operating system and architecture: linux / x86_64

Would it be possible to raise an exception when sys._base_executable is empty with a sane error message?

Related to: python-poetry/install.python-poetry.org#43

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions