I am having issiues installing cx_oracle. I have installed oracle instantclient and cx_oracle oracle packages ones installed i am getting this error while importing cx_oracle. i am running ubuntu 11.10 as host.
import cx_Oracle
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: /usr/lib/python2.7/dist-packages/cx_Oracle.so: undefined symbol:PyUnicodeUCS2_AsEncodedString
any one have any idea how to resolve this issue
cheers
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.
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.
Your applications can also use Oracle's document storage SODA calls. The cx_Oracle API conforms to the Python Database API v2. 0 Specification with a considerable number of additions and a couple of exclusions.
Most probably your Python install uses another unicode format (ucs4) and cx_oracle was compiled with ucs2.
You can install cx_Oracle 5.0.4 with the unicode flag. That worked for me but there is some bug: strange Oracle error: "invalid format text"
Or compile the latest cx_oracle yourself. http://mrpolo.com.ve/?p=178 (its some language i don't know but it helped)
I addition to @froZieglers answer. When I came along the cx_Oracle
page there was no "...Unicode..."-Variant to download anymore. Luckily compiling it myself from source was not a big a hassle then I expected.
Here a summary about what I did (Ubuntu 12.04 LTS, 64bit):
/u01/...
, I had to adjust .profile
too, of course.ln -s
command on the so-lib on Oracle, as said in BUILD
text filesudo aptitude install python-dev
python setup.py build
sudo python setup.by install
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
setup.py
with setting userOracleHome = "/u01/app/oracle/product/11.2.0/xe"
after os.getenv("ORACLE_HOME")
sudo python setup.by install
then workedpython -c 'import cx_Oracle'
succeeded.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