sql_knievel
sql_knievel

Reputation: 1401

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

I compiled python3.8 on a half dozen servers (SUSE Linux) and it is working fine on most of them.

But on one, it throws this weird error when I try to install and use the cx_Oracle library.

I set up a virtual environment, and pip install cx_Oracle (version 8.0.0). The installation works fine, but then when I try to import cx_Oracle, it throws an error:

[GCC 4.8.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_cx_Oracle)
>>>

Not sure what to look for here. Any thoughts on what the problem might be, or how to trace this out?

Upvotes: 1

Views: 9059

Answers (1)

sql_knievel
sql_knievel

Reputation: 1401

Fixed! It turned out there was a PYTHONPATH environment variable active that was pointing to the old Python 2.7 folders, even though I was in a Python 3.8 virtual environment. After deleting that environment variable, it started working.

More info with how we diagnosed it here: https://github.com/oracle/python-cx_Oracle/issues/464

Upvotes: 4

Related Questions