Skip to content

Unable to load pipenv environment on macOS #781

@TylerLeonhardt

Description

@TylerLeonhardt

Testing #776

After following the steps to install pipenv and create an environment in my workspace (which contains only a single python file) I am unable to load the environment in the view:

Image

I don't have exact repro steps, but hopefully my story along with logs will help.

First, I went to install pipenv... it says to check python --version which was not a recognized command. I thought I already had python installed but I guess not, so I went to grab it from python.org as recommended from pipenv.

Oddly to me, after installing python from python.org, python --version still said no command... so instead I decided to install pipenv using the 3 equivalents... python3 and pip3. That seemed to work and I had pipenv installed.

Once I had it installed, I opened my workspace (with only a foo.py file in it) and ran pipenv install pytest:

tyleonha@Tylers-MacBook-Pro python-test % pipenv install pytest                     
Creating a Pipfile for this project...
Pipfile.lock not found, creating...
Locking  dependencies...
Locking  dependencies...
Updated Pipfile.lock (494d5b4f482f0ef471f49afe28f00ec1a2ff75da2ce65060d8cabaeb3da2f100)!
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing pytest...
✔ Installation Succeeded
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing dependencies from Pipfile.lock (a2f100)...
All dependencies are now up-to-date!
Upgrading pytest in  dependencies.
Building requirements...
Resolving dependencies...
✔ Success!
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing dependencies from Pipfile.lock (ff74a9)...
All dependencies are now up-to-date!
Installing dependencies from Pipfile.lock (ff74a9)...

Looks good. But it seems like the environment is not getting picked up as you see in the first screenshot.

I'm not great for diagnosing python problems, so @karthiknadig helped me talk to PET. Here's some debug info that he collected.

PET for all:

"/Users/tyleonha/.vscode-insiders/extensions/ms-python.vscode-python-envs-1.7.12451008-darwin-arm64/python-env-tools/bin/pet" find --verbose
tyleonha@Tylers-MacBook-Pro python-test % "/Users/tyleonha/.vscode-insiders/extensions/ms-python.vscode-python-envs-1.7.12451008-darwin-arm64/python-env-tools/bin/p
et" find --verbose
[2025-09-02T21:11:43Z TRACE pet_core::os_environment] Env PATH: ["/Users/tyleonha/Library/Python/3.13/bin", "/Library/Frameworks/Python.framework/Versions/3.13/bin", "/Library/Frameworks/Python.framework/Versions/3.13/bin", "/opt/homebrew/bin", "/opt/homebrew/sbin", "/usr/local/bin", "/System/Cryptexes/App/usr/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin", "/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin", "/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin", "/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin", "/Users/tyleonha/Library/Python/3.13/bin", "/Library/Frameworks/Python.framework/Versions/3.13/bin", "/Users/tyleonha/.lmstudio/bin", "/Users/tyleonha/.vscode-insiders/extensions/ms-python.debugpy-2025.11.2025072901-darwin-arm64/bundled/scripts/noConfigScripts", "/Users/tyleonha/.lmstudio/bin"]
[2025-09-02T21:11:43Z TRACE pet::find] Searching for environments in workspace folders: ["/Users/tyleonha/Code/Misc/python-test"]
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: PyEnv
[2025-09-02T21:11:43Z TRACE pet::find] Searching for environments in global folders: ["/Users/tyleonha/Library/Python/3.13/bin", "/Library/Frameworks/Python.framework/Versions/3.13/bin", "/Library/Frameworks/Python.framework/Versions/3.13/bin", "/opt/homebrew/bin", "/opt/homebrew/sbin", "/usr/local/bin", "/System/Cryptexes/App/usr/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin", "/Users/tyleonha/Library/Python/3.13/bin", "/Library/Frameworks/Python.framework/Versions/3.13/bin", "/Users/tyleonha/.lmstudio/bin", "/Users/tyleonha/.vscode-insiders/extensions/ms-python.debugpy-2025.11.2025072901-darwin-arm64/bundled/scripts/noConfigScripts", "/Users/tyleonha/.lmstudio/bin", "/etc", "/usr/lib", "/usr/libexec", "/usr/local", "/usr/local/lib", "/usr/share", "/opt"]
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: Conda
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: Poetry
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: Pixi
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: Pixi in 28.833µs
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv versions directory not found
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: PyEnv in 94.208µs
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: PipEnv
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: PipEnv in 252.542µs
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: VirtualEnvWrapper
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: VirtualEnvWrapper in 232.875µs
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: Venv
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: Venv in 336.917µs
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: Homebrew
[2025-09-02T21:11:43Z TRACE pet_poetry::manager] Poetry exe not found
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: MacXCode
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/.mambarc")
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: MacXCode in 287µs
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: MacPythonOrg
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/condarc.d")
[2025-09-02T21:11:43Z TRACE pet_poetry] Poetry Manager None
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.config/conda/condarc.d")
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3"
[2025-09-02T21:11:43Z TRACE pet::find] Searching for environments in global venv folders: ["/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7"]
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: MacCommandLineTools
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet::find] Searching using locator: VirtualEnv
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: VirtualEnv in 591.667µs
[2025-09-02T21:11:43Z TRACE pet_poetry::pyproject_toml] Finding poetry file in "/Users/tyleonha/Code/Misc/python-test"
[2025-09-02T21:11:43Z TRACE pet_poetry::pyproject_toml] Parsing poetry file: "/Users/tyleonha/Code/Misc/python-test/pyproject.toml"
[2025-09-02T21:11:43Z TRACE pet_poetry::config] Poetry cache (default): Some("/Users/tyleonha/Library/Caches/pypoetry")
[2025-09-02T21:11:43Z TRACE pet_poetry::config] Poetry config file => None, virtualenv.path => "/Users/tyleonha/Library/Caches/pypoetry/virtualenvs", cache_dir => Some("/Users/tyleonha/Library/Caches/pypoetry"), virtualenvs_in_project => None
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] Conda environments in known paths ["/Library/Frameworks/Python.framework/Versions/3.13/bin", "/System/Cryptexes/App/usr/bin", "/Users/tyleonha/.lmstudio/bin", "/Users/tyleonha/.vscode-insiders/extensions/ms-python.debugpy-2025.11.2025072901-darwin-arm64/bundled/scripts/noConfigScripts", "/Users/tyleonha/Library/Python/3.13/bin", "/bin", "/etc", "/opt", "/opt/homebrew/bin", "/opt/homebrew/sbin", "/sbin", "/usr/bin", "/usr/lib", "/usr/libexec", "/usr/local", "/usr/local/bin", "/usr/local/lib", "/usr/sbin", "/usr/share"]
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3"
[2025-09-02T21:11:43Z TRACE pet_poetry::environment_locations] pyproject.toml not found in any workspace directory
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: Poetry in 1.047791ms
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.config/conda/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/condarc.d")
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/usr/local/bin/python3"
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/mambarc")
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/usr/local/bin/python3"
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/condarc.d")
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/condarc.d")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/condarc.d")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/.mambarc")
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.mambarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/mambarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/miniconda3/.mambarc")
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/conda/condarc.d")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.config/conda/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/var/lib/conda/condarc.d")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.conda/condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda3/.condarc")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/etc/miniconda/mambarc")
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.conda/condarc.d")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] .condarc not found ("/Users/tyleonha/.conda/.condarc")
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7/bin/python"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] No Conda environments in .condarc []
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7/bin/python3"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/opt/homebrew/bin/python3"
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7/bin/python3.13"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: MacPythonOrg in 3.598458ms
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/usr/local/bin/python3.13"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/usr/local/bin/python3.13"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z 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-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/Library/Frameworks/Python.framework/Versions/3.13/bin/python3.13"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_homebrew::environments] Getting homebrew python info for "/opt/homebrew/bin/python3" => "/opt/homebrew/Cellar/python@3.13/3.13.7/Frameworks/Python.framework/Versions/3.13/bin/python3.13" with version Some("3.13.7")
[2025-09-02T21:11:43Z TRACE pet_conda::environment_locations] Time taken to get conda environment paths: 7.857ms
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: Conda in 7.898541ms
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/usr/bin/python3"
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/opt/homebrew/bin/python3.12"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet::locators] Failed to identify Python environment using locators, now trying to resolve: "/usr/bin/python3"
[2025-09-02T21:11:43Z TRACE pet_homebrew::environments] Getting homebrew python info for "/opt/homebrew/bin/python3.12" => "/opt/homebrew/Cellar/python@3.12/3.12.11/Frameworks/Python.framework/Versions/3.12/bin/python3.12" with version Some("3.12.11")
[2025-09-02T21:11:43Z TRACE pet::locators] Identifying Python environment using locators: "/opt/homebrew/bin/python3.13"
[2025-09-02T21:11:43Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:43Z TRACE pet_homebrew::environments] Getting homebrew python info for "/opt/homebrew/bin/python3.13" => "/opt/homebrew/Cellar/python@3.13/3.13.7/Frameworks/Python.framework/Versions/3.13/bin/python3.13" with version Some("3.13.7")
[2025-09-02T21:11:43Z TRACE pet_homebrew::environments] Getting homebrew python info for "/opt/homebrew/bin/python3.13" => "/opt/homebrew/Cellar/python@3.13/3.13.7/Frameworks/Python.framework/Versions/3.13/bin/python3.13" with version Some("3.13.7")
[2025-09-02T21:11:43Z TRACE pet_homebrew::environments] Getting homebrew python info for "/opt/homebrew/bin/python3.12" => "/opt/homebrew/Cellar/python@3.12/3.12.11/Frameworks/Python.framework/Versions/3.12/bin/python3.12" with version Some("3.12.11")
[2025-09-02T21:11:43Z TRACE pet::find] Completed searching using locator: Homebrew in 24.664542ms
[2025-09-02T21:11:44Z TRACE pet_python_utils::env] Executed Python "/usr/bin/python3" in Ok(227.865ms) & produced an output "093385e9-59f7-4a16-a604-14bf206256fe\n{\"version\": \"3.9.6.final.0\", \"sys_prefix\": \"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9\", \"executable\": \"/Library/Developer/CommandLineTools/usr/bin/python3\", \"is64_bit\": true}"
[2025-09-02T21:11:44Z TRACE pet_python_utils::cache] Caching interpreter info for "/usr/bin/python3"
[2025-09-02T21:11:44Z TRACE pet_pyenv] PyEnv Info PyEnvInfo { exe: None, versions: None, version: None }
[2025-09-02T21:11:44Z TRACE pet::find] Completed searching using locator: MacCommandLineTools in 234.703916ms
[2025-09-02T21:11:44Z TRACE pet::locators] Env ("/usr/bin/python3") in Path resolved as Some(MacCommandLineTools)

Breakdown by each locator:
--------------------------
Conda                : 7.900583ms
Homebrew             : 24.67675ms
MacCommandLineTools  : 234.709875ms
MacPythonOrg         : 3.611875ms
MacXCode             : 295.375µs
PipEnv               : 261.958µs
Pixi                 : 41µs
Poetry               : 1.0515ms
PyEnv                : 96.333µs
Venv                 : 340.792µs
VirtualEnv           : 596.167µs
VirtualEnvWrapper    : 239.917µs

Breakdown for finding Environments:
-----------------------------------
GlobalVirtualEnvs    : 3.527ms
Locators             : 234.983166ms
Path                 : 236.447167ms
Workspaces           : 322.625µs

Environments (5):
------------------
Homebrew             : 2
MacCommandLineTools  : 1
MacPythonOrg         : 1
Venv                 : 1

Completed in 266ms

PET just for /Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7 which is I guess where the virtual environment is:

tyleonha@Tylers-MacBook-Pro python-test % "/Users/tyleonha/.vscode-insiders/extensions/ms-python.vscode-python-envs-1.7.12451008-darwin-arm64/python-env-tools/bin/p
et" resolve "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7"
Environment found for "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7"
Environment (Venv)
   Name        : python-test
   Executable  : /Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7/bin/python
   Version     : 3.13.7.final.0
   Prefix      : /Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7
   Architecture: x64
   Symlinks    : "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7/bin/python"
               : "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7/bin/python3"
               : "/Users/tyleonha/.local/share/virtualenvs/python-test-x96r7VX7/bin/python3.13"

Resolve completed in 101ms

Here's the output channel:

Python Environments.log

Let me know if there's anything else I can collect for you.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions