litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Bug]: Testing proxy with local raises ModuleNotFoundError

Open edwinjosegeorge opened this issue 10 months ago • 2 comments

What happened?

running litellm --test --local raises the following error

..............
    from proxy_server import app, save_worker_config, ProxyConfig
ModuleNotFoundError: No module named 'proxy_server'

It is raised from litellm/proxy/proxy_cli.py:229

    if local:
        from proxy_server import app, save_worker_config, ProxyConfig
    else:
        try:
            from .proxy_server import (
                app,
                save_worker_config,
                ProxyConfig,
            )
        except ImportError as e:
            if "litellm[proxy]" in str(e):
                # user is missing a proxy dependency, ask them to pip install litellm[proxy]
                raise e
            else:
                # this is just a local/relative import error, user git cloned litellm
                from proxy_server import (
                    app,
                    save_worker_config,
                    ProxyConfig,
                )

Do we actually need --local argument?? The fix could be something like, replace entire block with

 from .proxy_server import save_worker_config, ProxyConfig

This issue it both test install litellm in a fresh environment as well as after git clone.

Relevant log output

No response

Twitter / LinkedIn details

No response

edwinjosegeorge avatar Apr 25 '24 15:04 edwinjosegeorge

@ishaan-jaff

edwinjosegeorge avatar Apr 28 '24 00:04 edwinjosegeorge

@ishaan-jaff @krrishdholakia

edwinjosegeorge avatar May 03 '24 00:05 edwinjosegeorge

closing, the --local flag is only for local dev

ishaan-jaff avatar Jun 13 '24 00:06 ishaan-jaff