Skip to content

Inconsistent poetry detection #25524

Closed
Closed

Description

Discussed in #25522

Originally posted by pdc1 October 12, 2025
Hello,

I have three poetry projects, and two of them get detected and one does not. For the one that does not, the poetry environment gets detected as a venv environment instead. That generally seems to work, but I am nervous that it is not correctly identifying poetry, plus then poetry is not set as the package manager.

If I force it by adding this to my project config, then I get an error about an invalid python interpreter being selected.

    "python-envs.defaultEnvManager": "ms-python.python:poetry",
    "python-envs.defaultPackageManager": "ms-python.python:poetry",

All three poetry environments are in the default "global" location, ~/.cache/pypoetry/virtualenvs/

Are there some steps I can take to see what is going on?

I looked in the output of Python Environments for the project. In particular this part looked promising, but it ends up identified as venv and not poetry:

2025-10-12 16:26:36.667 [info] Discovered manager: (Poetry) /home/paul/.local/bin/poetry
2025-10-12 16:26:36.682 [info] Resolved Python Environment /home/paul/.cache/pypoetry/virtualenvs/convert-audiobooks-jBMuS5Bi-py3.13/bin/python

Here is the full output from a refresh:

2025-10-12 16:26:36.459 [info] Refreshing Poetry Environments
2025-10-12 16:26:36.460 [info] Refreshing poetry environments
2025-10-12 16:26:36.460 [info] getAllExtraSearchPaths completed. Total unique search directories: 0 Paths: []
2025-10-12 16:26:36.478 [info] Discovered manager: (Poetry) /home/paul/.local/bin/poetry
2025-10-12 16:26:36.520 [info] Discovered env: /bin/python3
2025-10-12 16:26:36.523 [info] Discovered env: /usr/bin/python3
2025-10-12 16:26:36.541 [info] [pet] Locator Conda took 60.806657ms
2025-10-12 16:26:36.541 [info] [pet] Locator Homebrew took 84.157µs
2025-10-12 16:26:36.542 [info] [pet] Locator LinuxGlobal took 59.809272ms
2025-10-12 16:26:36.542 [info] [pet] Locator PipEnv took 40.234µs
2025-10-12 16:26:36.542 [info] [pet] Locator Pixi took 25.926µs
2025-10-12 16:26:36.542 [info] [pet] Locator Poetry took 2.194688ms
2025-10-12 16:26:36.542 [info] [pet] Locator PyEnv took 137.422µs
2025-10-12 16:26:36.542 [info] [pet] Locator Venv took 38.97µs
2025-10-12 16:26:36.542 [info] [pet] Locator VirtualEnv took 220.326µs
2025-10-12 16:26:36.543 [info] [pet] Locator VirtualEnvWrapper took 35.704µs
2025-10-12 16:26:36.543 [info] [pet] Locator GlobalVirtualEnvs took 166.525µs
2025-10-12 16:26:36.543 [info] [pet] Locator Locators took 61.34832ms
2025-10-12 16:26:36.543 [info] [pet] Locator Path took 78.985791ms
2025-10-12 16:26:36.543 [info] [pet] Locator Workspaces took 5.979337ms
2025-10-12 16:26:36.544 [info] getAllExtraSearchPaths completed. Total unique search directories: 0 Paths: []
2025-10-12 16:26:36.548 [info] getAllExtraSearchPaths completed. Total unique search directories: 0 Paths: []
2025-10-12 16:26:36.561 [info] [pet] Telemetry:  {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":79,"breakdown":{"GlobalVirtualEnvs":0,"Locators":61,"Path":78,"Workspaces":5},"locators":{"Conda":60,"Homebrew":0,"LinuxGlobal":59,"PipEnv":0,"Pixi":0,"Poetry":2,"PyEnv":0,"Venv":0,"VirtualEnv":0,"VirtualEnvWrapper":0}}}}
2025-10-12 16:26:36.622 [info] Discovered manager: (Poetry) /home/paul/.local/bin/poetry
2025-10-12 16:26:36.623 [info] Discovered env: /bin/python3
2025-10-12 16:26:36.631 [info] Discovered env: /usr/bin/python3
2025-10-12 16:26:36.643 [info] Resolved Python Environment /bin/python3
2025-10-12 16:26:36.643 [info] getAllExtraSearchPaths completed. Total unique search directories: 0 Paths: []
2025-10-12 16:26:36.653 [info] [pet] Locator Conda took 85.771511ms
2025-10-12 16:26:36.653 [info] [pet] Locator Homebrew took 454.429µs
2025-10-12 16:26:36.653 [info] [pet] Locator LinuxGlobal took 75.120244ms
2025-10-12 16:26:36.653 [info] [pet] Locator PipEnv took 20.381µs
2025-10-12 16:26:36.653 [info] [pet] Locator Pixi took 59.059µs
2025-10-12 16:26:36.653 [info] [pet] Locator Poetry took 5.472775ms
2025-10-12 16:26:36.654 [info] [pet] Locator PyEnv took 226.417µs
2025-10-12 16:26:36.654 [info] [pet] Locator Venv took 35.027µs
2025-10-12 16:26:36.654 [info] [pet] Locator VirtualEnv took 518.368µs
2025-10-12 16:26:36.654 [info] [pet] Locator VirtualEnvWrapper took 45.909µs
2025-10-12 16:26:36.654 [info] [pet] Locator GlobalVirtualEnvs took 59.984µs
2025-10-12 16:26:36.654 [info] [pet] Locator Locators took 86.074928ms
2025-10-12 16:26:36.654 [info] [pet] Locator Path took 98.002233ms
2025-10-12 16:26:36.654 [info] [pet] Locator Workspaces took 5.813064ms
2025-10-12 16:26:36.655 [info] getAllExtraSearchPaths completed. Total unique search directories: 0 Paths: []
2025-10-12 16:26:36.656 [info] getAllExtraSearchPaths completed. Total unique search directories: 0 Paths: []
2025-10-12 16:26:36.657 [info] [pet] Telemetry:  {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":98,"breakdown":{"GlobalVirtualEnvs":0,"Locators":86,"Path":98,"Workspaces":5},"locators":{"Conda":85,"Homebrew":0,"LinuxGlobal":75,"PipEnv":0,"Pixi":0,"Poetry":5,"PyEnv":0,"Venv":0,"VirtualEnv":0,"VirtualEnvWrapper":0}}}}
2025-10-12 16:26:36.663 [info] Resolved Python Environment /bin/python3
2025-10-12 16:26:36.664 [info] getAllExtraSearchPaths completed. Total unique search directories: 0 Paths: []
2025-10-12 16:26:36.667 [info] Discovered manager: (Poetry) /home/paul/.local/bin/poetry
2025-10-12 16:26:36.682 [info] Resolved Python Environment /home/paul/.cache/pypoetry/virtualenvs/convert-audiobooks-jBMuS5Bi-py3.13/bin/python
2025-10-12 16:26:36.767 [info] Discovered env: /usr/bin/python3
2025-10-12 16:26:36.768 [info] Discovered env: /bin/python3
2025-10-12 16:26:36.771 [info] Resolved Python Environment /bin/python3
2025-10-12 16:26:36.785 [info] [pet] Locator Conda took 109.04552ms
2025-10-12 16:26:36.785 [info] [pet] Locator Homebrew took 316.101µs
2025-10-12 16:26:36.785 [info] [pet] Locator LinuxGlobal took 109.424151ms
2025-10-12 16:26:36.785 [info] [pet] Locator PipEnv took 68.454µs
2025-10-12 16:26:36.785 [info] [pet] Locator Pixi took 122.523µs
2025-10-12 16:26:36.785 [info] [pet] Locator Poetry took 7.785668ms
2025-10-12 16:26:36.785 [info] [pet] Locator PyEnv took 592.519µs
2025-10-12 16:26:36.785 [info] [pet] Locator Venv took 38.123µs
2025-10-12 16:26:36.785 [info] [pet] Locator VirtualEnv took 38.562µs
2025-10-12 16:26:36.785 [info] [pet] Locator VirtualEnvWrapper took 38.101µs
2025-10-12 16:26:36.785 [info] [pet] Locator GlobalVirtualEnvs took 675.689µs
2025-10-12 16:26:36.785 [info] [pet] Locator Locators took 110.745725ms
2025-10-12 16:26:36.786 [info] [pet] Locator Path took 125.493353ms
2025-10-12 16:26:36.786 [info] [pet] Locator Workspaces took 20.164531ms
2025-10-12 16:26:36.786 [info] [pet] Telemetry:  {"event":"RefreshPerformance","data":{"refreshPerformance":{"total":125,"breakdown":{"GlobalVirtualEnvs":0,"Locators":110,"Path":125,"Workspaces":20},"locators":{"Conda":109,"Homebrew":0,"LinuxGlobal":109,"PipEnv":0,"Pixi":0,"Poetry":7,"PyEnv":0,"Venv":0,"VirtualEnv":0,"VirtualEnvWrapper":0}}}}
```</div>

Activity

  1. DonJayamanne commented on Oct 13, 2025

    @DonJayamanne
    Author

    Paul Close (@pdc1) Please can you

    • Open the VS Code command palette
    • Select the command Run Python Environment Tool (PET) in terminal...
    • Select the first --verbose option
    • Once the command runs in the terminal, please copy all of the output and paste that into this issue here
  2. added
    info-neededIssue requires more information from poster
    area-environmentsFeatures relating to handling interpreter environments
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Oct 13, 2025
  3. pdc1 commented on Oct 13, 2025

    @pdc1

    Here is the output requested for the project that doesn't work. I can post the output for one of the projects that does work if that would help:

    > "/home/paul/.vscode/extensions/ms-python.vscode-python-envs-1.10.0-linux-x64/python-env-tools/bin/pet" find --verbose
    [2025-10-13T22:25:17Z TRACE pet_core::os_environment] Env PATH: ["/home/paul/.local/bin", "/usr/local/bin", "/usr/bin", "/bin", "/usr/local/games", "/usr/games"]
    [2025-10-13T22:25:17Z TRACE pet::find] Searching for environments in global folders: ["/home/paul/.local/bin", "/usr/local/bin", "/usr/bin", "/bin", "/usr/local/games", "/usr/games", "/etc", "/lib", "/lib/x86_64-linux-gnu", "/lib64", "/sbin", "/usr/include", "/usr/lib", "/usr/lib/x86_64-linux-gnu", "/usr/lib64", "/usr/libexec", "/usr/local", "/usr/local/etc", "/usr/local/lib", "/usr/local/sbin", "/usr/sbin", "/usr/share", "/opt", "/home/paul/.local/bin"]
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: PyEnv
    [2025-10-13T22:25:17Z TRACE pet::find] Searching for environments in workspace folders: ["/home/paul/Projects/AudiobookTools"]
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: Conda
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: Pixi
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: Pixi in 153.059µs
    [2025-10-13T22:25:17Z TRACE pet::find] Searching for environments in global venv folders: []
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: Poetry
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: PipEnv
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: PipEnv in 25.361µs
    [2025-10-13T22:25:17Z TRACE pet_poetry] Poetry Manager Some(PoetryManager { executable: "/home/paul/.local/bin/poetry" })
    [2025-10-13T22:25:17Z TRACE pet_poetry::pyproject_toml] Finding poetry file in "/home/paul/Projects/AudiobookTools"
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: VirtualEnvWrapper
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: VirtualEnvWrapper in 251.065µs
    [2025-10-13T22:25:17Z TRACE pet_poetry::pyproject_toml] Parsing poetry file: "/home/paul/Projects/AudiobookTools/pyproject.toml"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv versions directory not found
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: PyEnv in 1.26625ms
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: Venv
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: Venv in 40.958µs
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/.mambarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/.mambarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.config/conda/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/mambarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.conda/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.mambarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.config/conda/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/mambarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.config/conda/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.conda/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/mambarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/.mambarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/home/paul/.conda/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/condarc.d")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/.condarc")
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] Conda environments in known paths ["/bin", "/etc", "/home/paul/.local/bin", "/lib", "/lib/x86_64-linux-gnu", "/lib64", "/opt", "/sbin", "/usr/bin", "/usr/games", "/usr/include", "/usr/lib", "/usr/lib/x86_64-linux-gnu", "/usr/lib64", "/usr/libexec", "/usr/local", "/usr/local/bin", "/usr/local/etc", "/usr/local/games", "/usr/local/lib", "/usr/local/sbin", "/usr/sbin", "/usr/share"]
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: VirtualEnv
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: VirtualEnv in 17.749µs
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: Homebrew
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] No Conda environments in .condarc []
    [2025-10-13T22:25:17Z TRACE pet::find] Searching using locator: LinuxGlobal
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: Homebrew in 306.91µs
    [2025-10-13T22:25:17Z TRACE pet_python_utils::executable] Ignoring folder: "/home/paul/Projects/AudiobookTools/.git"
    [2025-10-13T22:25:17Z TRACE pet_poetry::pyproject_toml] Poetry project name not found in "/home/paul/Projects/AudiobookTools/pyproject.toml", trying the new format
    [2025-10-13T22:25:17Z TRACE pet_poetry::pyproject_toml] Poetry project: "/home/paul/Projects/AudiobookTools/pyproject.toml" with name "convert_audiobooks"
    [2025-10-13T22:25:17Z TRACE pet_poetry::config] Parsing Poetry config file => "/home/paul/.config/pypoetry/config.toml"
    [2025-10-13T22:25:17Z TRACE pet_poetry::config] Poetry config file for "/home/paul/.config/pypoetry/config.toml" is Some(ConfigToml { virtualenvs_in_project: None, cache_dir: None, virtualenvs_path: None })
    [2025-10-13T22:25:17Z TRACE pet_poetry::config] Poetry cache (default): Some("/home/paul/.cache/pypoetry")
    [2025-10-13T22:25:17Z TRACE pet_python_utils::executable] Ignoring folder: "/home/paul/Projects/AudiobookTools/.pytest_cache"
    [2025-10-13T22:25:17Z TRACE pet_poetry::config] Poetry config file => Some("/home/paul/.config/pypoetry/config.toml"), virtualenv.path => "/home/paul/.cache/pypoetry/virtualenvs", cache_dir => Some("/home/paul/.cache/pypoetry"), virtualenvs_in_project => None
    [2025-10-13T22:25:17Z TRACE pet_python_utils::executable] Ignoring folder: "/home/paul/Projects/AudiobookTools/.vscode"
    [2025-10-13T22:25:17Z TRACE pet_poetry::environment_locations] Found pyproject.toml (convert_audiobooks-jBMuS5Bi-py): "convert_audiobooks" in "/home/paul/Projects/AudiobookTools"
    [2025-10-13T22:25:17Z TRACE pet_poetry::environment_locations] Poetry Project ("/home/paul/Projects/AudiobookTools") config file => None
    [2025-10-13T22:25:17Z TRACE pet_poetry::environment_locations] Poetry virtualenvs_in_project from global config file: false
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: Poetry in 3.475067ms
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executing Python: /bin/python3 -c import json, sys; print('093385e9-59f7-4a16-a604-14bf206256fe');print(json.dumps({'version': '.'.join(str(n) for n in sys.version_info), 'sys_prefix': sys.prefix, 'executable': sys.executable, 'is64_bit': sys.maxsize > 2**32}))
    [2025-10-13T22:25:17Z TRACE pet::locators] Identifying Python environment using locators: "/bin/python3"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet::locators] Failed to identify Python environment using locators, now trying to resolve: "/bin/python3"
    [2025-10-13T22:25:17Z TRACE pet::locators] Identifying Python environment using locators: "/usr/bin/python3"
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executing Python: /usr/bin/python3 -c import json, sys; print('093385e9-59f7-4a16-a604-14bf206256fe');print(json.dumps({'version': '.'.join(str(n) for n in sys.version_info), 'sys_prefix': sys.prefix, 'executable': sys.executable, 'is64_bit': sys.maxsize > 2**32}))
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet::locators] Failed to identify Python environment using locators, now trying to resolve: "/usr/bin/python3"
    [2025-10-13T22:25:17Z TRACE pet_conda::environment_locations] Time taken to get conda environment paths: 40.318154ms
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: Conda in 40.447389ms
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executed Python "/usr/bin/python3" in Ok(24.08591ms) & produced an output "093385e9-59f7-4a16-a604-14bf206256fe\n{\"version\": \"3.13.5.final.0\", \"sys_prefix\": \"/usr\", \"executable\": \"/usr/bin/python3\", \"is64_bit\": true}"
    [2025-10-13T22:25:17Z TRACE pet_python_utils::cache] Caching interpreter info for "/usr/bin/python3"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executed Python "/bin/python3" in Ok(28.749083ms) & produced an output "093385e9-59f7-4a16-a604-14bf206256fe\n{\"version\": \"3.13.5.final.0\", \"sys_prefix\": \"/usr\", \"executable\": \"/bin/python3\", \"is64_bit\": true}"
    [2025-10-13T22:25:17Z TRACE pet_python_utils::cache] Caching interpreter info for "/bin/python3"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet::find] Completed searching using locator: LinuxGlobal in 75.691331ms
    [2025-10-13T22:25:17Z TRACE pet::locators] Env ("/usr/bin/python3") in Path resolved as Some(LinuxGlobal)
    [2025-10-13T22:25:17Z TRACE pet::locators] Identifying Python environment using locators: "/usr/bin/python3.13"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet::locators] Failed to identify Python environment using locators, now trying to resolve: "/usr/bin/python3.13"
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executing Python: /usr/bin/python3.13 -c import json, sys; print('093385e9-59f7-4a16-a604-14bf206256fe');print(json.dumps({'version': '.'.join(str(n) for n in sys.version_info), 'sys_prefix': sys.prefix, 'executable': sys.executable, 'is64_bit': sys.maxsize > 2**32}))
    [2025-10-13T22:25:17Z TRACE pet::locators] Env ("/bin/python3") in Path resolved as Some(LinuxGlobal)
    [2025-10-13T22:25:17Z TRACE pet::locators] Identifying Python environment using locators: "/bin/python3.13"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet::locators] Failed to identify Python environment using locators, now trying to resolve: "/bin/python3.13"
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executing Python: /bin/python3.13 -c import json, sys; print('093385e9-59f7-4a16-a604-14bf206256fe');print(json.dumps({'version': '.'.join(str(n) for n in sys.version_info), 'sys_prefix': sys.prefix, 'executable': sys.executable, 'is64_bit': sys.maxsize > 2**32}))
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executed Python "/usr/bin/python3.13" in Ok(23.136519ms) & produced an output "093385e9-59f7-4a16-a604-14bf206256fe\n{\"version\": \"3.13.5.final.0\", \"sys_prefix\": \"/usr\", \"executable\": \"/usr/bin/python3.13\", \"is64_bit\": true}"
    [2025-10-13T22:25:17Z TRACE pet_python_utils::cache] Caching interpreter info for "/usr/bin/python3.13"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet_python_utils::env] Executed Python "/bin/python3.13" in Ok(23.91565ms) & produced an output "093385e9-59f7-4a16-a604-14bf206256fe\n{\"version\": \"3.13.5.final.0\", \"sys_prefix\": \"/usr\", \"executable\": \"/bin/python3.13\", \"is64_bit\": true}"
    [2025-10-13T22:25:17Z TRACE pet_python_utils::cache] Caching interpreter info for "/bin/python3.13"
    [2025-10-13T22:25:17Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
    [2025-10-13T22:25:17Z TRACE pet::locators] Env ("/bin/python3.13") in Path resolved as Some(LinuxGlobal)
    [2025-10-13T22:25:17Z TRACE pet::locators] Env ("/usr/bin/python3.13") in Path resolved as Some(LinuxGlobal)
    
    Breakdown by each locator:
    --------------------------
    Conda                : 40.45083ms
    Homebrew             : 339.627µs
    LinuxGlobal          : 75.725346ms
    PipEnv               : 36.475µs
    Pixi                 : 186.978µs
    Poetry               : 3.48009ms
    PyEnv                : 1.272574ms
    Venv                 : 52.488µs
    VirtualEnv           : 28.961µs
    VirtualEnvWrapper    : 259.526µs
    
    Breakdown for finding Environments:
    -----------------------------------
    GlobalVirtualEnvs    : 545.513µs
    Locators             : 78.103237ms
    Path                 : 116.817161ms
    Workspaces           : 5.130746ms
    
    Managers:
    ---------
    Poetry               : 1
    
    Environments (2):
    ------------------
    LinuxGlobal          : 2
    
    Completed in 118ms
    
  4. pdc1 commented on Oct 14, 2025

    @pdc1

    FYI, I compared the output with one of the projects that works, and the output is generally the same--I don't see any differences that would explain why one project env is identified as "poetry" and one is identified as a more general "venv".

    It does appear the poetry environment was found, given this line in the trace:
    pet_poetry::environment_locations] Found pyproject.toml (convert_audiobooks-jBMuS5Bi-py): "convert_audiobooks" in "/home/paul/Projects/AudiobookTools". The full directory name is convert-audiobooks-jBMuS5Bi-py3.13/ but that's also true for the other projects where poetry was detected.

    Oh wait, I just noticed a subtle difference: the project name has an underscore (convert_audiobooks) and the environment has a hyphen (convert-audiobooks). The other projects where this works have a hyphen in the pyproject.toml project name.

    A minor observation: if you create a poetry environment using poetry new temp_temp, it creates the directory as given, with an underscore, the resulting pyproject.toml has name = "temp-temp", with a hyphen.

    And sure enough, when I change my pyproject.toml project name to use a hyphen instead of underscore, the environment is detected as a poetry environment!

    However, per the Python packaging user guide, underscores are valid in project names:

    The project name must consist of ASCII letters, digits, underscores “_”, hyphens “-” and periods “.”. It must not start or end with an underscore, hyphen or period.

    Given that underscores are valid, but poetry converts underscores to hyphens in the resulting environment directory, I suggest it would be nice if the environment detection could incorporate the fact that poetry does this.

    Thanks!

  5. pdc1 commented on Oct 23, 2025

    @pdc1

    I didn't open this issue so I can't rename it, but would now suggest something like "Poetry detection doesn't work for project names with underscores".

    Thanks!

  6. pdc1 commented on Oct 30, 2025

    @pdc1

    Eleanor Boyd (@eleanorjboyd) Don Jayamanne (@DonJayamanne) see above for my investigation and suggestion for renaming the issue.

  7. eleanorjboyd commented on Oct 30, 2025

    @eleanorjboyd
    Member

    great discovery! If poetry is the one that doesn't support underscores wondering if it is a problem on their end? Might be something we could ask for upstream then

  8. pdc1 commented on Oct 30, 2025

    @pdc1

    great discovery! If poetry is the one that doesn't support underscores wondering if it is a problem on their end? Might be something we could ask for upstream then

    It's not so much that poetry doesn't support underscores in the project name, but rather that it changes them to hyphens when creating the virtual environment name. It's hard to know if that is intentional or an oversight on their part. It would likely be worth asking for something more clearly defined.

  9. github-actions commented on Nov 30, 2025

    @github-actions

    Hey Don Jayamanne (@DonJayamanne), this issue might need further attention.

    Don Jayamanne (@DonJayamanne), you can help us out by closing this issue if the problem no longer exists, or adding more information.

  10. DonJayamanne commented on Dec 1, 2025

    @DonJayamanne
    Author

    This should be fixed in the latest version.
    microsoft/python-environment-tools#242
    Closing for now, if the problem persists in the lates version please ping here and I'll reopen or feel free to create a new issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsinfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions