How to Compile PyPy With cx_Oracle on C Types

How to Install PyPy with cx_Oracle on C Types

PyPy can be installed with a ctypes-based version of cx_Oracle as an alternative to building PyPy from source with the cx_Oracle module flag set. To do so go to github and download/clone lameiro's cx_oracle_on_ctypes project ( Also, if you don't have PyPy installed, head to their website and download the Linux binary ( Install PyPy by just moving the extracted download directory somewhere permanent. I put mine in /opt and made an alias in my .bashrc (alias pypy='/opt/pypy/bin/pypy').

Try typing PyPy from the command line to see if you can launch it. If you also try to import cx_Oracle you'll see that it fails, even with a working Python cx_Oracle install.

Now install the ctypes-based version of cx_Oracle. First, copy the cx_Oracle directory (from the cx_oracle_on_ctypes project you cloned from github) to somewhere permanent. Mine is in /home/pclass/lib.

Next, setup the environment variables. Mine look like:

export ORACLE_HOME=/usr/lib/oracle/11.2/client64

export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib

export PYTHONPATH=/home/<USER>/lib/cx_oracle_on_ctypes/:/home/<USER>/lib/cx_oracle_on_ctypes/cx_Oracle

export NLS_LANG=.UTF8

That should be it! This process speeds up my insert of second by second GPS receiver log files down to 18 minutes for 1 site and takes 1/2 the memory.

Hope this helps someone, Happy Coding!!

ClassyBits 2020