pyodbc icon indicating copy to clipboard operation
pyodbc copied to clipboard

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

Open abulygin opened this issue 3 years ago • 1 comments

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?

abulygin avatar May 13 '22 11:05 abulygin

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

v-chojas avatar May 13 '22 14:05 v-chojas