I am on Windows 10 Pro 64-bit Anniversary Edition using Python 3.5.2 (Anaconda 4.1.1). I download the latest Oracle 12c Instant Client instantclient-basic-windows.x64-12.1.0.2.0.zip and instantclient-sdk-windows.x64-12.1.0.2.0.zip into C:\instantclient and put C:\instantclient on my PATH. Then I download the installer cx_Oracle-5.2.1-12c.win-amd64-py3.5.exe directly from PyPI.
Now I can start an Anaconda python prompt and type import cx_Oracle and it is successful.
>>> import cx_Oracle
>>>
By when I go into my PyDev installation on Eclipse Neon (4.6), the import cx_Oracle line in my source file still shows an error as an unresolved import.
C:\bin\anaconda3\python.exe) and added it back. I restarted Eclipse, but no luck.import cx_Oracle as an unresolved import.How can I get PyDev to see my cx_Oracle package installation?
Note that there are a lot of supposed answers that do not work for me; I've tried all the suggestions, as indicated above.
You can check if you have the cx_Oracle package installed by running the pip show cx_Oracle command. Copied! The pip show cx_Oracle command will either state that the package is not installed or show a bunch of information about the package, including the location where the package is installed.
Using cx_Oracle requires Oracle Client libraries to be installed. These provide the necessary network connectivity allowing cx_Oracle to access an Oracle Database instance. Oracle Client versions 19, 18, 12 and 11.2 are supported.
cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database API 2.0 specification with a considerable number of additions and a couple of exclusions. cx_Oracle 8.3 was tested with Python versions 3.6 through 3.10.
cx_Oracle is distributed under an open-source license (the BSD license). A detailed description of cx_Oracle changes can be found in the release notes. cx_Oracle has a major new release under a new name and homepage python-oracledb. New projects should install python-oracledb instead of cx_Oracle.
You can try this (after the steps that you already report in your question)
Check if the installation in PyDev is ok (besides showing an error marker for import cx_Oracle)
import cx_Oracle
conn = cx_Oracle.connect('hr/hr@pdborcl')
cur = conn.cursor()
cur.execute('select 13 from dual')
for r in cur.fetchall():
    print(r)
If this works, and prints (13,) the installation is correct. Likely some part of completion could work as well. In addition, Shift+Click on cx_Oracle should report The definition of ... was found at ....
Go to  Windows > Preferences > PyDev > Interpreters > Python Interpreter and on the tab Forced builtins add cx_Oracle
After rebuilding the project, the error markers on the import should go away. (In the little test program I just did a trivial edit and saved.)
For the record:
Eclipse Version: 4.6.0 (Neon)
PyDev Version: 5.2.0
Python: 3.5.2 (from a virtualenv)
                        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