python - cx_Oracle does not recognize location of Oracle software installation for installation on Linux -


i have been able install cx_oracle use python 3.4 on windows 8 laptop, , trying same setup (cx_oracle python 3.4) onto linux machine. when running setup.py file cx_oracle-5.1.3.tar.gz, end error:

    sudo python3 setup.py install     traceback (most recent call last):        file "setup.py", line 135, in <module>           raise distutilssetuperror("cannot locate oracle software " \     distutils.errors.distutilssetuperror: cannot locate oracle software installation 

following other answers looked @ (easy_install cx_oracle (python package) on windows, https://gist.github.com/jarshwah/3863378) have installed these 3 instant client rpms:

rpm -ivh oracle-instantclient12.1-basic-12.1.0.2.0-1.i386.rpm rpm -ivh oracle-instantclient12.1-devel-12.1.0.2.0-1.i386.rpm rpm -ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.i386.rpm 

and set oracle_home folder installed to, supposed python identify location of oracle files can installation properly.

i still same "cannot locate oracle software installation" error each time try run setup.py file.

any idea need able install cx_oracle?

update more info:

echo $oracle_home returns /instantclient_12_1, rpm files installed to.

this contents of /instantclient_12_1 directory:

adrci                  libnnz12.so       libsqlplusic.so  tnsnames.ora basic_readme           libocci.so        libsqlplus.so    tnsnames.ora_andy genezi                 libocci.so.12.1   ojdbc6.jar       uidrvci glogin.sql             libociei.so       ojdbc7.jar       xstreams.jar libclntshcore.so.12.1  libocijdbc12.so   sdk libclntsh.so           libons.so         sqlplus libclntsh.so.12.1      liboramysql12.so  sqlplus_readme 

this bit different directory have windows 8 install - 1 has .dll , .sym files, orasql12.dll. should linux version of instant client install have different files?

update partial solution:

i found solution installed cx_oracle properly, during shell instance:

i set these 2 environment variables:

export oracle_home=/instantclient_12_1 export ld_library_path=$ld_library_path:$oracle_home 

and created symbolic link:

ln -s libclntsh.so.12.1 libclntsh.so 

after that, going cx_oracle folder , doing worked:

python3 setup.py build python3 setup.py install 

for reason, sudo python3 setup.py install did not work this.

update link related question:

my next problem getting environment variables persist outside of shell instance don't have define environment variables each time. environment variables put in profile.d show when echo them, python fails import cx_oracle properly, , have export environment variables again reason. don't know proper procedure posting different question related one, opened new question here:

linux profile.d environment variables don't work cx_oracle in python

please me out this, feel stuck on try make work. environment variables show when echo them, seem functional if export them again before running python code.

updated

as petriborg suggested, setting ld_run_path @ build time include path oracle shared library files in cx_oracle shared library built during installation. obviates need ld_library_path suggested in first answer.


for rpms using, oracle_home should set /usr/lib/oracle/12.1/client. if using pip:

$ export oracle_home=/usr/lib/oracle/12.1/client $ export ld_run_path=/usr/lib/oracle/12.1/client/lib:$ld_run_path $ pip install cx_oracle $ python -c 'import cx_oracle; print(cx_oracle.version)' 5.1.3 

read documentation info on installing , executing applications use client libraries.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -