stephabauva/ML_with_DAGs

Error with execute_pipeline from __init__.py

Closed this issue · 1 comments

Hey there, i'm having the following output error while executing the script with "python3 -m dagit -f script.py"

2023-04-19 12:01:23 -0300 - dagit - INFO - Using temporary directory /home/brenofarias/Documents/My Files/Sem Backup/GitHub/MachineLearning-Dagster/tmpwv7uev2t for storage. This will be removed when dagit exits. 2023-04-19 12:01:23 -0300 - dagit - INFO - To persist information across sessions, set the environment variable DAGSTER_HOME to a directory to use. 2023-04-19 12:01:24 -0300 - dagster - INFO - Started Dagster code server for file script.py in process 180569 /home/brenofarias/.local/lib/python3.10/site-packages/dagster/_core/workspace/context.py:591: UserWarning: Error loading repository location script.py:dagster._core.errors.DagsterImportError: Encountered ImportError:cannot import name 'execute_pipeline' from 'dagster' (/home/brenofarias/.local/lib/python3.10/site-packages/dagster/init.py)while importing module script from file /home/brenofarias/Documents/My Files/Sem Backup/GitHub/MachineLearning-Dagster/script.py. Local modules were resolved using the working directory/home/brenofarias/Documents/My Files/Sem Backup/GitHub/MachineLearning-Dagster. If another working directory should be used, please explicitly specify the appropriate path using the -dor--working-directoryfor CLI based targets or theworking_directoryconfiguration option forpython_file`-based workspace targets.

Stack Trace:
File "/home/brenofarias/.local/lib/python3.10/site-packages/dagster/_grpc/server.py", line 266, in init
self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
File "/home/brenofarias/.local/lib/python3.10/site-packages/dagster/_grpc/server.py", line 115, in init
loadable_targets = get_loadable_targets(
File "/home/brenofarias/.local/lib/python3.10/site-packages/dagster/_grpc/utils.py", line 37, in get_loadable_targets
else loadable_targets_from_python_file(python_file, working_directory)
File "/home/brenofarias/.local/lib/python3.10/site-packages/dagster/_core/workspace/autodiscovery.py", line 27, in loadable_targets_from_python_file
loaded_module = load_python_file(python_file, working_directory)
File "/home/brenofarias/.local/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line 97, in load_python_file
raise DagsterImportError(

The above exception was caused by the following exception:
ImportError: cannot import name 'execute_pipeline' from 'dagster' (/home/brenofarias/.local/lib/python3.10/site-packages/dagster/init.py)

Stack Trace:
File "/home/brenofarias/.local/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line 83, in load_python_file
return import_module_from_path(module_name, python_file)
File "/home/brenofarias/.local/lib/python3.10/site-packages/dagster/_seven/init.py", line 49, in import_module_from_path
spec.loader.exec_module(module)
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/home/brenofarias/Documents/My Files/Sem Backup/GitHub/MachineLearning-Dagster/script.py", line 3, in
from modules.solids import *
File "/home/brenofarias/Documents/My Files/Sem Backup/GitHub/MachineLearning-Dagster/modules/solids.py", line 1, in
from dagster import execute_pipeline, pipeline, solid, composite_solid, OutputDefinition, Output, Any

warnings.warn(
2023-04-19 12:01:24 -0300 - dagit - WARNING - Port 3000 is in use - using port 55549 instead
2023-04-19 12:01:24 -0300 - dagit - INFO - Serving dagit on http://127.0.0.1:55549 in process 180556
2023-04-19 12:02:09 -0300 - dagster - INFO - Shutting down Dagster code server for file script.py in process 180569
`
PS: I know that @solid and @pipeline dont work anymore, so i changed it to @job or @op as it says in the following link

Also, i already changed the old "execute_pipeline(data_pipeline) to: data_pipeline.execute_in_process(), or, JobDefinition.execute_in_process(data_pipeline), and none of them worked.

I forked your repo and saved my code in github here

If you can see my

Hi Breno, unfortunately too much of Dagster and its dependencies have changed since I created this project years ago, at that point I'd have to redo the project from scratch. You are much better off following Dagster tutorial -> https://docs.dagster.io/tutorial/setup