Skip to content

Cannot locate a 64-bit Oracle Client library: "The specified module could not be found" #612

@liudonghua123

Description

@liudonghua123
  1. What versions are you using? 8.3.0

Give your database version. Oracle 12c

Also run Python and show the output of:

import sys
import platform

print("platform.platform:", platform.platform())
print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
print("platform.python_version:", platform.python_version())

And:

import cx_Oracle
print("cx_Oracle.version:", cx_Oracle.version)
print("cx_Oracle.clientversion:", cx_Oracle.clientversion())
D:\code\python\ecard-app>python info1.py
platform.platform: Windows-10-10.0.22000-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.10.2

D:\code\python\ecard-app>python info2.py
cx_Oracle.version: 8.3.0
Traceback (most recent call last):
  File "D:\code\python\ecard-app\info2.py", line 3, in <module>
    print("cx_Oracle.clientversion:", cx_Oracle.clientversion())
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help

D:\code\python\ecard-app>
  1. Is it an error or a hang or a crash? crash

  2. What error(s) or behavior you are seeing?

I use this package in my python app, and I have configured oracle instant client by adding D:\apps\oracle\instantclient_19_8 to the path environment. When I tried to connect to the remote oracle database, I got Cannot locate a 64-bit Oracle Client library: "The specified module could not be found" error. However If I packaged the app using pyinstaller and execute the exe, the it worked.

The following is some logs of these steps.

# https://oracle.github.io/odpi/doc/installation.html#oracle-client-library-loading
D:\code\python\ecard-app>set DPI_DEBUG_LEVEL=64
D:\code\python\ecard-app>python ecard.py
ODPI [09144] 2022-02-24 14:41:35.981: ODPI-C 4.3.0
ODPI [09144] 2022-02-24 14:41:35.981: debugging messages initialized at level 64
......
ODPI [09144] 2022-02-24 14:41:39.371: Context Parameters:
ODPI [09144] 2022-02-24 14:41:39.371: Environment Variables:
ODPI [09144] 2022-02-24 14:41:39.371:     PATH => "C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;"
ODPI [09144] 2022-02-24 14:41:39.371: check module directory
ODPI [09144] 2022-02-24 14:41:39.371: module name is C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\cx_Oracle.cp310-win_amd64.pyd
ODPI [09144] 2022-02-24 14:41:39.371: load in dir C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages
ODPI [09144] 2022-02-24 14:41:39.371: load with name C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages/oci.dll
ODPI [09144] 2022-02-24 14:41:39.372: load by OS failure: The specified module could not be found
ODPI [09144] 2022-02-24 14:41:39.372: load with OS search heuristics
ODPI [09144] 2022-02-24 14:41:39.372: load with name oci.dll
ODPI [09144] 2022-02-24 14:41:39.372: load by OS failure: The specified module could not be found
DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html for help
......


D:\code\python\ecard-app>dist\ecard\ecard.exe
......
ODPI [26476] 2022-02-24 14:42:49.808: Context Parameters:
ODPI [26476] 2022-02-24 14:42:49.811: Environment Variables:
ODPI [26476] 2022-02-24 14:42:49.813:     PATH => "C:\Users\Liu.D.H\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\VMware\VMware Workstation\bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Users\Liu.D.H\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Program Files (x86)\NetSarang\Xshell 7\;C:\Program Files (x86)\NetSarang\Xftp 7\;C:\ProgramData\chocolatey\bin;C:\Users\Liu.D.H\.wasmer\bin;C:\Users\Liu.D.H\.wasmer\globals\wapm_packages\.bin;C:\Program Files\mvndaemon\mvnd-0.7.1-windows-amd64\bin;C:\msys64\usr\bin;C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin;C:\Library\Swift-development\bin;C:\Library\icu-67\usr\bin;C:\Program Files\MiKTeX\miktex\bin\x64\;D:\apps\微信web开发者工具\dll;C:\Program Files\Git LFS;C:\Program Files\LLVM\bin;C:\Users\Liu.D.H\scoop\shims;C:\Users\Liu.D.H/.local/bin;C:\Users\Liu.D.H\AppData\Roaming\npm;C:\Users\Liu.D.H\.cargo\bin;C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps;C:\Users\Liu.D.H\anaconda3;C:\Users\Liu.D.H\anaconda3\Library\mingw-w64\bin;C:\Users\Liu.D.H\anaconda3\Library\usr\bin;C:\Users\Liu.D.H\anaconda3\Library\bin;C:\Users\Liu.D.H\anaconda3\Scripts;C:\Users\Liu.D.H\.dotnet\tools;C:\Users\Liu.D.H\AppData\Local\Programs\Microsoft VS Code\bin;D:\android\android_sdk\tools;D:\android\android_sdk\tools\bin;D:\android\android_sdk\platform-tools;D:\android\android_sdk\cmdline-tools\latest\bin;D:\android\android_sdk\build-tools\29.0.3;D:\android\android_sdk\ndk-bundle;C:\Program Files\Java\jdk-17\bin;D:\apps\flutter\bin;D:\apps\flutter\bin\cache\dart-sdk\bin;D:\apps\apache-maven-3.8.4\bin;D:\apps\ffmpeg-5.0-full_build\bin;D:\apps\ImageMagick-7.1.0-portable-Q16-HDRI-x64;D:\apps;D:\apps\bin;C:\Program Files\Sublime Text;C:\Program Files\JetBrains\DataGrip 2021.3.1\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Liu.D.H\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts;C:\Program Files\CMake\bin;D:\apps\graphicsmagick-1.3.36-q16;D:\apps\WasmEdge-0.9.1-windows\bin;C:\tools\msys64;C:\Users\Liu.D.H\AppData\Local\Pub\Cache\bin;C:\Program Files\JetBrains\IntelliJ IDEA 2021.3.1\bin;D:\apps\binaryen-version_105-x86_64-windows\bin;D:\apps\oracle\instantclient_19_8;"
ODPI [26476] 2022-02-24 14:42:49.882: check module directory
ODPI [26476] 2022-02-24 14:42:49.884: module name is D:\code\python\ecard-app\dist\ecard\cx_Oracle.cp310-win_amd64.pyd
ODPI [26476] 2022-02-24 14:42:49.889: load in dir D:\code\python\ecard-app\dist\ecard
ODPI [26476] 2022-02-24 14:42:49.891: load with name D:\code\python\ecard-app\dist\ecard/oci.dll
ODPI [26476] 2022-02-24 14:42:49.894: load by OS failure: The specified module could not be found
ODPI [26476] 2022-02-24 14:42:49.897: load with OS search heuristics
ODPI [26476] 2022-02-24 14:42:49.898: load with name oci.dll
ODPI [26476] 2022-02-24 14:42:49.902: load by OS successful
ODPI [26476] 2022-02-24 14:42:49.903: validating loaded library
......

I also add some code to check the oci.dll in PATH. Both of them passed.

def check_env():
    print(f'os.environ["PATH"]: {os.environ["PATH"]}')
    print(f'os.system("where oci.dll"): {os.system("where oci.dll")}')

check_env()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions