DonJayamanne / vscode-python-manager

Python Environment & Package Manager
MIT License
117 stars 20 forks source link

Improve recognizing global python environments. #29

Open byehack opened 2 years ago

byehack commented 2 years ago

python not working in terminal opened via Open in terminal button. image

there could be 2 options: Add python path to opened terminal environment. Add python path in selecting cwd quick pick list.

Thank you @DonJayamanne for starting improve python environ managing to next level ❤️

DonJayamanne commented 2 years ago

Seems to be a regression, damn it, this used to work.

dzid26 commented 10 months ago

Same for me - 'python' is [not recognized](https://github.com/microsoft/vscode-python/issues/22279#issuecomment-1783444968) in the terminal for global pythons but works for venv and conda.

System python environment is "Unknown" type.

image

Debug log:

Debug: Needed to validate C:\Program Files\Python311\python.exe with latest info
Debug: Resolved C:\Program Files\Python311\python.exe from cache: {"name":"","location":"","kind":"global-other","executable":{"filename":"C:\\Program Files\\Python311\\python.exe","sysPrefix":"C:\\Program Files\\Python311","ctime":1682010237500,"mtime":1680649476000},"display":"Python 3.11.3 64-bit","version":{"major":3,"minor":11,"micro":3,"release":{"level":"final","serial":0},"sysVersion":"3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]"},"arch":3,"distro":{"org":""},"source":[],"id":"C:\\PROGRAM FILES\\PYTHON311\\PYTHON.EXE","detailedDisplayName":"Python 3.11.3 64-bit"}
Debug: Shell path 'C:\Program Files\Python311', base path 'C:\Program Files\Python311'
Debug: Shell path identified as shell 'other'
Debug: Terminal name 'C:\Program Files\Python311' identified as shell 'other'
Debug: [object Object]. Shell identified as other (Terminal name is C:\Program Files\Python311)
Debug: Shell path 'C:\Program Files\PowerShell\7\pwsh.exe', base path 'C:\Program Files\PowerShell\7\pwsh'
Debug: Shell path identified as shell 'powershellCore'
Debug: Terminal shell path 'C:\Program Files\PowerShell\7\pwsh.exe' identified as shell 'powershellCore'
Debug: [object Object]. Shell identified as powershellCore (Terminal name is C:\Program Files\Python311)
Debug: Shell identified as 'powershellCore'
Debug: Found cached env for C:\Program Files\Python311\python.exe
Debug: Resolved C:\Program Files\Python311\python.exe from cache: {"name":"","location":"","kind":"global-other","executable":{"filename":"C:\\Program Files\\Python311\\python.exe","sysPrefix":"C:\\Program Files\\Python311","ctime":1682010237500,"mtime":1680649476000},"display":"Python 3.11.3 64-bit","version":{"major":3,"minor":11,"micro":3,"release":{"level":"final","serial":0},"sysVersion":"3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]"},"arch":3,"distro":{"org":""},"source":[],"id":"C:\\PROGRAM FILES\\PYTHON311\\PYTHON.EXE","detailedDisplayName":"Python 3.11.3 64-bit"}
Error: Env vars file not created command Get-ChildItem env: | Out-File "C:\Users\dzidm\AppData\Local\Temp\tmp-29108U2ik7uPJglXd.txt"

https://github.com/DonJayamanne/vscode-python-manager/blob/521db1a9b455ef4f69514d7eb2467987a78d7465/src/environments/terminal.ts#L226

Get-ChildItem env: only outputs PSModulePath env:

Get-ChildItem env:

Name                           Value
----                           -----
PATH                           C:\Program Files\PowerShell\7;
PATHEXT                        .CPL
PSModulePath                   C:\Users\dzidm\OneDrive\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;…
VSCODE_INJECTION               1