Install & Compatibility
Where this runs
tested against v0.6.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.910 runs
installs and imports cleanly · install 0.0s · import 1.845s · 62.6MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 6.6s · import 1.534s · 66MB
64MB installed
● package 64MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Tron
✓ from tronpy import Tron
✗ from tronpy.tron import Tron
Tron is exposed at package level; submodule import may break.
PrivateKey
✓ from tronpy.keys import PrivateKey
✗ from tronpy.key import PrivateKey
Module is 'keys' (plural).
Contract
✓ from tronpy.contract import Contract
Initialize a Tron client with HTTPProvider (optionally using TRON Grid API key) and fetch latest block number.
from tronpy import Tron
from tronpy.providers import HTTPProvider
client = Tron(provider=HTTPProvider(api_key=os.environ.get('TRONGRID_API_KEY', '')))
# Get latest block number
block = client.get_latest_block_number()
print(f"Latest block: {block}")
Errors
Common errors & fixes
AttributeError: module 'tronpy' has no attribute 'Tron'
Incorrect import path; Tron is not directly under tronpy due to import errors in older versions or when using a different structure.
fixUse `from tronpy import Tron` (correct). Ensure you have installed the latest version.
ImportError: cannot import name 'HTTPProvider' from 'tronpy.providers'
The provider module was renamed or restructured in earlier versions (before 0.3.0).
fixUpgrade tronpy to version 0.3.0 or later. Then `from tronpy.providers import HTTPProvider`.
Upgrade
Version history
0.6.2latest on PyPI · released Jan 8, 2026
Audit
Dependencies
coincurverequiredCryptography for secp256k1 curves (replaced pure-python ecdsa in v0.3.0)
httpxrequiredHTTP client for API calls
cryptographyrequiredUsed for key generation and signing