Can Material 3 theme be used with self-hosted anvil-app-server?

I’m trying to run an Anvil app locally using the self-hosted anvil-app-server in Docker (required due to M1 MacBook compatibility). The app uses the Material 3 theme as a dependency and works fine when running on anvil.works (and custom domain), but fails when running locally.

My environment:

  • OS: macOS (Darwin 23.2.0) - Apple M1
  • Runtime: Docker container
  • Python: 3.9
  • anvil-app-server: 1.14.0 (latest via pip)
  • anvil-uplink: 0.5.2

What I’ve tried and what’s not working:

When I start the app locally with Docker, it fails to load with the following error:

AttributeError: module 'property_utils' has no attribute 'get_unset_margin'

Traceback:
  material_3_theme/client_code/_utils/properties.py:6
  material_3_theme/client_code/_Components/Button/__init__.py:6
  material_3_theme/client_code/InitModule.py:3

The Material 3 theme imports from anvil.property_utils, but this module doesn’t appear to exist in the local anvil-app-server package. I’ve confirmed I have the latest version of anvil-app-server (1.14.0).

Is Material 3 theme supported for self-hosted apps, or is anvil.property_utils a cloud-only runtime feature?

Code Sample:

# From material_3_theme/client_code/_utils/properties.py
from anvil.property_utils import (
    get_margin_styles,
    get_padding_styles,
    get_spacing_styles,
    get_unset_margin,
    get_unset_padding,
    get_unset_spacing,
    get_unset_value,
    set_element_margin,
    set_element_padding,
    set_element_spacing,
)

I thought it had to do with the versions of my dependencies, but even after updating all of them to the latest version, I still get the same error.

Thanks in advance :smiley:

1 Like

Moved to bug reports.

The anvil app server gets updates less frequently than anvil.works
And this issue is a result of these being out of sync.

We’ll update you when we’ve pushed a new version of the app server.

5 Likes

Okay thanks for the clarification. Will wait on the update in that case.

i did a little bit of digging, and the attributes on the propert_utils module should have been present since 1.13.1

we’ve bumped the app server to 1.15.0
try upgrading and see if that fixes it

else we’ll do some more digging

@stucork

Okay so I was able to use anvil-app-server 1.13.4 and indeed that error went away. But now I get (from the router module actually):

AttributeError: '_AppInfo' object has no attribute 'get_client_config'

I am using 1.13.4 because I have a Mac M1, and the newer app-server versions are failing.

Docker’s AMD64 images running through Rosetta emulation on Apple Silicon break with newer Java features required by anvil-app-server 1.14.0+ and 1.15.0, so I am limited to version 1.13.4 which uses older, emulation-compatible Java code.

These are the versions I am using
Core:

  • Docker Image: anvilworks/anvil-app-server:1.13.4 (Nov 27, 2024)
  • Python: 3.9.19
  • anvil-app-server: 1.13.4
  • anvil-uplink: 0.5.2

Anvil Dependencies:

  • routing: v0.4.2
  • Material 3 Theme (m3): v1.2.6
  • anvil_extras: v3.6.1

Python Packages:

  • openai: 2.20.0
  • stripe: 14.3.0
  • bcrypt: 5.0.0
  • beautifulsoup4: 4.14.3
  • python-dotenv: 1.2.1

Are there any ARM64/Apple Silicon compatible Docker images for anvil-app-server?

Sounds like another version skew. We can look at the Mac compatibility issue. Thanks for highlighting.

we may have fixed the java error
can you re pull the docker image and try again

@stucork Yes, now I am able to run everything locally. Thanks!

2 Likes