https://prefect.io logo
Title
v

Viet Nguyen

07/27/2022, 11:40 AM
Hi guys, I'm trying to run sample code using DaskTaskRunner but got this error
ImportError: cannot import name 'DaskTaskRunner' from partially initialized module 'prefect_dask' (most likely due to a circular import)
I used
2.0b15
latest
prefect-dask
on Python
3.8.13
3.9
3.8.4
3.7.13
(freshly installed Conda envs), I'm wondering if you have come across this issue before? Many thanks
1
sample code I tried to run
a

Anna Geller

07/27/2022, 11:55 AM
interesting, I couldn't reproduce:
(qa) ➜  prefect-deployment-patterns git:(main) ✗ python mapping_and_state_handling/dask_flow.py 
07:54:53.000 | DEBUG   | prefect.client - Connecting to API at <http://127.0.0.1:4200/api/>
07:54:53.120 | INFO    | prefect.engine - Created flow run 'hopping-turaco' for flow 'greetings'
07:54:53.120 | INFO    | Flow run 'hopping-turaco' - Starting 'DaskTaskRunner'; submitted tasks will be run concurrently...
07:54:53.120 | DEBUG   | prefect.task_runner.dask - Starting task runner...
07:54:53.121 | INFO    | prefect.task_runner.dask - Creating a new Dask cluster with `distributed.deploy.local.LocalCluster`
07:54:55.157 | DEBUG   | prefect.client - Connecting to API at <http://127.0.0.1:4200/api/>
07:54:55.712 | INFO    | prefect.task_runner.dask - The Dask dashboard is available at <http://127.0.0.1:8787/status>
07:54:55.721 | DEBUG   | prefect.client - Connecting to API at <http://127.0.0.1:4200/api/>
07:54:56.075 | DEBUG   | Flow run 'hopping-turaco' - Executing flow 'greetings' for flow run 'hopping-turaco'...
07:54:56.078 | DEBUG   | Flow run 'hopping-turaco' - Beginning execution...
07:54:56.113 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_hello-811087cd-0' for task 'say_hello'
07:54:57.112 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_hello-811087cd-0' for execution.
07:54:57.147 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_goodbye-261e56a8-0' for task 'say_goodbye'
07:54:57.162 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_goodbye-261e56a8-0' for execution.
07:54:57.219 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_hello-811087cd-1' for task 'say_hello'
07:54:57.235 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_hello-811087cd-1' for execution.
07:54:57.248 | DEBUG   | prefect.client - Connecting to API at <http://127.0.0.1:4200/api/>
07:54:57.296 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_goodbye-261e56a8-1' for task 'say_goodbye'
07:54:57.312 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_goodbye-261e56a8-1' for execution.
07:54:57.347 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_hello-811087cd-2' for task 'say_hello'
07:54:57.353 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_hello-811087cd-2' for execution.
07:54:57.390 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_goodbye-261e56a8-2' for task 'say_goodbye'
07:54:57.396 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_goodbye-261e56a8-2' for execution.
07:54:57.434 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_hello-811087cd-3' for task 'say_hello'
07:54:57.443 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_hello-811087cd-3' for execution.
07:54:57.472 | INFO    | Flow run 'hopping-turaco' - Created task run 'say_goodbye-261e56a8-3' for task 'say_goodbye'
07:54:57.482 | INFO    | Flow run 'hopping-turaco' - Submitted task run 'say_goodbye-261e56a8-3' for execution.
07:54:57.590 | DEBUG   | prefect.task_runner.dask - Shutting down task runner...
07:54:58.052 | INFO    | Flow run 'hopping-turaco' - Finished in state Completed('All states completed.')
07:54:58.057 | DEBUG   | prefect.client - Connecting to API at <http://127.0.0.1:4200/api/>
Can you try in a new fresh virtual env?
e.g. new Conda env?
v

Viet Nguyen

07/27/2022, 11:57 AM
may I know your python version please?
a

Anna Geller

07/27/2022, 12:01 PM
3.9
3.9.12 exactly
maybe you can try later today or tomorrow with the official 2.0 release (no longer beta)?
🙌 1
v

Viet Nguyen

07/27/2022, 12:04 PM
awesome, I'll let my team to aware of this new update too, we're trying to build a proof of concept . Thank you
🙌 1
hmm still stuck with the same error on newly created conda env:
so an update, on a fresh Ubuntu install (EC2) I've got the script running without issue and got the outputs as you posted above , but on my local dev, I tried
pyenv
and
conda
, nothing worked 😿
finally got it to work, for some reason, delete the repo folder and clone it again did a trick