anvil-uplink 0.6.0 — AttributeError: ‘NoneType’ object has no attribute ‘get_tracer’ when using Uplink from Google Colab
What I’m trying to do:
I’m running server-callable functions via the Anvil Uplink from a Google Colab notebook. This setup has been working reliably for months.
What changed:
As of today, my code started throwing the following error on every server call. No changes were made to my code — the issue appeared after Google Colab installed anvil-uplink 0.6.0 (previously I was on 0.5.1).
Error:
Exception in thread Thread-5 (make_call):
Traceback (most recent call last):
File "/usr/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
self.run()
File "/usr/lib/python3.12/threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.12/dist-packages/anvil/_threaded_server.py", line 208, in make_call
with ensure_anvil_tracer().start_as_current_span("Make call"):
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/anvil/_threaded_server.py", line 60, in ensure_anvil_tracer
anvil_tracer = get_anvil_tracer_provider().get_tracer(__name__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_tracer'
The error occurs at _threaded_server.py line 60, where get_anvil_tracer_provider() returns None, and the subsequent .get_tracer() call fails.
Environment:
- Google Colab (Python 3.12)
- anvil-uplink 0.6.0 (installed via pip)
- Connecting via
anvil.server.connect()
Workaround:
Pinning to the previous version resolves the issue:
pip install anvil-uplink==0.5.1
It appears that version 0.6.0 introduced OpenTelemetry tracing support, but the tracer provider is not being initialized when running via the Uplink outside of a full Anvil App Server environment (e.g., from Colab, standalone scripts, or Jupyter notebooks).
Hope this helps track down the issue. Happy to provide any additional info if needed.