in progress (#1046): re-focus this page on deployment of python on linux, esp. suse; perhaps move to PythonDeployment?. for developer set-up, see WritingQualityCode

virtualenv is a tool to create isolated Python environments:

The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo , but another application requires version 2. How can you use both these applications? Or what if you want to install an application and leave it be ? If an application works, any change in its libraries or the versions of those libraries can break the application. ... In all these cases, virtualenv can help you.

Machine Set-Up

For linux machines (debian, Ubuntu, SuSE, ...) install the python-virtualenv package. (On a SuSE machine, make sure you have the SMT_KUMC repositories that InformationResources provides since July 2012.

Set-Up for building python extensions

Some python packages involve not just python code but a compiled extension. To compile the extension, the machine needs Python.h and the rest of the python development files.

In SuSE, these are in the python-devel package.

For production use, we should have an RPM package for any libraries that aren't pure python (if not all libraries). See #1242

Python and Oracle

cx_Oracle is a Python extension module that allows access to Oracle databases and conforms to the Python database API specification.

See #1242 for info on RPM packages we maintain.

The Build Hints explain how it interfaces with drivers from Oracle. The files for our 64 bit intel architecture are in Oracle instant client downloads for x86-64.

todo: find historical context for these details and move them:

Once those are unzipped under /usr/local, the next step is:

$ export ORACLE_HOME=/usr/local/instantclient_11_2/
$ ln -s
$ ln -s

On my Ubuntu box, I ran into ImportError: cannot open shared object file; the solution came from a December 28, 2009 post on Django and Oracle support: install the libaio1 package.

Then it's pretty straightforward:

$ pip install cx_Oracle
Downloading/unpacking cx-Oracle
  Running egg_info for package cx-Oracle
Installing collected packages: cx-Oracle
  Running install for cx-Oracle
    building 'cx_Oracle' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/instantclient_11_2/sdk/include -I/usr/include/python2.6 -c cx_Oracle.c -o build/temp.linux-x86_64-2.6-11g/cx_Oracle.o -DBUILD_VERSION=5.0.4
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-x86_64-2.6-11g/cx_Oracle.o -L/usr/local/instantclient_11_2/lib -L/usr/local/instantclient_11_2/ -lclntsh -o build/lib.linux-x86_64-2.6-11g/
Successfully installed cx-Oracle
Cleaning up...
Last modified 8 years ago Last modified on Apr 29, 2013 3:34:04 PM