5

i try to install python dependencies for django project sdu.edu.kz. This project uses cx-Oracle. When i try:

./install_python_dependencies.sh install

It successfully installs all modules except one. The module of cx-Oracle. However, I installed the cx-Oracle program on my computer.

It prints the error:

Collecting cx-oracle==5.2 (from -r requirements/base.txt (line 82))
  Using cached cx_Oracle-5.2.tar.gz
   Complete output from command python setup.py egg_info:
   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "/tmp/pip-build-RP7c9i/cx-oracle/setup.py", line 170, in <module>
       raise DistutilsSetupError("cannot locate an Oracle software " \
   distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation

   ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip build-RP7c9i/cx-oracle/

How to locate an Oracle software installation? Any ideas? Please, help

4

For Oracle 12.x , cx_Oracle not available yet. So we need to download instant client with 11.x version.

Go to http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html and accept License Agreement.

Then download zip files with names as below

  • instantclient-sdk-linux.x64-11.2.0.4.0.zip
  • instantclient-basic-linux.x64-11.2.0.4.0.zip

And unzip them with unzip command

unzip instantclient-sdk-linux.x64-11.2.0.4.0.zip
unzip instantclient-basic-linux.x64-11.2.0.4.0.zip

Both will be extracted into a common directory named as "instantclient_11_2". Then add this to PATH with below commands.

export ORACLE_HOME=/path-to_this/instantclient_11_2
cd $ORACLE_HOME
ln -s libclntsh.so.11.1   libclntsh.so

Open /etc/profile or .bashrc and following entries.

export ORACLE_HOME=/location/of/your/files/instantclient_11_2
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME

then do source ~/.bashrc or source /etc/profile

And install these packages

sudo apt-get install build-essential unzip python-dev libaio-dev

after that use pip or pip3 according to your Python version and then install it

pip3 install cx_Oracle

and try loading cx_Oracle module in Python interpreter.

Hope this helps.

Credit goes here: https://gist.github.com/kimus/10012910

Note: I have tried this on my Ubuntu 16.04 installation , it should work for you.

| improve this answer | |
  • Raja, thank you. The file .bashrc was the solution of a problem – zshanabek Nov 20 '16 at 16:32
  • No Problem brother. Glad its helped you. I struggled same as you on installing but its came easy when I gone through right blog – rɑːdʒɑ Nov 20 '16 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.