You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- When ibm_db get installed from wheel package, you can find clidriver under site_packages directory of Python. You need to copy license file under `site_packages/clidriver/license` to be effective, if any.
121
121
122
-
**Note:** For windows after installing ibm_db, recieves the below error when we try to import ibm_db :
122
+
**Windows DLL resolution (Python 3.8+):**
123
+
124
+
Since Python 3.8, the `PATH` environment variable is no longer used for DLL resolution on Windows (see https://bugs.python.org/issue36085). The `ibm_db` package now handles this **automatically** by installing an `ibm_db_dll.pth` file into `site-packages`. This file runs at Python startup and registers the clidriver `bin` directory via `os.add_dll_directory()`, so `import ibm_db` works out of the box.
125
+
126
+
If `IBM_DB_HOME` is set, the `.pth` file uses `%IBM_DB_HOME%\bin`; otherwise it uses the bundled `site-packages\clidriver\bin`.
127
+
128
+
**If you still see `ImportError: DLL load failed` after a fresh install**, verify that the `.pth` file exists:
123
129
124
-
```>python
125
-
Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
126
-
Type "help", "copyright", "credits" or "license" for more information.
127
-
>>> import ibm_db
128
-
Traceback (most recent call last):
129
-
File "<stdin>", line 1, in <module>
130
-
ImportError: DLL load failed while importing ibm_db: The specified module could not be found.
We need to make sure to set dll path of dependent library of clidriver before importing the module as:
134
+
If it prints `False`, reinstall ibm_db:
135
135
136
136
```
137
+
pip uninstall ibm_db
138
+
pip install ibm_db
139
+
```
140
+
141
+
**Manual fallback:** If the automatic fix does not work in your environment, you can set the DLL path directly in your code before importing the module:
142
+
143
+
```python
137
144
import os
138
145
os.add_dll_directory('path to clidriver installation until bin')
Refer https://bugs.python.org/issue36085 for more details.
149
+
To find your clidriver `bin` path, run:
150
+
151
+
```
152
+
python -c "import os, site, sysconfig; paths=[os.path.join(site.getusersitepackages(),'clidriver','bin'), os.path.join(sysconfig.get_path('purelib'),'clidriver','bin')]; print(next((p for p in paths if os.path.isdir(p)), 'clidriver not found - reinstall ibm_db'))"
153
+
```
147
154
148
155
- <aname="docker"></a>For installing ibm_db on docker Linux container, you can refer as below:
0 commit comments