This message was deleted.
# marvin-in-the-wild
s
This message was deleted.
m
It appears you're encountering issues with module loading when running Prefect flows using a local subprocess worker. The problem doesn't seem to be with permissions but rather with how import paths are handled in the subprocess environment. It's not uncommon for dynamic import paths to lead to
ModuleNotFoundError
if the worker's environment is set up differently from the main process or if there are path resolution issues. Here are a few steps you might consider to troubleshoot this problem: 1. Verify the import path: Ensure that the worker's environment has access to the correct Python path when the worker subprocess starts. While you have verified that the path is added to
sys.path
, it's essential to confirm that this happens before you attempt to import the module. 2. Examine subprocess environment: Check if the worker's Python subprocess is inheriting the main process's environment correctly, especially the Python path. It may require explicitly passing
sys.path
or using environment variables to manage this. 3. Consider using absolute imports: If you're using relative imports, try switching to absolute imports for more predictable behavior across different environments. 4. Examine worker behavior: Refer to the Prefect documentation to understand how workers are initiated and how to customize worker behavior if necessary. (Refer to links here and here) 5. Check for known issues: Search for similar issues in the Prefect GitHub repository for any known problems or workarounds related to custom module loading with workers. An existing issue about
ModuleNotFoundError
when running deployed flows using a custom image was found here, although not directly related to your case, it demonstrates that such issues can arise in specific configurations. To further assist, you may want to provide a minimal reproduction of the issue and consider opening an issue on the Prefect GitHub repository if it seems like a bug or unhandled edge case with the worker setup.
m
@Marvin the error received is the following """Encountered exception during execution: Traceback (most recent call last): File "c:\prefect\venv\Lib\site-packages\prefect\engine.py", line 867, in orchestrate_flow_run result = await flow_call.aresult() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\prefect\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 326, in aresult return await asyncio.wrap_future(self.future) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\prefect\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 351, in _run_sync result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows\customers\wamapi\flows\wamapi_dailyfeeds_instrumentperimeter_dataquality.py", line 27, in wamapi_dailyfeeds_instrumentperimeter res = dataquality.execute() ^^^^^^^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows\data_quality\dataquality.py", line 157, in execute checkpoint = self.get_checkpoint() ^^^^^^^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows\data_quality\dataquality.py", line 139, in get_checkpoint self.batch_request = self.datasource_updater.batch_request(data_asset=self.data_asset, batch_request_params=self.batch_request_params) ^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows\data_quality\dataquality.py", line 119, in data_asset data_asset_dict = self.datasource.get_assets_as_dict() ^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows\data_quality\dataquality.py", line 110, in datasource datasource = self.datasource_updater.add_or_update_datasource(context=self.context, ^^^^^^^^^^^^ File "C:\prefect\prefectflows\data_quality\dataquality.py", line 102, in context importlib.import_module(module) File "C:\Python311\Lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1128, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1128, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1128, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1206, in _gcd_import File "", line 1178, in _find_and_load File "", line 1142, in _find_and_load_unlocked ModuleNotFoundError: No module named 'gx'"""
m
Your message was too long by 448 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
the error received is the following """Encountered exception during execution:
Traceback (most recent call last): File "c:\prefect\venv\Lib\site-packages\prefect\engine.py", line 867, in orchestrate_flow_run result = await flow_call.aresult() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\prefect\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 326, in aresult return await asyncio.wrap_future(self.future) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\prefect\venv\Lib\site-packages\prefect\_internal\concurrency\calls.py", line 351, in _run_sync result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows\customers\wamapi\flows\wamapi_dailyfeeds_instrumentperimeter_dataquality.py", line 27, in wamapi_dailyfeeds_instrumentperimeter res = dataquality.execute() ^^^^^^^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows\data_quality\dataquality.py", line 157, in execute checkpoint = self.get_checkpoint() ^^^^^^^^^^^^^^^^^^^^^ File "C:\prefect\prefectflows