ImportError: DLL load failed while importing _psycopg: The specified module could not be found (Postgres17 and create_engine) #1206
-
First Check
Commit to Help
Example Code$ c:/Users/myuser/Home/Development/venv2/Scripts/python.exe c:/Users/myuser/Home/Development/app/main.py
Traceback (most recent call last):
File "c:\Users\myuser\Home\Development\app\main.py", line 30, in <module>
engine=create_engine(DATABASE_URL)
File "<string>", line 2, in create_engine
File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\sqlalchemy\util\deprecations.py", line 281, in warned
return fn(*args, **kwargs) # type: ignore[no-any-return]
File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\sqlalchemy\engine\create.py", line 599, in create_engine
dbapi = dbapi_meth(**dbapi_args)
File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\sqlalchemy\dialects\postgresql\psycopg2.py", line 690, in import_dbapi
import psycopg2
File "C:\Users\myuser\Home\Development\venv2\Lib\site-packages\psycopg2\__init__.py", line 51, in <module>
from psycopg2._psycopg import ( # noqa
...<10 lines>...
)
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.
(venv2) DescriptionError when calling create_engine. Seems like it relys on psycopg2 which currently has an issue open for Python 13 support on Windows. I am having a lot of issues with this. Using Python 13 on windows 10. Operating SystemWindows Operating System DetailsWindows 10 SQLModel VersionPostgres 17 Python Version3.13.0 Additional ContextI installed the C compiled from visual studio. Tried uninstalling and reinstalling countless times. Set up different instances of postgress. Psycopg2 seems to be the ultimate problem here and I am not sure what to do. Anyone know how to fix this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Read more: https://docs.sqlalchemy.org/en/20/core/engines.html |
Beta Was this translation helpful? Give feedback.
create_engine
loads different modules depending on what database URL you specify.Read more: https://docs.sqlalchemy.org/en/20/core/engines.html