Skip to content

Creating new virtualenv fails with cryptic error for project with empty name #5794

@mlegner

Description

@mlegner

Issue

When creating a new virtualenv via poetry env use python or poetry add someproject for a project with an empty name, it fails with the following output:

$ poetry env use python
Creating virtualenv -6WcazSRI-py3.8 in /home/markus/.cache/pypoetry/virtualenvs
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
                  [--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
                  [--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip] [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
                  dest
virtualenv: error: argument --prompt: expected one argument

The root of the problem is the virtualenvs.prompt option added in #5606: The standard value there, {project_name}-py{python_version} expands to something like -py3.8 for a project with empty name, which is interpreted as an option in the call to virtualenv instead of the value of --prompt.

I suggest to either add a check for an empty name or add quotes for the call to virtualenv.

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't working as expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions