#Where does AutoGen install and run libraries?

1 messages · Page 1 of 1 (latest)

final sky
#

I'm a bit confused by how AutoGen works. I'm running the simple NVDA vs TESLA stock example in my terminal.

Initially it tried to add

!pip install

to the code. But I'm not in Jupyter, so I don't think this can work.

I installed the libraries manually and changed my request to give me code without trying to install libraries.

But then it failed to import them.

Presumably it's running the code in its own virtualenv or similar somewhere? Is that right? So the libraries I installed on my main Python installation aren't visible to it?

If so, how is it meant to work? How does code coming back from GPT via the assistant install the libraries it needs to run?

brave marlin
#

are you using docker? If so, the packages will be installed in docker. !pip install won't work but the assistant agent should be able to fix that after seeing eror msg

valid vapor
#

@brave marlin Is there a way to specify which libraries should be installed in the docker container and pre-install them? I usually experience issues when installing larger libraries like pandas, for example. The executor often has issues with this library specifically. Thanks!

brave marlin
#

@trail pike could you help?

trail pike
valid vapor
#

Thank you @trail pike ! I'll give it a shot.

fathom valley
runic elm
#

Can we use local docker images or does it have to be pulled from the hub? Not really a huge concern when dealing with a small image (cause you can always push it), but when dealing with bigger projects, I mean.

fathom valley
#

You can pass the name of the image in the use_docker parameter of the code_execution_config passed to the agent. I believe if the named docker image is available locally, it will use it. https://microsoft.github.io/autogen/docs/reference/agentchat/conversable_agent

That config eventually gets passed to the execute code function in code_utils.py: https://github.com/microsoft/autogen/blob/50ac5476377c1b41330589a6cfc5c4e65b93079f/autogen/code_utils.py#L216 The default images are specified here: https://github.com/microsoft/autogen/blob/50ac5476377c1b41330589a6cfc5c4e65b93079f/autogen/code_utils.py#L341C8-L341C70

runic elm
#

Ah, that's why I'm having issues

    client = docker.from_env()
    image_list = (
        ["python:3-alpine", "python:3", "python:3-windowsservercore"]
        if use_docker is True
        else [use_docker]
        if isinstance(use_docker, str)
        else use_docker
    )

it's automatically appending python, no wonder, thanks for clarification!

fathom valley
#

No, I believe it will use whatever use_docker is, unless it's just the boolean True (in which case it takes the default list).

runic elm
#

I've been trying to

code_execution_config={
        "work_dir": "red",
        "use_docker": "alsaiduq/codelibs:test",
        "timeout": 600,
    },```
as per normal but this doesn't seem to work that way unless I update the list in code_utils.py
fathom valley
#

Ok can you file an issue on GH. It sounds like something we want to replicate and fix

#

It works when you override the default list though in code_utils?