'Python VSC Visual Studio Code Can't find any of the modules: No module named 'sqlalchemy' No module named 'colorama'
UPDATE
I fully uninstalled anaconda: https://setapp.com/how-to/uninstall-anaconda-on-mac
I reinstalled it, updated it, and I can even see in the list: sqlalchemy
sqlalchemy 1.4.32 py39hca72f7f_0
But I keep on getting: No module named 'sqlalchemy'
So, it's like if Visual Studio Code doesn't have the correct path to the new version of Anaconda or Python.
I just installed:
pip3 install Flask-SQLAlchemy
but nothing changed
ORIGINAL
My terminal was constantly redirected to a specific folder, which was very annoying, so I deleted it.
So, now I'm in the root.
But when I try to import a file in VSCode it can't find any of the modules:
So, following many suggestions, in Visual Studio Code I changed the cwd and tried many things:
Terminal › Integrated: Cwd => Empty, ${fileDirname}, public, ... none work
I tried to reinstall:
Conda install sqlalchemy
conda install psycopg2
It installed it, but if I run:
sqlalchemy --version
I get => -bash: sqlalchemy: command not found
These are the versions at root level:
pip --version => pip 21.2.4
python --version => Python 3.9.7
conda --version => conda 4.12.0
conda list anaconda$ => anaconda 2021.11 py39_0
conda list python -f => python 3.9.7 h88f2d9e_1
conda list => I could publish this if you think it would help ( long list though )
conda info => same thing
Solution 1:[1]
This solved my problem:
Activating Anaconda Environment in VsCode
Basically,
Shift + Cmd + P
Search Select Interpreter
It was suggesting me a " Recommended version 3.9.10 64 bit". So, every time I would select that one.
The solution was to go to Terminal and check which version I had.
> python3 --version
it gave me version 3.9.7. So, I selected that one, which was called "Conda"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | जलजनक |
