Unable to locate config file

This happens when your current Python environment is different from the Python path Beam was installed in. Often happens while working in virtualenvs.

Solution

  1. Check which Python environment you’re working in: which python. This will print something like /Users/eli/miniconda3/bin/python.
  2. Install Beam in that environment: [YOUR PYTHON PATH] -m pip install --upgrade beam-sdk
  3. Validate the installation by running beam

Could not load dynamic library

Running Tensorflow models will sometimes result in the following error:

Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/usr/lib/worker/x86_64-linux-gnu:/usr/local/nvidia/lib64:/usr/local/cuda-12.2/targets/x86_64-linux/lib:$LD_LIBRARY_PATH

Solution

Add LD_LIBRARY_PATH=/usr/local/lib/python3.10/dist-packages/nvidia/cudnn to your Beam handler function.

Could not load library libcudnn

Sometimes Whisper and other speech models will produce the following error:

Could not load library libcudnn_ops_infer.so.8. Error: libcudnn_ops_infer.so.8: cannot open shared object file: No such file or directory
Please make sure libcudnn_ops_infer.so.8 is in your library path!

Solution

Add this to your commands field in beam.App.Runtime.Image:

commands=[
    "apt-get update && apt-get install wget"
    " && wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.1-1_all.deb",
    "dpkg -i cuda-keyring_1.1-1_all.deb",
    "lsb_release -a && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y ffmpeg libpq-dev cuda=11.8.0-1 libcudnn8=8.9.2.*-1+cuda11.8",
]

Using Poetry with Beam

We don’t currently support importing requirements from pyproject.toml.

Solution

If you’re using Poetry, you should export your requirements to a requirements.txt and link the path in your python_packages field in beam.App.Runtime.Image.

Unable to package app

When you deploy an app to Beam, we create a .zip folder with the files in your current working directory. This .zip is limited to 500Mb.

In practice, deployment packages should be much smaller than 500Mb.

Solution

This error typically occurs when you haven’t added a .beamignore file to your project. Adding a .beamignore will prevent unneeded files from being included in your deployment package.

Invalid JSON Offset

This error is raised by the JSON parser. This sometimes happens when your JSON syntax is incorrect.

Solution

If you see this error, it’s best to double-check your JSON syntax through a JSON formatter, like this one.