Hi @Caroline @Franky1, I changed ‘psycopg2’ to ‘psycopg2-binary’ in my requirements.txt and solved the problem. Thanks for your reply :smiley: Answer from Vika on discuss.streamlit.io
🌐
Streamlit
discuss.streamlit.io › community cloud
Import "psycopg2" could not be resolved from source Pylance - Community Cloud - Streamlit
March 7, 2024 - My app works locally, but when I deploy it in github codespace, it will return the following message (*I already add psycopg2 and pingouin in requirement.txt): [{ “resource”: “/workspaces/ppm-automation-test/pages/Hello.py”, “owner”: “generated_diagnostic_collection_name#0”, “code”: { “value”: “reportMissingModuleSource”, “target”: { “$mid”: 1, “path”: “/microsoft/pyright/blob/main/docs/configuration.md”, “scheme”: “https”, “authority”: “github.com”, “fragment”: “reportMissingModuleS...
Discussions

python - ImportError: No module named psycopg2 - Stack Overflow
In installation process of OpenERP 6, I want to generate a config file with these commands: cd /home/openerp/openerp-server/bin/ ./openerp-server.py -s --stop-after-init -c /home/openerp/openerp-s... More on stackoverflow.com
🌐 stackoverflow.com
[Bug] Incorrect reportShadowedImports on Python 3.10 venv and override
Environment data Language Server version: 2023.8.40 OS and version: darwin arm64 Python version (and distribution if applicable, e.g. Anaconda): 3.10.11 (pyenv) python.analysis.indexing: true pytho... More on github.com
🌐 github.com
5
August 25, 2023
Error loading psycopg2 module: No module named 'psycopg2'
Hi all, First of all, I've read all the posts I could find about this problem to no avail :( I've got an up&running default webapp with python3 and django already working with default d... More on github.com
🌐 github.com
9
May 26, 2021
python - Error: No module named psycopg2.extensions - Stack Overflow
I am trying to set up a PostgreSQL database for my django project, which I believe I have done now thanks to the replies to my last question Problems setting up a postgreSQL database for a django p... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

Should I install psycopg2-binary or psycopg?
Use the package and major version supported by the application; psycopg is the modern package while psycopg2-binary can simplify local development.
🌐
pythonpool.com
pythonpool.com › home › error › fix no module named psycopg2: install and environment checks
Fix No Module Named psycopg2: Install and Environment Checks
Why does Python say no module named psycopg2?
The active interpreter cannot find a package that provides the psycopg2 module, often because pip installed into another environment.
🌐
pythonpool.com
pythonpool.com › home › error › fix no module named psycopg2: install and environment checks
Fix No Module Named psycopg2: Install and Environment Checks
Why can source installation fail?
A source build may require PostgreSQL client headers and a compiler, while a compatible wheel avoids those system build dependencies.
🌐
pythonpool.com
pythonpool.com › home › error › fix no module named psycopg2: install and environment checks
Fix No Module Named psycopg2: Install and Environment Checks
🌐
Python Forum
python-forum.io › thread-34556.html
Psycopg2 doesn't work with python2
Recentley i installed psycopg2 2.9 version and tried to connect it with python2.7 but nothing doesn't work ,my VS Code sends me an error:Import "psycopg2" could not be resolved from sourcePylancerepor
🌐
Bobby Hadz
bobbyhadz.com › blog › python-no-module-named-psycopg2
ModuleNotFoundError: No module named 'psycopg2' in Python | bobbyhadz
April 8, 2024 - To solve the error, install the module by running the pip install psycopg2-binary command. Open your terminal in your project's root directory and install the psycopg2-binary module.
🌐
YouTube
youtube.com › watch
python ImportError: No module named psycopg2 - YouTube
python ImportError: No module named psycopg2sudo apt-get install python-psycopg2sudo pip install psycopg2Python Tutorials : https://www.facebook.com/PythonTu...
Published   May 1, 2017
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-modulenotfounderror-no-module-named-psycopg2-in-python
How to Fix 'ModuleNotFoundError: No Module Named psycopg2' in Python - GeeksforGeeks
July 23, 2025 - ... Below, are the approaches to solve “Modulenotfounderror: No Module Named ‘psycopg2′”. We can resolve this error by installing the psycopg2 package externally using the PIP.
Find elsewhere
🌐
Python Pool
pythonpool.com › home › error › fix no module named psycopg2: install and environment checks
Fix No Module Named psycopg2: Install and Environment Checks
December 9, 2021 - Fix the psycopg2 import error by checking the active Python environment, choosing psycopg2 or psycopg, and handling binary wheels and system dependencies correctly.
🌐
GitHub
github.com › microsoft › pylance-release › issues › 4762
[Bug] Incorrect reportShadowedImports on Python 3.10 venv and override · Issue #4762 · microsoft/pylance-release
August 25, 2023 - Environment data Language Server version: 2023.8.40 OS and version: darwin arm64 Python version (and distribution if applicable, e.g. Anaconda): 3.10.11 (pyenv) python.analysis.indexing: true python.analysis.typeCheckingMode: off Code Sn...
Author   microsoft
🌐
MLJAR
mljar.com › modulenotfounderror › no-module-named-psycopg2
No module named psycopg2
Please try the below code cell if you are in Python notebook. If you get no error then you are using conda otherwise please use pip for installing new packages. ... If you are using virtual environment, please make sure that it is activated. For Python notebook users, please use the following command: import sys !{sys.executable} -m pip install psycopg2-binary
🌐
GitHub
github.com › psycopg › psycopg2 › issues › 1282
Error loading psycopg2 module: No module named 'psycopg2' · Issue #1282 · psycopg/psycopg2
May 26, 2021 - 'ENGINE': 'django.db.backends.postgresql_psycopg2', and it failed. Then, from some youtube videos, I tried: ... (env) PS D:\Users\llagos.NB-KEYONE15\Visual Studio projects\ecommerce-psql> python manage.py makemigrations Traceback (most recent call last): File "D:\Users\llagos.NB-KEYONE15\Visual Studio projects\ecommerce-psql\env\lib\site-packages\django\db\backends\postgresql\base.py", line 25, in import psycopg2 as Database ModuleNotFoundError: No module named 'psycopg2' ...
Author   psycopg
🌐
YouTube
youtube.com › programmingknowledge2
How To Fix Import Could Not Be Resolved From Source Pylance - YouTube
Welcome to this tutorial on how to fix "Import could not be resolved from source" Pylance error.Pylance is a powerful language server that provides advanced ...
Published   May 15, 2023
Views   43K
🌐
GitHub
github.com › microsoft › pyright › issues › 143
Import could not be resolved · Issue #143 · microsoft/pyright
June 4, 2019 - vironment '/Users/bfelbo/code/pulse' Attempting to resolve using root path '/Users/bfelbo/code/pulse' Could not find directory '/Users/bfelbo/code/pulse/psycopg2' Did not find file '/Users/bfelbo/code/pulse/psycopg2.pyi' or '/Users/bfelbo/code/pulse/psycopg2.py' Looking for typeshed path Looking for typeshed third_party path Attempting to resolve using root path '/Users/bfelbo/.vscode/extensions/ms-pyright.pyright-1.0.36/typeshed-fallback/third_party/2and3' Could not find directory '/Users/bfelbo/.vscode/extensions/ms-pyright.pyright-1.0.36/typeshed-fallback/third_party/2and3/psycopg2' Did not
Author   microsoft
🌐
Django Forum
forum.djangoproject.com › using django › mystery errors
Psycopg will not work - Mystery Errors
December 24, 2023 - I have tried to uninstall psycopg[binary] and uninstall django. Than I have tried to reinstall using pip install psycopg, pip install psycopg[binary, pip install psycopg2[binary] and of course pip install django · I have checked the psycopg documentation and I am in line with what they ask ...
🌐
GitHub
github.com › spyder-ide › spyder › issues › 21228
Unable to import psycopg2 due to mixing packages from different Python installations · Issue #21228 · spyder-ide/spyder
August 7, 2023 - #if you have installed psycopg2-binary import psycopg2 File ~/Library/Python/3.9/lib/python/site-packages/psycopg2/__init__.py:51 from psycopg2._psycopg import ( # noqa ImportError: dlopen(/Users/my_username/Library/Python/3.9/lib/python/site-packages/psycopg2/_psycopg.cpython-39-darwin.so, 0x0002): tried: '/Users/my_username/Library/Python/3.9/lib/python/site-packages/psycopg2/_psycopg.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/my_username/Library/Python/3.9/lib/python/site-packages/psycop
Author   spyder-ide