Install & Compatibility
Where this runs
tested against v0.7.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.380s · 21MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.8s · import 0.342s · 22MB
19MB installed
● package 19MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
lottie
✓ import lottie
✗ from lottie import *
Common mistake: wildcard import clutters namespace
NVector
✓ from lottie.objects.base import NVector
✗ from lottie import NVector
NVector is not in top-level module
Player
✓ from lottie.player import Player
✗ from lottie import Player
Player class moved to submodule in 0.7
export_tgs
✓ from lottie.exporters.tgs import export_tgs
✗ from lottie import export_tgs
export_tgs function not directly exposed
Color
✓ from lottie.objects.base import Color
✗ from lottie import Color
Color not in top-level module
Create a simple red circle animation and export as TGS.
import lottie
from lottie import objects
from lottie.exporters.tgs import export_tgs
# Create a simple animation with a circle
animation = objects.Animation()
layer = objects.ShapeLayer()
animation.add_layer(layer)
# Add a circle shape
shape = objects.ShapeElement()
shape.shape = objects.Ellipse()
shape.shape.position = objects.Point(0.5, 0.5)
shape.shape.size = objects.Point(0.4, 0.4)
layer.add_shape(shape)
# Add a solid fill
fill = objects.Fill()
fill.color = objects.Color(1, 0, 0) # Red
layer.add_shape(fill)
# Export to TGS (Telegram Sticker)
with open('sticker.tgs', 'wb') as f:
export_tgs(animation, f)
print('Done')
Errors
Common errors & fixes
ImportError: cannot import name 'export_tgs' from 'lottie'
export_tgs is in a submodule, not top-level.
fixUse: from lottie.exporters.tgs import export_tgs
AttributeError: module 'lottie' has no attribute 'NVector'
NVector is not directly exposed.
fixUse: from lottie.objects.base import NVector
ValueError: Color values must be in range [0,1]
Using 0-255 integer values for Color.
fixDivide each value by 255: Color(r/255, g/255, b/255).
TypeError: __init__() got an unexpected keyword argument 'position'
Older API used 'position' as argument; now set as attribute.
fixCreate instance then assign: shape.position = objects.Point(...)
Upgrade
Version history
0.7.2latest on PyPI · released May 1, 2025
Audit
Dependencies
No dependency data recorded yet.