microsoft / TaskWeaver

A code-first agent framework for seamlessly planning and executing data analytics tasks.
https://microsoft.github.io/TaskWeaver/
MIT License
4.99k stars 636 forks source link

RuntimeError: This event loop is already running. #234

Open SingTeng opened 3 months ago

SingTeng commented 3 months ago

Describe the bug I don't know if this is related to platform or code. I try to run Taskweaver in Azure Machine Learning Studio. I get 'RuntimeError: This event loop is already running' when trying to run Taskweaver.

To Reproduce I clone the code on Azure Machine Learning Studio and run it using Jupyterlab terminal. Pip installed all the necessary packages. Then I do a 'chmod 600 TaskWeaver'. Then I start the taskweaver by doing: python -m taskweavr =p ./project/ The starting is fine. When I ask it to do something, it runs into the error.

Screenshots image image

Environment Information (please complete the following information):

ShilinHe commented 3 months ago

Hi @SingTeng, I also encountered the same issue in AML. The error message suggests that the kernel started by TaskWeaver runs inside another kernel (guess it is the Jupyter-lab terminal you mentioned). Not sure how AML manages the Jupyter kernels, so it would be better to move to another compute platform.

SingTeng commented 3 months ago

@ShilinHe What would be your suggested compute platform on Azure?

SingTeng commented 3 months ago

ok. I am here to provide a solution. In Azure Machine Learning Studio, you can start a terminal to run Taskweaver. The trick is to have the Taskweaver in localfiles, not cloudfiles. Normally when we run things on AzureML, it is default to cloudfiles. But in this case you have to switch to localfiles. image

ShilinHe commented 3 months ago

Hi @SingTeng, so glad to see that you have resolved the issue! Could you also add a detailed instruction of how to configure it in AML in this issue thread? so that other people could learn and benefit from your experience. Thanks!

SingTeng commented 3 months ago
  1. In Azure Machine Learning Studio, open up a terminal, you can do it directly in Notebooks or use the JupyterLab.
  2. In the the terminal, do a 'cd ~' which will take you back to home directory.
  3. Do a 'ls', you will now see 3 folders: cloudfiles localfiles readme
  4. Go into localfiles, and git clone / copy your TaskWeaver into the directory.
  5. Then set up as per normal instructions on TaskWeaver guide.