Invalid app definition, metaclass conflict, or import error

Beam is mocking the package imports so you don’t need them installed locally to run them on Beam. We assume that the python packages you’re importing will actually be in the image we build.

However, this sometimes breaks.

The Solution

  1. Add your imports inline, in your function. For example:
def handler():
    import torch
    import transformers
    ...
  1. Run or deploy your app by passing an optional env var, called BEAM_IGNORE_IMPORTS_OFF.

If you pass this flag when running or deploying an app, Beam won’t mock the imports, but this means you’ll need all the packages in your app actually installed in your local environment.

For example:

BEAM_IGNORE_IMPORTS_OFF=true beam deploy scrape.py:func

We’re working on making this system more robust and this is a short-term solution in the meantime!

Unable to locate config file

When you run beam configure, your API keys are saved to ~./beam/config.

Beam expects your package to live in /usr/local/bin/beam. If you are running Beam using a different package manager (like Conda), you may need to manually point your installation to this path for Beam to locate your config file.

Was this page helpful?