{"id":23887,"library":"injective-py","title":"Injective Python SDK","description":"Official Python SDK for interacting with the Injective blockchain. Provides exchange API client, protobuf definitions, and utilities for trading, governance, staking, and more. Current version: 1.14.1. Release cadence: irregular, roughly monthly.","status":"active","version":"1.14.1","language":"python","source_language":"en","source_url":"https://github.com/InjectiveLabs/sdk-python","tags":["injective","blockchain","sdk","defi","trading"],"install":[{"cmd":"pip install injective-py","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"Package name is 'injective' not 'injective_py'","wrong":"from injective_py.client import InjectiveClient","symbol":"InjectiveClient","correct":"from injective.client import InjectiveClient"},{"note":"Network enum is in injective.constant","wrong":"from injective.common import Network","symbol":"Network","correct":"from injective.constant import Network"},{"note":"Exact path includes chain_api submodule","wrong":"from injective.grpc import ChainGrpcAuthApi","symbol":"ChainGrpcAuthApi","correct":"from injective.grpc.chain_api import ChainGrpcAuthApi"}],"quickstart":{"code":"import os\nfrom injective.client import InjectiveClient\nfrom injective.constant import Network\nfrom injective.utils.localTerra import LocalTerra\n\n# Using LocalTerra for testing, no real funds needed\nclient = InjectiveClient(\n    network=Network.testnet(),\n    insecure=True,\n)\nprint(\"Connected to Injective testnet\")\n# Example: get account info (requires a private key or mnemonic for authenticated actions)\n# private_key = os.environ.get('INJECTIVE_PRIVATE_KEY', '')\n# client.set_private_key(private_key)\n# acc = client.get_account()\n# print(acc)","lang":"python","description":"Initializes an Injective client on testnet. For authenticated operations, set a private key via environment variable."},"warnings":[{"fix":"Use 'insecure=False' for mainnet and provide proper credentials.","message":"The default 'insecure=True' connects via gRPC without TLS. Use only on testnet; for mainnet set 'insecure=False'.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure your generated transaction types match the new proto definitions or pin to 'injective-py<1.14.0' if upgrading breaks.","message":"Version 1.14.0 bumped protobuf dependency to match Injective Core v1.19.0. Older transaction messages may be incompatible.","severity":"breaking","affected_versions":">=1.14.0"},{"fix":"Use Python 3.10-3.14 for v1.14+. For Python 3.9, stay on v1.13.1 (pip install injective-py==1.13.1).","message":"Python version constraint is <3.15 >=3.10. Installing on Python 3.9 or 3.15+ will fail unless using a compatible version (e.g., 1.13.1).","severity":"gotcha","affected_versions":">=1.14.0"},{"fix":"Consider using a testnet mnemonic and Network.testnet() instead.","message":"The 'LocalTerra' utility is intended for testing and may not be maintained in future releases.","severity":"deprecated","affected_versions":">=1.14.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install injective-py' and verify with 'pip list | grep injective'.","cause":"Installed package with wrong name or not installed at all.","error":"ModuleNotFoundError: No module named 'injective'"},{"fix":"Ensure you have version 1.14.1: 'pip install --upgrade injective-py'. Use correct import: 'from injective.client import InjectiveClient'.","cause":"Outdated version or wrong import path.","error":"AttributeError: module 'injective' has no attribute 'client'"},{"fix":"Change to 'insecure=False' and provide valid certificates or use a testnet network.","cause":"Set 'insecure=True' on mainnet, which requires TLS.","error":"RuntimeError: insecure connection rejected. Use secure connection for this network."},{"fix":"Call 'client.set_private_key(private_key_hex)' or set mnemonic via 'client.set_from_mnemonic(mnemonic)' before authenticated requests.","cause":"Private key not set or invalid for the called method.","error":"GrpcServiceError: status = StatusCode.UNAUTHENTICATED debug_error_string = ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}