The behavior is this:
- for the base conda env, vscode finds all imports
- for a freshly created
my_env
conda environment - with the same pip-installed modules - vscode reports that those modules cannot be found.
The base env was copied as described here. Switching in vscode from base env to my_env broke the imports. Both were reported as using python 3.10.10.
After much looking and reading many stackoverflow entries, I found that the two python3.10 binaries mentioned above report as version 3.10.10, but are not the same (simple diff).
Moving ~/conda/envs/my_env/bin/conda3.10.10
out of the way and linking ~/conda/bin/python3.10.10
to ~/conda/envs/my_env/bin/
, the problem is resolved. I made no other changes - just that one.
The strangest bit is that the verbose versions for the two are the same:
$ ~/conda/bin/python3.10 --version -VV
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0]
~/conda/envs/my_env/bin/python3.10.save --version -VV
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0]
What I can't figure out is why they differ and what causes the imports for my_env to fail.
While the fix works, it's not a viable solution.
Any idea why using the former works and the latter differs? And to whom I should report this?