23 Nov 2020 11:00 PM - last edited on 18 May 2023 02:44 PM by Michal_Gebacki
Hello,
I found various posts on python module dependencies, most of them related to OneAgent plugins and direct dependencies. I'm trying to build a AG remote plugin where the python module that the plugin depends on (ExasolDatabaseConnector) has another dependency to the pyodbc module.
In the remoteplugin logs (and the UI) I'm getting an error that the module is not found:
2020-11-23 22:28:00.893 UTC [e4c298f2] info [native] 140681196791552(ThreadPoolExecutor-0_8) - [event_set_configuration] event_set_configuration, plugin: <RemotePluginEngine, meta_name:custom.remote.python.exasol id:0x7ff308cf7898> config: {'host': 'http://0.0.0.0:8769'}
2020-11-23 22:28:00.896 UTC [e4c298f2] severe [native] 140681196791552(ThreadPoolExecutor-0_8) - [set_full_status] No module named 'pyodbc'
Traceback (most recent call last):
File "/opt/dynatrace/remotepluginmodule/agent/plugin/engine.zip/ruxit/plugin_state_machine.py", line 340, in _execute_next_task
self._query_plugin()
File "/opt/dynatrace/remotepluginmodule/agent/plugin/engine.zip/ruxit/plugin_state_machine.py", line 667, in _query_plugin
self._plugin_run_data = self._create_plugin_run_data()
File "/opt/dynatrace/remotepluginmodule/agent/plugin/engine.zip/ruxit/plugin_state_machine.py", line 640, in _create_plugin_run_data
plugin_module = importlib.import_module(self.metadata["source"]["package"])
File "/opt/dynatrace/remotepluginmodule/agent/plugin/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/dynatrace/remotepluginmodule/plugin_deployment/custom.remote.python.exasol/dynatrace_activegate_exasol_plugin.py", line 4, in <module>
from ExasolDatabaseConnector import Database
File "/opt/dynatrace/remotepluginmodule/plugin_deployment/custom.remote.python.exasol/ExasolDatabaseConnector/__init__.py", line 3, in <module>
from ExasolDatabaseConnector.ExaOdbcDriver.FindDriver import GetDriverName
File "/opt/dynatrace/remotepluginmodule/plugin_deployment/custom.remote.python.exasol/ExasolDatabaseConnector/ExaOdbcDriver/__init__.py", line 2, in <module>
import pyodbc
ModuleNotFoundError: No module named 'pyodbc'
Regardless of if I add only the Exasol Database python module or also the pyodbc module as a requirement in the plugin.json file. The module is not found:
"source": {
"package": "dynatrace_activegate_exasol_plugin",
"className": "ExasolPluginRemote",
"install_requires": ["pyodbc>=4.0.30","ExasolDatabaseConnector>=0.1.7"],
"activation": "Remote"
},
I'm building the plugin in a python venv directly on the ActiveGate and the build/deployment succeeds. It seems that the pyodbc module creates some native libraries. Could that be a problem?
Here is the log (build_plugin.txt ) of the plugin build command.
Any ideas?
Thanks,
Reinhard
Solved! Go to Solution.
24 Nov 2020 06:33 AM
Hi Reinhard!
Try building plugin on Python3.6 venv instead on Python3.7 - native dependencies are not compatible with other minor versions, and we use Python3.6 to run extensions
Maciek
24 Nov 2020 08:34 AM
Make sure that you use the 64 bit version of Python 3.6.
24 Nov 2020 10:27 AM
Hi Maciej,
thanks! I didn't think about that! Switching to python3.6 was the solution. I've switched my build docker container to 3.6 and that worked fine. Maybe that dependency is worth a note in the AG plugin documentation, since many distros are already switching to more recent versions of python. Especially since the documentation recommends to build directly on Activegates this might not be obvious to people.
Thanks again! My Exasol Plugin is on the way!
Reinhard
25 Nov 2020 04:12 PM
Reinhard, hello! Thanks for feedback! We actually mention it in the hands-on tutorial, but I agree this could be surfaced better. Will work on it. https://www.dynatrace.com/support/help/shortlink/activegate-extensions-tutorial#prepare-your-environ...
Thanks!
Jarek
Dynatrace Doc team