I have a python script that I built over the last 2 weeks using python3.10. The script did run fine 100s of times until I reinstalled python/modules.
I recently upgraded to Python 3.12. I had to pip install all of the modules again but now for some reason when I try to run my script the psycopg2 module keeps failing with the follow error:
packages\psycopg2\__init__.py", line 51, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.
I am running my script from Visual Studio Code 1.83 in a powershell prompt.
I have tried uninstalling, clearing pip cache and reinstalling.
I have tried suggested psycopg2-binary package.
I tried updating Microsoft Visual C++ update. I tried reinstalling python 312.
I assume this is some weird windows dependency issue. Can anyone please help me troubleshoot? I am happy to provide more information if needed.
I had the same problem, unfortunately could not find any solution other than downgrading python version from 3.12 to 3.11.6, now it is working well.
Should be releasing a fix for version 3.12 on Windows soon. https://github.com/psycopg/psycopg2/issues/1628
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With