Custom Virtual Env Name Not used
-
Poetry version:
Poetry (version 1.5.1 - Python version:
- OS version and name: macOS 13.4
- pyproject.toml: pyproject.toml
- [X] I am on the latest stable Poetry version, installed using a recommended method.
- [X] I have searched the issues of this repo and believe that this is not a duplicate.
- [X] I have consulted the FAQ and blog for any relevant entries or release notes.
- [X] If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below.
Issue
I have the following poetry.toml
[virtualenvs]
name = "evenv"
create = true
in-project = true
This is the output of ❯ poetry config --list
cache-dir = "/Users/jainal/Library/Caches/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.name = "evenv"
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/jainal/Library/Caches/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
The is issue is irrespective of this config, poetry still creates the virtualenv with the name .venv . When it should create virtualenv evenv
Also, one weird thing is when I execute this command
poetry config virtualenvs.name evenv --local
I am getting this error
Setting virtualenvs.name does not exist
even if virtualenvs.name = "evenv" is in the config list above
This is a bug in config listing via CLI. There is no option virtualenv.name. It's listed in the output of poetry config --list only because you put it in poetry.toml manually.
So, is there a way to set the name of the virtualenv that poetry creates ?
No. You can manually create your virtualenv, under any name you like, and activate it, poetry will use that virtual environment then.
Oh, I see. What I wanted to ask is, what about the bug in which poetry config --list list all the key value pairs under the
[[virtualenvs]
for example
[virtualenvs]
name = "evenv"
create = true
in-project = true
xyz="a"
then the output of the poetry config --list
❯ poetry config --list
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.name = "evenv"
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/***/Library/Caches/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.xyz = "a"
Does it needs to be fixed or is it some sort of intended behavior ?