-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError: DLL load failed while importing ibm_db: #887
Comments
@ZephyrusMB, Can you please run as below, before import ibm_db. |
Also upgraded from ibm-db version 3.1.4 to 3.2.0 and ran into the error "ImportError: DLL load failed while importing ibm_db". |
@ZephyrusMB This we need to add manually for windows only. And the same is documented in README. |
I studied the README before posting this comment, so it was clear to me what needed to be done. The issue I want to address is that this package is not downwards compatible and platform agnostic anymore and we need to change several scripts. Using ibm-db==3.1.4 we can run the same scripts on Windows, Linux and in Containers. If I want to use ibm-db==3.2.0 I have to alter these scripts to check if os.name == 'nt' (or os.name != 'posix') and then execute os.add_dll_directory(os.getenv('IBM_DB_HOME') + '/bin'). I'm using this driver mainly in combination with RobotFramework (this is a testautomation framework) third party libraries (e.g. robotframework-databaselibrary). I don't want to change these third party libraries, so need to use IF and Evaluate construction to make it platform independent in my testscripts again:
The question is, can't you add this construction:
or other construction to the ibm-db module to make it platform agnostic again and downwards compatible with ibm-db==3.1.4? If there is good reason to not do this, please shed some light on this as to why. Is it conflicting somewhere else? If it cannot be changed, then we will stick to ibm-db==3.1.4 for now an change our scripts later on to work with ibm-db=3.2.0 or later version. |
@Earammak I'm getting this error: |
Yes please as described by @dverweij-dev the expected behavior is to be platform agnostic as in version 3.1.4. Kind regards |
@frbelotto You need to run below command as documented here as Note:
Also, this solution is already given in this comment: #887 (comment) |
@Rishi-spec-art they mean something like:
... whatever the path is to where pip put your clidriver/bin. IBM team, I'd suggest clarifying that wording. "until bin" sounds to me like you don't want it to stop at "clidrivder/" |
Just to understand. Such installation (ODBC and CLI driver) wasn't needed before? I have been using IBM_DB for a while and started getting this error recently. |
@readytheory Yes, do not stop at clidriver but clidriver/bin as in |
@frbelotto You are right. Actually from ibm_db version 3.2.0, we have discontinued shipping ibm_db.dll file and switched on wheel support for Linux, Mac and Windows to avoid compilation related issues. So, change in behavior. Thanks. |
I got this error despite following the guide
Bellow is the error ImportError: DLL load failed while importing ibm_db: The specified module could not be found. |
@LinusConradM Seems you have not went through the comments in this issue. Please check it: #887 (comment) Thanks. |
add_dll_directory to every script that needs db2 access? What a terrible user experience, I can't believe this is the best answer. Please re-evaluate the strategy. |
this is really helpfull, thanks |
Does anyone can confirm what is the lastest version of the library that does not request adding the dll manually? I want to set it up on my requests.txt. |
@frbelotto python-ibm_db v3.1.4 is the latest version of the library that does not request adding the dll manually. Also from python version Before Python 3.8, the DLL search path was influenced by the PATH environment variable. However, this could lead to issues, especially when Python was embedded in larger applications. The os.add_dll_directory() function was introduced to provide a more controlled and isolated way of managing the DLL search path. Here's a basic example of how to use os.add_dll_directory(): import os Add a directory to the DLL search path Now, when loading a DLL or using ctypes, the specified directory is considered in the search path It's important to note that this function is available only in Python 3.8 and later versions. If you're working with an earlier version of Python, you might need to consider alternative approaches or upgrade to a newer Python version. Thanks. |
Regardless of whether you end up adding the ddl back or not, could you consider issuing deprecation warnings for breaking changes in the future? Edit: Especially considering that installs for <3.2 are now also retroactively fucked because it relied on pulling the DDL from master, which is no longer there, so rolling back is not even an option. |
I'm running into this issue on redhat, it's failing to create databases but I can query existing ones:
Am I missing something here? |
"ImportError: DLL load failed while importing ibm_db" raised while executing script. Working with ibm_db version 3.1.4.
Dlls are not present with 3.2.0 version.
Operating System Name: Microsoft Windows 11 10.0.22621
Python Version: 3.11.4 and 3.11.5
ibm_db version: 3.2.0
Test script to reproduce the problem
Failed at line 1
import ibm_db
Steps to Reproduce:
pip install --upgrade ibm_db
The text was updated successfully, but these errors were encountered: