autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Error loading ASGI app. Could not import module "autogenstudio.web.app".[Issue]:

Open Sequential-circuits opened this issue 2 years ago • 9 comments

Describe the issue

When I type autogenstudio ui --port 8081 I get Error loading ASGI app. Could not import module "autogenstudio.web.app".

I had installed autogen studio from just pip and it worked. Then I decided to install it from source and it gave me the error "The engine "node" is incompatible with this module", so I updated node to the latest (21.6.0) and finally was able to install autogen studio manually, but it does not run showing "Error loading ASGI app. Could not import module "autogenstudio.web.app"

So I think the problem is that this version is autogen studio is incompatible with node 21.6.0

Steps to reproduce

No response

Screenshots and logs

No response

Additional Information

No response

Sequential-circuits avatar Jan 18 '24 10:01 Sequential-circuits

I got the same problem with this. But I am not sure my frontend build correctly I follow the guide from the github with following steps

npm install -g gatsby-cli
npm install --global yarn
cd frontend
yarn install
yarn build

And the the build command use "xcopy /E /I /Y public ..\autogenstudio\web\ui", seems like copy dir "public" to dir "ui" but there's an error about "can't find the file", I don't see any dir's name is "public"

nuts-has-been-taken avatar Jan 18 '24 13:01 nuts-has-been-taken

Hi ,

@Sequential-circuits , I would recommend creating a new virtual environment and reinstalling

Could not import module "autogenstudio.web.app". The error indicates there might be some issue with path causes by using both approaches.

The public folder is created when yarn build completes successfully. You can manually copy this to the ui folder in autogenstudio/web/ui.

In general, using WSL on windows is also recommended.

victordibia avatar Jan 18 '24 15:01 victordibia

Installation from PyPi works.

But I have the same issue. My Frontend Built works standalone, but not via

# /web/app.py
@app.command()
def ui(
    host: str = "127.0.0.1",
    port: int = 8081,
    workers: int = 1,
    reload: Annotated[bool, typer.Option("--reload")] = False,
    docs: bool = False,
):
    """
    Launch the AutoGen Studio UI CLI .Pass in parameters host, port, workers, and reload to override the default values.
    """

    os.environ["AUTOGENUI_API_DOCS"] = str(docs)

    uvicorn.run(
        "autogenstudio.web.app:app",
        host=host,
        port=port,
        workers=workers,
        reload=reload,
    )

I am using anaconda for Python 3.10.13 on Ubuntu 22.04 and executed pip install -e . within the folder autogen-studio

Have done

npm install -g gatsby-cli
npm install --global yarn
cd frontend
yarn install
yarn build

and copied frontend/public/ into autogenstudio/web/ui and executed via

autogenstudio ui --port 8081

I am not much experienced with uvicorn but the parameter "autogenstudio.web.app:app" should be all right 🤔

christonomous avatar Jan 19 '24 20:01 christonomous

Hi @equaliser0.

I believe this issue occurs if autogenstudio is installed from pypi and at the same time from source (pip install -e .), in the same python environment. For some reason, uvicorn seems to get confused about which version to use.

I usually recommend building from source in brand new python env.

conda create ..
conda activate 
pip install -e . 
autogenstudio ui

victordibia avatar Jan 19 '24 20:01 victordibia

I am still facing this error, event after conda create new env and installed.

Can someone provide me steps to clean up the autogenstudio properly.

sibijr avatar Jan 31 '24 05:01 sibijr

Hi @sibijr ,

Are you above to install miniconda and create/activate an environment?

  • install here https://docs.conda.io/projects/miniconda/en/latest/miniconda-install.html
  • Create an env .. conda create -n autogen python=3.10
  • activate ...conda activate autogen
  • pip install -U autogenstudio
  • autogenstudio ui --appdir newdir

https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python

victordibia avatar Jan 31 '24 05:01 victordibia

It worked, thank you.

However, I also want to install it via source as I wish to modify the source code and rerun it. How can this be done?

sibijr avatar Jan 31 '24 07:01 sibijr

I also ran into this error today trying to build autogenstudio, on ubuntu/wsl did pip install -e . , did the yarn build, copied the files still failed, tried a new conda env and that didn't work either.

pecord avatar Feb 21 '24 02:02 pecord

This is more of an installation issue that I am many others do not repro. Closing for now.

victordibia avatar Oct 18 '24 19:10 victordibia