You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python version (and distribution if applicable, e.g. Anaconda): micromamba standalone executable, running code in a VSCode Jupyter notebook.
python.analysis.indexing: true
python.analysis.typeCheckingMode: off
Notes:
I alias micromamba to mamba, so anywhere where it says mamba can be replaced with micromamba. I am using the stand-alone executable for micromamba. I've also replaced personal information with XXX where applicable.
Without activating an environment created with micromamba, launch vscode and attempt to connect to a remote postgres instance. The kernel crashes as soon data is queried from the database.
If the environment created with micromamba is activated then VSCode is launched with "code" from the cli, the above problem disappears. It looks like it's not loading the correct environment variables for the venv.
Out of coincidence, I noticed something weird. I installed miniforge alongside the micromamba executable, and all of a sudden the problem stated in above disappears! Everything works even if VSCode is launched without activating the environment beforehand. See list of environment variables. There is some weird mixing of miniforge3 and micromamba env vars which should not happen.
There are no issues whatsoever if the code is ran from native jupyter notebook, jupyter-lab or terminal IPython. VSCode jupyter is the only environment where this happens.
Supporting Info
#1 Micromamba env not activated beforehand - Notice that there is only one conda-related env var available. There are a few env vars and site packages related errors in the jupyter log.
envvars
CONDA_PREFIX=C:\Users\XXX\mamba\envs\sticks
Visual Studio Code (1.95.3, undefined, desktop)
Jupyter Extension Version: 2024.10.0.
Python Extension Version: 2024.20.0.
Pylance Extension Version: 2024.11.3.
Platform: win32 (x64).
Temp Storage folder ~\AppData\Roaming\Code\User\globalStorage\ms-toolsai.jupyter\version-2024.10.0
Workspace folder ~\Desktop\XXX\XXX, Home = c:\Users\XXX
14:55:00.325 [info] Starting Kernel (Python Path: ~\mamba\envs\sticks\python.exe, Conda, 3.12.7) for ~\Desktop\XXX\XXX\notebooks\check_etl.ipynb (disableUI=true)
14:55:00.471 [error] Failed to get activated conda env vars for ~\mamba\envs\sticks\python.exe
in 147ms
14:55:00.472 [error] Unable to determine site packages path for python ~\mamba\envs\sticks\python.exe (Conda)
14:55:00.476 [info] Process Execution: ~\mamba\envs\sticks\python.exe -m pip list
14:55:00.477 [error] Failed to get activated conda env vars for ~\mamba\envs\sticks\python.exe
in 138ms
14:55:00.478 [error] Unable to determine site packages path for python ~\mamba\envs\sticks\python.exe (Conda)
14:55:00.482 [info] Process Execution: ~\mamba\envs\sticks\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
14:55:00.486 [info] Process Execution: ~\mamba\envs\sticks\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\vscode_datascience_helpers\kernel_interrupt_daemon.py --ppid 11500
> cwd: ~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\vscode_datascience_helpers
14:55:00.576 [info] Process Execution: ~\mamba\envs\sticks\python.exe -m ipykernel_launcher --f=c:\Users\~\AppData\Roaming\jupyter\runtime\kernel-v31ea843d7aea50337184f3b64926b0cfadb2be6f3.json
> cwd: ~\Desktop\XXX\XXX\notebooks
14:55:01.541 [info] Kernel successfully started
14:55:01.547 [info] Process Execution: ~\mamba\envs\sticks\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\printJupyterDataDir.py
14:55:04.522 [error] Disposing session as kernel process died ExitCode: 3221225477, Reason:
#2 Micromamba venv activated in cli first then VSCode launched with "code" - Many more env vars available as well as important ones for geospatial work like GDA_DATA and GDAL_DRIVER_PATH. Env vars and site packages related errors are still showing, but the issue is resolved and the data query works with no crashes.
envvars
GDAL_DATA=C:\Users\XXX\mamba\envs\sticks\Library\share\gdal
GDAL_DRIVER_PATH=C:\Users\XXX\mamba\envs\sticks\Library\lib\gdalplugins
MAMBA_EXE=C:\Users\XXX\.local\bin\mamba.exe
MAMBA_ROOT_PREFIX=C:\Users\XXX\mamba
CONDA_DEFAULT_ENV=sticks
CONDA_PREFIX=C:\Users\XXX\mamba\envs\sticks
CONDA_PROMPT_MODIFIER=(sticks)
CONDA_SHLVL=1
__CONDA_OPENSSL_CERT_DIR_SET=1
__CONDA_OPENSSL_CERT_FILE_SET=1
jupyter extension log
Visual Studio Code (1.95.3, undefined, desktop)
Jupyter Extension Version: 2024.10.0.
Python Extension Version: 2024.20.0.
Pylance Extension Version: 2024.11.3.
Platform: win32 (x64).
Temp Storage folder ~\AppData\Roaming\Code\User\globalStorage\ms-toolsai.jupyter\version-2024.10.0
Workspace folder ~\Desktop\XXX\XXX, Home = c:\Users\XXX
14:20:20.034 [info] Starting Kernel (Python Path: ~\mamba\envs\sticks\python.exe, Conda, 3.12.7) for ~\Desktop\XXX\XXX\notebooks\check_etl.ipynb (disableUI=true)
14:20:20.177 [error] Failed to get activated conda env vars for ~\mamba\envs\sticks\python.exe
in 143ms
14:20:20.178 [error] Unable to determine site packages path for python ~\mamba\envs\sticks\python.exe (Conda)
14:20:20.182 [info] Process Execution: ~\mamba\envs\sticks\python.exe -m pip list
14:20:20.184 [error] Failed to get activated conda env vars for ~\mamba\envs\sticks\python.exe
in 137ms
14:20:20.185 [error] Unable to determine site packages path for python ~\mamba\envs\sticks\python.exe (Conda)
14:20:20.189 [info] Process Execution: ~\mamba\envs\sticks\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
14:20:20.193 [info] Process Execution: ~\mamba\envs\sticks\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\vscode_datascience_helpers\kernel_interrupt_daemon.py --ppid 7176
> cwd: ~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\vscode_datascience_helpers
14:20:20.287 [info] Process Execution: ~\mamba\envs\sticks\python.exe -m ipykernel_launcher --f=c:\Users\~\AppData\Roaming\jupyter\runtime\kernel-v37ef62efeacb8a2cb6d1542d0881d6886eee8d6f3.json
> cwd: ~\Desktop\XXX\XXX\notebooks
14:20:21.234 [info] Kernel successfully started
14:20:21.239 [info] Process Execution: ~\mamba\envs\sticks\python.exe c:\Users\~\.vscode\extensions\ms-toolsai.jupyter-2024.10.0-win32-x64\pythonFiles\printJupyterDataDir.py
#3 Micromamba env not activated beforehand - but now miniforge3 is also installed on the same pc. - There seems to be a mix of miniforge and mamba env vars. Env vars and site packages related errors are gone for some reason.
Environment data
Notes:
I alias micromamba to mamba, so anywhere where it says mamba can be replaced with micromamba. I am using the stand-alone executable for micromamba. I've also replaced personal information with XXX where applicable.
Code Snippet
Repro Steps
Supporting Info
#1 Micromamba env not activated beforehand - Notice that there is only one conda-related env var available. There are a few env vars and site packages related errors in the jupyter log.
#2 Micromamba venv activated in cli first then VSCode launched with "code" - Many more env vars available as well as important ones for geospatial work like GDA_DATA and GDAL_DRIVER_PATH. Env vars and site packages related errors are still showing, but the issue is resolved and the data query works with no crashes.
#3 Micromamba env not activated beforehand - but now miniforge3 is also installed on the same pc. - There seems to be a mix of miniforge and mamba env vars. Env vars and site packages related errors are gone for some reason.
The text was updated successfully, but these errors were encountered: