mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.89k stars 562 forks source link

ImportError: dynamic module does not define module export function (PyInit_pyodbc) #1061

Closed abulygin closed 1 year ago

abulygin commented 2 years ago

I have python installed as virtual application (App-V) on my virtual machine.

Python: 3.8.1 OS: Windows 10

I have installed pyodbc version 4.0.32 without any errors/issues. When I try to use it in the code as 'import pyodbc' I get the error: ImportError: dynamic module does not define module export function (PyInit_pyodbc).

I can see pyodbc-4.0.32-py3.8-win-amd64.egg folder within my venv Lib folder. I have MS ODBC Drivers 13 and 18 installed on my machine, as well as MS VC++ 2015-2022 distributable. I have also installed MS VS Build tools and tried to install pyodbc from source.

Whatever I do, I get this ImportError: dynamic module does not define module export function (PyInit_pyodbc) error.

I checked print(sys.path) and can see that all pyodbc egg folder is listed and has correct path to venv Lib folder. I have also added paths to Python38 and Python38\Scripts to User Environment variables. I have checked all dlls required to run pyodbc and I can see them all in correct locations.

Can you please help to make pyodbc work on my machine? Is there anything still missing from my configuration?

v-chojas commented 2 years ago

Run dumpbin /exports pyodbc.dll and see if that function is present...

According to the source, it should be: https://github.com/mkleehammer/pyodbc/blob/master/src/pyodbcmodule.cpp#L1225