Closed maresb closed 4 months ago
Exactly the same problem. I have as well problems with the debugger which requires at least version 3.7 . Have problems calling figures from matplotlib from the debugger.
I switched to the pre release version of Python Debugger and the Python version seems to be the correct again. Problems with the debugger persist though
Same issue here. The conda base environment shows as Python 3.1. Both conda and VS 2022 are up to date. Conda.exe and the scripts folder are set in the options. The Python version in the conda base is 3.12.
![2024-06-23 (14)](https://github.com/microsoft/vscode-python/assets/45890502/2e2db64f-cd35-4625-94a9-4ac34f4ef378) ![2024-06-23 (15)](https://github.com/microsoft/vscode-python/assets/45890502/8f4ee37f-1da6-4ed5-848a-4e245d7fc0af) ![2024-06-23 (16)](https://github.com/microsoft/vscode-python/assets/45890502/9feecd3e-e020-4be4-95f0-71385a721329)
Having the same issue, any updates on this?
Please try the pre-release version of the python extension. It has a potential fix for this.
Thanks, it works
Please try the pre-release version of the python extension. It has a potential fix for this.
I had the same issue and fixed it following your advice. What was the cause of error? @karthiknadig
Please try the pre-release version of the python extension. It has a potential fix for this.
Sorry for the dumb question, but what does this mean exactly? Is it within the VsCode settings, or update the virtual env?
@lalvarezpoli:
See the "Switch to pre-release version" button
I think this is caused because conda creates a symlink called python3.1 pointing to python3.10, python3.11 or python3.12 (whichever version you installed) for Python >=3.10. See: https://github.com/conda/conda/issues/11423#issuecomment-1104253815
Type: Bug
Behaviour
When the Python extension loads, it often detects Python 3.11 as Python 3.1.
As originally reported by @niemiaszek in https://github.com/microsoft/vscode-python/pull/22968#issuecomment-2178915891,
My suspicion is that this has to do with the symlink
python3.1 -> python3.1X
present in Conda environments.Here's what I see:
And here's my Jupyter log output, which doesn't seem particularly informative:
What really tipped me off was the output from the Ruff extension since their logs are very targeted:
EXPAND FOR PYTHON LOG EXCERPTS
I have to be really careful here about leaking sensitive info since these logs include full environment variable dumps. ``` ... 2024-06-20 07:45:12.407 [debug] Probing conda binary: conda 2024-06-20 07:45:12.446 [info] > conda info --json 2024-06-20 07:45:12.524 [debug] No cached env found for /opt/conda/bin/python 2024-06-20 07:45:12.558 [debug] No cached env found for /opt/conda/bin/python 2024-06-20 07:45:12.593 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: "/opt/conda/bin/python" 2024-06-20 07:45:12.602 [debug] No cached env found for /opt/conda/bin/python 2024-06-20 07:45:12.602 [debug] No cached env found for /opt/conda/bin/python 2024-06-20 07:45:12.706 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/opt/conda/bin/python","id":"/opt/conda/bin/python","executable":{"uri":{"$mid":1,"fsPath":"/opt/conda/bin/python","external":"file:///opt/conda/bin/python","path":"/opt/conda/bin/python","scheme":"file"},"bitness":"Unknown","sysPrefix":"/opt/conda"},"environment":{"type":"Conda","name":"base","folderUri":{"$mid":1,"path":"/opt/conda","scheme":"file"}},"version":{"major":3,"minor":11},"tools":["Conda"]},"id":"/opt/conda/bin/python"} 2024-06-20 07:45:12.707 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/opt/conda/bin/python","id":"/opt/conda/bin/python","executable":{"uri":{"$mid":1,"fsPath":"/opt/conda/bin/python","external":"file:///opt/conda/bin/python","path":"/opt/conda/bin/python","scheme":"file"},"bitness":"Unknown","sysPrefix":"/opt/conda"},"environment":{"type":"Conda","name":"base","folderUri":{"$mid":1,"path":"/opt/conda","scheme":"file"}},"version":{"major":3,"minor":11},"tools":["Conda"]},"id":"/opt/conda/bin/python"} 2024-06-20 07:45:12.710 [debug] Extension ms-toolsai.jupyter accessed onDidEnvironmentVariablesChange with args: undefined 2024-06-20 07:45:12.711 [debug] Extension ms-toolsai.jupyter accessed getEnvironmentVariables with args: undefined 2024-06-20 07:45:12.712 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/opt/conda/bin/python","id":"/opt/conda/bin/python","executable":{"uri":{"$mid":1,"fsPath":"/opt/conda/bin/python","external":"file:///opt/conda/bin/python","path":"/opt/conda/bin/python","scheme":"file"},"bitness":"Unknown","sysPrefix":"/opt/conda"},"environment":{"type":"Conda","name":"base","folderUri":{"$mid":1,"path":"/opt/conda","scheme":"file"}},"version":{"major":3,"minor":11},"tools":["Conda"]},"id":"/opt/conda/bin/python"} 2024-06-20 07:45:12.713 [debug] Extension ms-toolsai.jupyter accessed resolveEnvironment with args: {"internal":{"path":"/opt/conda/bin/python","id":"/opt/conda/bin/python","executable":{"uri":{"$mid":1,"fsPath":"/opt/conda/bin/python","external":"file:///opt/conda/bin/python","path":"/opt/conda/bin/python","scheme":"file"},"bitness":"Unknown","sysPrefix":"/opt/conda"},"environment":{"type":"Conda","name":"base","folderUri":{"$mid":1,"path":"/opt/conda","scheme":"file"}},"version":{"major":3,"minor":11},"tools":["Conda"]},"id":"/opt/conda/bin/python"} ... 2024-06-20 07:45:13.689 [debug] Received shell integration sequence for bash 2024-06-20 07:45:13.723 [debug] Found hatch binary hatch 2024-06-20 07:45:13.724 [debug] Finished searching for Hatch envs 2024-06-20 07:45:14.236 [debug] conda info --json: { "GID": 1000, "UID": 1000, "active_prefix": "/opt/conda", "active_prefix_name": "base", "av_data_dir": "/opt/conda/etc/conda", "av_metadata_url_base": null, "channels": [ "https://conda.anaconda.org/conda-forge/linux-64", "https://conda.anaconda.org/conda-forge/noarch" ], "conda_build_version": "not installed", "conda_env_version": "24.5.0", "conda_location": "/opt/conda/lib/python3.11/site-packages/conda", "conda_prefix": "/opt/conda", "conda_shlvl": 1, "conda_version": "24.5.0", "config_files": [ "/home/mambauser/.condarc" ], "default_prefix": "/opt/conda", "env_vars": { "CIO_TEST": "Steps to reproduce:
Diagnostic data
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)``` XXX ```
Extension version: 2024.8.1 VS Code version: Code 1.90.1 (611f9bfce64f25108829dd295f54a6894e87339d, 2024-06-11T21:02:43.666Z) OS version: Linux x64 5.15.0-107-generic Modes: Remote OS version: Linux x64 5.15.0-107-generic
python.languageServer
setting: PylanceUser Settings
``` condaPath: ""
languageServer: "Pylance"
testing
• pytestArgs: ""
• pytestEnabled: true
terminal
• activateEnvironment: false
experiments
• enabled: false
```
Installed Extensions
|Extension Name|Extension Id|Version| |---|---|---| |Docker|ms-azuretools.vscode-docker|1.29.1| |Git History|donjayamanne.githistory|0.6.20| |GitHub Copilot|GitHub.copilot|1.204.0| |GitHub Copilot Chat|GitHub.copilot-chat|0.16.1| |GitLens — Git supercharged|eamodio.gitlens|15.1.0| |hadolint|exiasr.hadolint|1.1.2| |JavaScript Debugger|ms-vscode.js-debug|1.90.0| |Jupyter|ms-toolsai.jupyter|2024.5.0| |Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|0.1.9| |Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|1.0.18| |Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|0.1.6| |Live Share|ms-vsliveshare.vsliveshare|1.0.5932| |markdownlint|DavidAnson.vscode-markdownlint|0.55.0| |Pylance|ms-python.vscode-pylance|2024.6.1| |Python|ms-python.python|2024.8.1| |Python Debugger|ms-python.debugpy|2024.6.0| |Resource Monitor|mutantdino.resourcemonitor|1.0.7| |Ruff|charliermarsh.ruff|2024.28.0| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |Xonsh IDE|jnoortheen.xonsh|0.3.3|System Info
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3708)| |GPU Status|2d_canvas: enabledcanvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|7, 6, 7| |Memory (System)|62.75GB (15.50GB free)| |Process Argv|--log ms-python.python=debug| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|ubuntu| |XDG_CURRENT_DESKTOP|Unity| |XDG_SESSION_DESKTOP|ubuntu| |XDG_SESSION_TYPE|x11| |Item|Value| |---|---| |Remote|Dev Container: projectname| |OS|Linux x64 5.15.0-107-generic| |CPUs|Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3708)| |Memory (System)|62.75GB (15.50GB free)| |VM|0%|