Why does pyinstaller generated cx_oracle application work on fresh CentOS machine but not on one with Oracle client installed?
<p>I wrote a python application that uses <code>cx_Oracle</code> and then generates a pyinstaller bundle (folder/single executable).  I should note it is on 64 bit linux.  I have a custom spec file that includes the Oracle client libraries so everything that is needed is in the bundle.  </p>

<p>When I run the bundled executable on a freshly installed CentOS 7.1 VM, (no Oracle software installed), the program connects to the database successfully and runs without error.  However, when I install the bundled executable on another system that contains RHEL 7.2, and I try to run it, I get</p>

<blockquote>
  <p>Unable to acquire Oracle environment handle. </p>
</blockquote>

<p>My understanding is this is due to an Oracle client installation that has some sort of conflict.  I tried unsetting ORACLE_HOME on the machine giving me errors.  It's almost as though the program is looking for the Oracle client libraries in a location other than in the location where I bundled the client files.  </p>

<p>It seems like it should work on both machines or neither machine.  I guess I'm not clear on how the Python application/cx_Oracle finds the Oracle client libraries.  Again, it seems to have found them fine on a machine with a fresh operating system installation.  Any ideas on why this is happening?</p>

<p>One thing that you may be running into is the fact that if you used the instant client RPMs when you built cx_Oracle an RPATH would have been burned into the shared library. You can examine its contents and change it using the chrpath command. You can use the special path $ORIGIN in the modified RPATH to specify a path relative to the shared library.</p>

<p>If an RPATH isn't the culprit, then you'll want to examine the output from the ldd command and see where it is looking and then adjust things to make it behave itself!</p>

python pyinstaller cx-oracle