microsoft / python-environment-tools

MIT License
159 stars 15 forks source link

Native finder misses some global/miniconda/venv on new user data dir #43

Open rebornix opened 4 months ago

rebornix commented 4 months ago

Testing microsoft/vscode-python#23482

Tested this against a new use data dir and the native doesn't find .venv, some global python or miniconda.

image image
rebornix commented 4 months ago

In a later attempt in https://github.com/microsoft/vscode-python/issues/23503 , venv was found but the global environment was dropped.

DonJayamanne commented 4 months ago

Note: Venv is not supported. (they are not global)

@rebornix

rebornix commented 4 months ago

This is what I get from running the native finder directly in terminal

Time":1710884776000,"modifiedTime":1711054836647,"company":null,"companyDisplayName":null}}Content-Length: 404
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"jsonrpc":"2.0","method":"pythonEnvironment","params":{"displayName":null,"name":null,"pythonExecutablePath":"/usr/local/bin/python3.12","category":"homebrew","version":null,"envPath":null,"envManager":null,"pythonRunCommand":["/usr/local/bin/python3.12"],"projectPath":null,"arch":null,"symlinks":null,"creationTime":1707250784000,"modifiedTime":1711054650586,"company":null,"companyDisplayName":null}}Content-Length: 178
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"jsonrpc":"2.0","method":"envManager","params":{"executablePath":"/Users/penlv/miniconda3/bin/conda","version":"24.4.0","tool":"conda","company":null,"companyDisplayName":null}}Content-Length: 615
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"jsonrpc":"2.0","method":"pythonEnvironment","params":{"displayName":null,"name":null,"pythonExecutablePath":"/Users/penlv/miniconda3/bin/python","category":"conda","version":"3.12.3","envPath":"/Users/penlv/miniconda3","envManager":{"executablePath":"/Users/penlv/miniconda3/bin/conda","version":"24.4.0","tool":"conda","company":null,"companyDisplayName":null},"pythonRunCommand":["/Users/penlv/miniconda3/bin/conda","run","-p","/Users/penlv/miniconda3","python"],"projectPath":null,"arch":"x64","symlinks":null,"creationTime":1715025359082,"modifiedTime":1716917865512,"company":null,"companyDisplayName":null}}Content-Length: 439
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"jsonrpc":"2.0","method":"pythonEnvironment","params":{"displayName":null,"name":null,"pythonExecutablePath":"/Users/penlv/.pyenv/shims/python","category":"system","version":null,"envPath":"/Users/penlv/.pyenv/shims","envManager":null,"pythonRunCommand":["/Users/penlv/.pyenv/shims/python"],"projectPath":null,"arch":null,"symlinks":null,"creationTime":1675297971643,"modifiedTime":1675297971643,"company":null,"companyDisplayName":null}}Content-Length: 108
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"jsonrpc":"2.0","method":"log","params":{"message":"Native Locator took 106 milliseconds.","level":"info"}}Content-Length: 47
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"jsonrpc":"2.0","method":"exit","params":null}%                                                                                                               

Here is the trace log

2024-05-28 18:26:37.572 [info] Experiment 'All' is active
2024-05-28 18:26:37.572 [info] Default formatter is set to ms-python.autopep8 for workspace /Users/penlv/code/personal/notebooks
2024-05-28 18:26:37.573 [info] Python interpreter path: ~/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:26:37.594 [info] > pyenv which python
2024-05-28 18:26:37.618 [info] cwd: .
2024-05-28 18:26:38.084 [info] > ~/.pyenv/versions/3.10.3/bin/python ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/printEnvVariables.py
2024-05-28 18:26:38.095 [info] shell: zsh
2024-05-28 18:26:38.355 [info] Prepending environment variable PATH in collection with /Users/penlv/.pyenv/versions/3.10.3/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-05-28 18:26:38.356 [info] Send text to terminal: /Users/penlv/.pyenv/versions/3.10.3/bin/python /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/printEnvVariablesToFile.py /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/deactivate/zsh/envVars.txt
2024-05-28 18:27:16.921 [info] Starting Environment refresh
2024-05-28 18:27:16.921 [info] Searching for interpreters in posix paths locator
2024-05-28 18:27:16.924 [info] Searching for pyenv environments
2024-05-28 18:27:16.924 [info] Searching for conda environments
2024-05-28 18:27:16.925 [info] Searching for global virtual environments
2024-05-28 18:27:16.925 [info] Searching for custom virtual environments
2024-05-28 18:27:16.936 [info] > conda info --json
2024-05-28 18:27:16.942 [info] > hatch env show --json
2024-05-28 18:27:16.942 [info] cwd: .
2024-05-28 18:27:16.952 [info] Finished searching for custom virtual envs: 28 milliseconds
2024-05-28 18:27:16.959 [info] Finished searching for global virtual envs: 36 milliseconds
2024-05-28 18:27:16.971 [info] > ~/.conda/bin/conda info --json
2024-05-28 18:27:16.981 [info] > ~/miniconda3/bin/conda info --json
2024-05-28 18:27:16.991 [info] Found: /usr/bin/python3 --> /usr/bin/python3
2024-05-28 18:27:17.015 [info] Finished searching for pyenv environments: 93 milliseconds
2024-05-28 18:27:17.023 [info] Found: /usr/local/bin/python3 --> /usr/local/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/bin/python3.12
2024-05-28 18:27:17.026 [info] Found: /usr/local/bin/python3.10 --> /usr/local/Cellar/python@3.10/3.10.14/Frameworks/Python.framework/Versions/3.10/bin/python3.10
2024-05-28 18:27:17.029 [info] Found: /usr/local/bin/python3.11 --> /usr/local/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/bin/python3.11
2024-05-28 18:27:17.033 [info] Found: /usr/local/bin/python3.12 --> /usr/local/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/bin/python3.12
2024-05-28 18:27:17.035 [info] Found: /usr/local/bin/python3.8 --> /usr/local/Cellar/python@3.8/3.8.19/Frameworks/Python.framework/Versions/3.8/bin/python3.8
2024-05-28 18:27:17.036 [info] Found: /usr/local/bin/python3.9 --> /usr/local/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/bin/python3.9
2024-05-28 18:27:17.062 [info] > /usr/bin/python3 -I ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/interpreterInfo.py
2024-05-28 18:27:17.119 [info] > /usr/local/bin/python3 -I ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/interpreterInfo.py
2024-05-28 18:27:17.219 [info] Finished searching for interpreters in posix paths locator: 300 milliseconds
2024-05-28 18:27:17.519 [info] > /usr/local/bin/python3.10 -I ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/interpreterInfo.py
2024-05-28 18:27:17.798 [info] > /usr/local/bin/python3.11 -I ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/interpreterInfo.py
2024-05-28 18:27:18.117 [info] > /usr/local/bin/python3.8 -I ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/interpreterInfo.py
2024-05-28 18:27:18.419 [info] > /usr/local/bin/python3.9 -I ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/get_output_via_markers.py ~/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/python_files/interpreterInfo.py
2024-05-28 18:27:22.497 [info] Discover tests for workspace name: undefined - uri: /Users/penlv/Library/Application Support/Code - Insiders/User/profiles/-3b9215a/settings.json
2024-05-28 18:27:22.563 [info] Finished searching for conda environments: 5640 milliseconds
2024-05-28 18:27:22.571 [info] Environments refresh paths discovered (event): 5654 milliseconds
2024-05-28 18:27:22.572 [info] Environments refresh paths discovered: 5655 milliseconds
2024-05-28 18:27:30.182 [info] Environments refresh finished (event): 13265 milliseconds
2024-05-28 18:27:30.192 [info] Environment refresh took 13279 milliseconds
2024-05-28 18:32:43.765 [info] Experiment 'All' is active
2024-05-28 18:32:43.831 [info] Default formatter is set to ms-python.autopep8 for workspace /Users/penlv/code/personal/notebooks
2024-05-28 18:32:43.851 [info] Starting Environment refresh
2024-05-28 18:32:43.851 [info] Searching for Python environments using Native Locator
2024-05-28 18:32:43.866 [info] > hatch env show --json
2024-05-28 18:32:43.866 [info] cwd: .
2024-05-28 18:32:43.875 [info] > pyenv which python
2024-05-28 18:32:43.875 [info] cwd: .
2024-05-28 18:32:43.878 [info] Native Python Finder: Starting Native Locator
2024-05-28 18:32:43.929 [info] Native Python Finder: Native Locator took 73 milliseconds.
2024-05-28 18:32:43.930 [info] Native Python Finder exited
2024-05-28 18:32:43.930 [info] Finished searching for Python environments using Native Locator: 88 milliseconds
2024-05-28 18:32:43.936 [info] Environment refresh took 97 milliseconds
2024-05-28 18:32:43.943 [error] [
  'Failed to activate a workspace, Class name = g, completed in 98ms, has a falsy return value, Arg 1: <Uri:/Users/penlv/code/personal/notebooks/work/bugs/test.py>, Arg 2: {"started":1716946363381}, Return Value: undefined',
  [TypeError: Cannot read properties of null (reading 'endsWith')
    at t.isParentPath (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:607705)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545133
    at Array.some (<anonymous>)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545061
    at t.resolveBasicEnv (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545180)
    at async t.PythonEnvsResolver.iterEnvsIterator (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:539404)
    at async g.addEnvsToCacheForQuery (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:531040)]
]
2024-05-28 18:32:43.944 [error] Failure during activation. [TypeError: Cannot read properties of null (reading 'endsWith')
    at t.isParentPath (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:607705)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545133
    at Array.some (<anonymous>)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545061
    at t.resolveBasicEnv (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545180)
    at async t.PythonEnvsResolver.iterEnvsIterator (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:539404)
    at async g.addEnvsToCacheForQuery (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:531040)]
2024-05-28 18:32:43.944 [error] sendStartupTelemetry() failed. [TypeError: Cannot read properties of null (reading 'endsWith')
    at t.isParentPath (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:607705)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545133
    at Array.some (<anonymous>)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545061
    at t.resolveBasicEnv (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545180)
    at async t.PythonEnvsResolver.iterEnvsIterator (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:539404)
    at async g.addEnvsToCacheForQuery (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:531040)]
2024-05-28 18:33:33.864 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2024-05-28 18:33:33.868 [info] > python -c "import sys;print(sys.executable)"
2024-05-28 18:33:33.876 [error] Error: Command failed: python -c "import sys;print(sys.executable)"
/bin/sh: python: command not found

    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:526:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:514:28)
    at Pipe.<anonymous> (node:net:337:12) {
  code: 127,
  killed: false,
  signal: null,
  cmd: 'python -c "import sys;print(sys.executable)"'
}
2024-05-28 18:33:33.879 [info] > /usr/local/bin/pyenv which python
2024-05-28 18:33:33.879 [info] cwd: .
2024-05-28 18:33:34.071 [debug] No cached env found for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:34.076 [debug] Best effort version B for /Users/penlv/.pyenv/versions/3.10.3/bin/python {"major":3,"minor":10,"micro":-1}
2024-05-28 18:33:34.077 [debug] Best effort version C for /Users/penlv/.pyenv/versions/3.10.3/bin/python {"major":-1,"minor":-1,"micro":-1,"release":{"level":"final","serial":-1}}
2024-05-28 18:33:34.077 [debug] Best effort version D for /Users/penlv/.pyenv/versions/3.10.3/bin/python {"major":-1,"minor":-1,"micro":-1,"release":{"level":"final","serial":-1}}
2024-05-28 18:33:34.079 [debug] Environment resolver resolved /Users/penlv/.pyenv/versions/3.10.3/bin/python for {"name":"3.10.3","location":"/Users/penlv/.pyenv/versions/3.10.3","kind":"global-pyenv","executable":{"filename":"/Users/penlv/.pyenv/versions/3.10.3/bin/python","sysPrefix":"/Users/penlv/.pyenv/versions/3.10.3","ctime":1675297965473,"mtime":1675297965473},"display":"Python 3.10.3 ('3.10.3')","version":{"major":3,"minor":10,"micro":3},"arch":1,"distro":{"org":""},"source":[],"id":"/Users/penlv/.pyenv/versions/3.10.3/bin/python","detailedDisplayName":"Python 3.10.3 ('3.10.3': pyenv)"} to {"arch":1,"executable":{"filename":"/Users/penlv/.pyenv/versions/3.10.3/bin/python","ctime":-1,"mtime":-1,"sysPrefix":"/Users/penlv/.pyenv/versions/3.10.3"},"version":{"major":3,"minor":10,"micro":3,"sysVersion":"3.10.3"}}
2024-05-28 18:33:34.080 [debug] Resolved /Users/penlv/.pyenv/versions/3.10.3/bin/python using downstream locator
2024-05-28 18:33:34.080 [debug] Python API env change detected /Users/penlv/.pyenv/versions/3.10.3/bin/python update
2024-05-28 18:33:34.080 [debug] Flushing env to cache /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:34.087 [debug] Found cached env for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:35.716 [error] Autoselection timeout out, this is likely a issue with how consumer called execution factory API. Using default python to execute.
2024-05-28 18:33:35.727 [debug] Found cached env for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:36.803 [debug] Found cached env for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:36.804 [info] Python interpreter path: ~/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:36.804 [debug] Found cached env for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:46.222 [info] Experiment 'All' is active
2024-05-28 18:33:46.227 [debug] Start watching root /Users/penlv/code/personal/notebooks for globs ["python","*/python","*/bin/python"]
2024-05-28 18:33:46.227 [debug] Start watching: /Users/penlv/code/personal/notebooks with pattern python using VSCode API
2024-05-28 18:33:46.227 [debug] Start watching: /Users/penlv/code/personal/notebooks with pattern */python using VSCode API
2024-05-28 18:33:46.227 [debug] Start watching: /Users/penlv/code/personal/notebooks with pattern */bin/python using VSCode API
2024-05-28 18:33:46.278 [info] Default formatter is set to ms-python.autopep8 for workspace /Users/penlv/code/personal/notebooks
2024-05-28 18:33:46.293 [debug] Testing: Setting up watcher for /Users/penlv/code/personal/notebooks
2024-05-28 18:33:46.293 [info] Starting Environment refresh
2024-05-28 18:33:46.294 [info] Searching for Python environments using Native Locator
2024-05-28 18:33:46.300 [debug] Searching for custom workspace envs
2024-05-28 18:33:46.300 [debug] Probing Hatch binary hatch
2024-05-28 18:33:46.309 [debug] Searching for workspace virtual envs in: /Users/penlv/code/personal/notebooks
2024-05-28 18:33:46.310 [debug] Dump environment variables {
    "COMMAND_MODE": "unix2003",
    "HOME": "/Users/penlv",
    "LOGNAME": "penlv",
    "LaunchInstanceID": "FC7467DA-4D89-4D24-B5C7-2E9ACB6BBA4E",
    "MallocNanoZone": "0",
    "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined",
    "SECURITYSESSIONID": "186a3",
    "SHELL": "/bin/zsh",
    "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.mxSymqFfx0/Listeners",
    "TMPDIR": "/var/folders/j7/py1_06vs0y3bbcdpsn0pd66h0000gn/T/",
    "USER": "penlv",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_CODE_CACHE_PATH": "/Users/penlv/Library/Application Support/Code - Insiders/CachedData/c6e45e96a6b0fe94e0dae5b13ab4167d69ec9788",
    "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
    "VSCODE_CWD": "/",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_IPC_HOOK": "/Users/penlv/Library/Application Support/Code - Insiders/1.90-main.sock",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en\",\"osLocale\":\"en\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
    "VSCODE_PID": "681",
    "XPC_FLAGS": "0x0",
    "XPC_SERVICE_NAME": "application.com.microsoft.VSCodeInsiders.1187833423.1187833430",
    "__CFBundleIdentifier": "com.microsoft.VSCodeInsiders",
    "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
    "ELECTRON_RUN_AS_NODE": "1",
    "PATH": "/usr/bin:/bin:/usr/sbin:/sbin"
}
2024-05-28 18:33:46.312 [info] > hatch env show --json
2024-05-28 18:33:46.312 [info] cwd: .
2024-05-28 18:33:46.317 [debug] [Error: spawn hatch ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn hatch',
  path: 'hatch',
  spawnargs: [ 'env', 'show', '--json' ]
}
2024-05-28 18:33:46.317 [debug] Failed to find Hatch binary hatch
2024-05-28 18:33:46.317 [debug] No Hatch binary found
2024-05-28 18:33:46.318 [debug] Finished searching for Hatch envs
2024-05-28 18:33:46.318 [debug] Finished searching for poetry envs
2024-05-28 18:33:46.331 [debug] Dump environment variables {
    "COMMAND_MODE": "unix2003",
    "HOME": "/Users/penlv",
    "LOGNAME": "penlv",
    "LaunchInstanceID": "FC7467DA-4D89-4D24-B5C7-2E9ACB6BBA4E",
    "MallocNanoZone": "0",
    "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined",
    "SECURITYSESSIONID": "186a3",
    "SHELL": "/bin/zsh",
    "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.mxSymqFfx0/Listeners",
    "TMPDIR": "/var/folders/j7/py1_06vs0y3bbcdpsn0pd66h0000gn/T/",
    "USER": "penlv",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_CODE_CACHE_PATH": "/Users/penlv/Library/Application Support/Code - Insiders/CachedData/c6e45e96a6b0fe94e0dae5b13ab4167d69ec9788",
    "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
    "VSCODE_CWD": "/",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_IPC_HOOK": "/Users/penlv/Library/Application Support/Code - Insiders/1.90-main.sock",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en\",\"osLocale\":\"en\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
    "VSCODE_PID": "681",
    "XPC_FLAGS": "0x0",
    "XPC_SERVICE_NAME": "application.com.microsoft.VSCodeInsiders.1187833423.1187833430",
    "__CFBundleIdentifier": "com.microsoft.VSCodeInsiders",
    "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
    "ELECTRON_RUN_AS_NODE": "1",
    "PATH": "/usr/bin:/bin:/usr/sbin:/sbin"
}
2024-05-28 18:33:46.334 [info] > pyenv which python
2024-05-28 18:33:46.334 [info] cwd: .
2024-05-28 18:33:46.336 [info] Native Python Finder: Starting Native Locator
2024-05-28 18:33:46.341 [debug] Native Python Finder: Found environments.txt file "/Users/penlv/.conda/environments.txt"
2024-05-28 18:33:46.345 [debug] [Error: Command failed: pyenv which python
/bin/sh: pyenv: command not found

    at ChildProcess.exithandler (node:child_process:423:12)
    at ChildProcess.emit (node:events:526:35)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:514:28)
    at Pipe.<anonymous> (node:net:337:12)] {
  code: 127,
  killed: false,
  signal: null,
  cmd: 'pyenv which python'
}
2024-05-28 18:33:46.428 [debug] Received shell integration sequence for zsh
2024-05-28 18:33:46.473 [info] Native Python Finder: Native Locator took 82 milliseconds.
2024-05-28 18:33:46.475 [info] Native Python Finder exited
2024-05-28 18:33:46.476 [info] Finished searching for Python environments using Native Locator: 190 milliseconds
2024-05-28 18:33:46.480 [debug] Python API env change detected /Users/penlv/.pyenv/versions/3.8.5/bin/python add
2024-05-28 18:33:46.482 [debug] Python API env change detected /Users/penlv/.pyenv/versions/3.8.5/bin/python update
2024-05-28 18:33:46.484 [debug] Python API env change detected /Users/penlv/.pyenv/versions/3.10.3/bin/python add
2024-05-28 18:33:46.485 [debug] Python API env change detected /Users/penlv/.pyenv/versions/3.10.3/bin/python update
2024-05-28 18:33:46.486 [info] Environment refresh took 201 milliseconds
2024-05-28 18:33:46.494 [error] [
  'Failed to activate a workspace, Class name = g, completed in 201ms, has a falsy return value, Arg 1: <Uri:/Users/penlv/code/personal/notebooks/work/bugs/test.py>, Arg 2: {"started":1716946425971}, Return Value: undefined',
  [TypeError: Cannot read properties of null (reading 'endsWith')
    at t.isParentPath (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:607705)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545133
    at Array.some (<anonymous>)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545061
    at t.resolveBasicEnv (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545180)
    at async t.PythonEnvsResolver.iterEnvsIterator (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:539404)
    at async g.addEnvsToCacheForQuery (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:531040)]
]
2024-05-28 18:33:46.494 [error] Failure during activation. [TypeError: Cannot read properties of null (reading 'endsWith')
    at t.isParentPath (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:607705)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545133
    at Array.some (<anonymous>)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545061
    at t.resolveBasicEnv (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545180)
    at async t.PythonEnvsResolver.iterEnvsIterator (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:539404)
    at async g.addEnvsToCacheForQuery (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:531040)]
2024-05-28 18:33:46.494 [error] sendStartupTelemetry() failed. [TypeError: Cannot read properties of null (reading 'endsWith')
    at t.isParentPath (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:607705)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545133
    at Array.some (<anonymous>)
    at /Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545061
    at t.resolveBasicEnv (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:545180)
    at async t.PythonEnvsResolver.iterEnvsIterator (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:539404)
    at async g.addEnvsToCacheForQuery (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.7.0-dev/out/client/extension.js:2:531040)]
2024-05-28 18:33:46.502 [debug] Finished searching for workspace virtual envs
2024-05-28 18:33:47.833 [info] > /usr/local/bin/pyenv which python
2024-05-28 18:33:47.834 [info] cwd: .
2024-05-28 18:33:48.236 [debug] No cached env found for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:48.275 [debug] Best effort version B for /Users/penlv/.pyenv/versions/3.10.3/bin/python {"major":3,"minor":10,"micro":-1}
2024-05-28 18:33:48.278 [debug] Best effort version C for /Users/penlv/.pyenv/versions/3.10.3/bin/python {"major":-1,"minor":-1,"micro":-1,"release":{"level":"final","serial":-1}}
2024-05-28 18:33:48.279 [debug] Best effort version D for /Users/penlv/.pyenv/versions/3.10.3/bin/python {"major":-1,"minor":-1,"micro":-1,"release":{"level":"final","serial":-1}}
2024-05-28 18:33:48.288 [debug] Environment resolver resolved /Users/penlv/.pyenv/versions/3.10.3/bin/python for {"name":"3.10.3","location":"/Users/penlv/.pyenv/versions/3.10.3","kind":"global-pyenv","executable":{"filename":"/Users/penlv/.pyenv/versions/3.10.3/bin/python","sysPrefix":"/Users/penlv/.pyenv/versions/3.10.3","ctime":1675297965473,"mtime":1675297965473},"display":"Python 3.10.3 ('3.10.3')","version":{"major":3,"minor":10,"micro":3},"arch":1,"distro":{"org":""},"source":[],"id":"/Users/penlv/.pyenv/versions/3.10.3/bin/python","detailedDisplayName":"Python 3.10.3 ('3.10.3': pyenv)"} to {"arch":1,"executable":{"filename":"/Users/penlv/.pyenv/versions/3.10.3/bin/python","ctime":-1,"mtime":-1,"sysPrefix":"/Users/penlv/.pyenv/versions/3.10.3"},"version":{"major":3,"minor":10,"micro":3,"sysVersion":"3.10.3"}}
2024-05-28 18:33:48.288 [debug] Resolved /Users/penlv/.pyenv/versions/3.10.3/bin/python using downstream locator
2024-05-28 18:33:48.289 [debug] Python API env change detected /Users/penlv/.pyenv/versions/3.10.3/bin/python update
2024-05-28 18:33:48.289 [debug] Flushing env to cache /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:48.302 [debug] Found cached env for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:48.302 [info] Python interpreter path: ~/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:48.303 [debug] Found cached env for /Users/penlv/.pyenv/versions/3.10.3/bin/python
2024-05-28 18:33:49.142 [debug] Received shell integration sequence for zsh
DonJayamanne commented 4 months ago

@karthiknadig This doesn't look right. Why are the other locators like pyenv running when we have Native Locator enabled?

arting Environment refresh
2024-05-28 18:27:16.921 [info] Searching for interpreters in posix paths locator
2024-05-28 18:27:16.924 [info] Searching for pyenv environments
2024-05-28 18:27:16.924 [info] Searching for conda environments
2024-05-28 18:27:16.925 [info] Searching for global virtual environments
2024-05-28 18:27:16.925 [info] Searching for custom virtual environments
2024-05-28 18:27:16.936 [info] > conda info --json
2024-05-28 18:27:16.942 [info] > hatch env show --json
2024-05-28 18:27:16.942 [info] cwd: .
2024-05-28 18:27:16.952 [info] Finished searching for custom virtual envs: 28 milliseconds
2024-05-28 18:27:16.959 [info] Finished searching for global virtual envs: 36 milliseconds
2024-05-28 18:27:16.971 [info] > ~/.conda/bin/conda info --json
2024-05-28 18:27:16.981 [info] > ~/miniconda3/bin/conda info --json
2024-05-28 18:27:16.991 [info] Found: /usr/bin/python3 --> /usr/bin/python3
2024-05-28 18:27:17.015 [info] Finished searching for pyenv environments: 93 milliseconds
....
2024-05-28 18:27:22.563 [info] Finished searching for conda environments: 5640 milliseconds
2024-05-28 18:27:22.571 [info] Environments refresh paths discovered (event): 5654 milliseconds
2024-05-28 18:27:22.572 [info] Environments refresh paths discovered: 5655 milliseconds
2024-05-28 18:27:30.182 [info] Environments refresh finished (event): 13265 milliseconds
2024-05-28 18:27:30.192 [info] Environment refresh took 13279 milliseconds
2024-05-28 18:32:43.765 [info] Experiment 'All' is active
2024-05-28 18:32:43.831 [info] Default formatter is set to ms-python.autopep8 for workspace /Users/penlv/code/personal/notebooks
2024-05-28 18:32:43.851 [info] Starting Environment refresh
2024-05-28 18:32:43.851 [info] Searching for Python environments using Native Locator
2024-05-28 18:32:43.866 [info] > hatch env show --json
...
2024-05-28 18:32:43.878 [info] Native Python Finder: Starting Native Locator
2024-05-28 18:32:43.929 [info] Native Python Finder: Native Locator took 73 milliseconds.
2024-05-28 18:32:43.930 [info] Native Python Finder exited
karthiknadig commented 4 months ago

@DonJayamanne That looks like log continuation. typically the first thing in the logs when the extension loads is Experiment 'All' is active. If you re-start extensions, it will continue to use the same logs.

In this case it looks like, the extension was re-started at 18:32

DonJayamanne commented 3 months ago

@rebornix Please can you test this again using the native locator in the latest pre-release of Python extension and very it has been resolved Thanks