FastUUID
raw JSON → 0.14.0 verified Tue May 12 auth: no python install: verified
FastUUID provides CPython bindings to a Rust UUID library, offering an API that is functionally identical to Python's built-in `uuid` module but with significantly improved performance. It supports UUID versions v1, v3, v4, v5, and v7. The current version is 0.14.0, and it maintains an active development status with regular releases.
pip install fastuuid Common errors
error error: linker `cc` not found ↓
cause fastuuid relies on Rust for its CPython bindings, and compilation requires a C compiler (like `gcc` or `clang`) along with a Rust toolchain if pre-built wheels are not available for your specific platform and Python version.
fix
Install a Rust toolchain (e.g., via
rustup.rs) and a C compiler (e.g., sudo apt-get install build-essential on Debian/Ubuntu, or Xcode Command Line Tools on macOS) in your build environment. Alternatively, ensure you are installing fastuuid in an environment for which pre-built wheels exist. error ValueError: badly formed hexadecimal UUID string ↓
cause fastuuid enforces stricter RFC 4122 compliance when parsing UUID strings compared to Python's built-in `uuid` module. This error occurs when a UUID string does not conform to the expected 36-character format, such as missing hyphens or leading zeros in hexadecimal blocks, or containing non-hexadecimal characters.
fix
Ensure that all UUID strings strictly follow the RFC 4122 format (e.g.,
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx). Validate input UUID strings before passing them to fastuuid.UUID(), or implement error handling for ValueError. error ModuleNotFoundError: No module named 'fastuuid' ↓
cause The 'fastuuid' package is either not installed in the current Python environment, or its installation failed silently, often due to underlying compilation issues with its Rust components.
fix
Install fastuuid using
pip install fastuuid. If the installation appears to succeed but the error persists, check the installation output for any compilation warnings or errors, particularly those related to the Rust toolchain or linker issues mentioned in other common problems. Warnings
breaking Installing `fastuuid` may require a Rust toolchain to be present on the system for compilation into CPython bindings. In environments without Rust (e.g., slim Docker images), `pip install` will fail *unless* pre-built wheels are available for your specific platform and Python version, which can prevent the need for a Rust toolchain. ↓
fix Ensure a Rust toolchain is installed in your build environment, or use pre-built wheels if available for your platform and Python version.
gotcha FastUUID is stricter when parsing hexadecimal representations of UUIDs compared to Python's built-in `uuid` module. This means some malformed UUID strings that might have been accepted by `uuid.UUID()` previously could now raise `ValueError`. ↓
fix Validate UUID strings against RFC 4122 before passing them to `fastuuid.UUID()`, or implement error handling for `ValueError` during parsing.
gotcha There are multiple projects named 'fastuuid' across different languages (e.g., Go, other Rust implementations). The Python `fastuuid` library (`fastuuid/fastuuid` on GitHub) specifically aims for API compatibility with Python's standard `uuid` module and RFC 4122 compliance, supporting v1, v3, v4, v5, and v7. Other 'fastuuid' projects, especially in Go or older Rust versions, might have different characteristics, such as generating 192-bit non-RFC compliant or 'guessable' UUIDs. ↓
fix Verify that you are using the correct Python `fastuuid` package when comparing or migrating from other 'fastuuid' implementations to ensure expected behavior and UUID standard compliance.
gotcha While `fastuuid.uuid4_bulk()` explicitly releases the Global Interpreter Lock (GIL) for performance when generating many UUIDs, individual calls to functions like `fastuuid.uuid4()` are not explicitly stated to release the GIL. For highly concurrent scenarios generating single UUIDs, performance benefits might be limited if the GIL is held. ↓
fix For high-throughput single UUID generation in multi-threaded Python applications, consider using `uuid4_bulk()` to generate a batch and then consuming from the batch, or benchmark individual generation calls in your specific use case.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) wheel - 0.00s 18.8M
3.10 alpine (musl) - - 0.00s 18.8M
3.10 slim (glibc) wheel 1.5s 0.00s 19M
3.10 slim (glibc) - - 0.00s 19M
3.11 alpine (musl) wheel - 0.00s 20.6M
3.11 alpine (musl) - - 0.00s 20.6M
3.11 slim (glibc) wheel 1.5s 0.00s 21M
3.11 slim (glibc) - - 0.00s 21M
3.12 alpine (musl) wheel - 0.00s 12.5M
3.12 alpine (musl) - - 0.00s 12.5M
3.12 slim (glibc) wheel 1.4s 0.00s 13M
3.12 slim (glibc) - - 0.00s 13M
3.13 alpine (musl) wheel - 0.00s 12.3M
3.13 alpine (musl) - - 0.00s 12.1M
3.13 slim (glibc) wheel 1.5s 0.00s 12M
3.13 slim (glibc) - - 0.00s 12M
3.9 alpine (musl) wheel - 0.00s 18.3M
3.9 alpine (musl) - - 0.00s 18.3M
3.9 slim (glibc) wheel 1.8s 0.00s 18M
3.9 slim (glibc) - - 0.00s 18M
Imports
- UUID
from fastuuid import UUID - uuid1
from fastuuid import uuid1 - uuid3
from fastuuid import uuid3 - uuid4
from fastuuid import uuid4 - uuid5
from fastuuid import uuid5 - uuid7
from fastuuid import uuid7
Quickstart last tested: 2026-04-24
from fastuuid import uuid4, UUID, uuid4_bulk
# Generate a UUID v4
new_uuid = uuid4()
print(f"Generated UUID v4: {new_uuid}")
# Create a UUID from a string
existing_uuid_str = "12345678-1234-5678-1234-567812345678"
try:
parsed_uuid = UUID(existing_uuid_str)
print(f"Parsed UUID: {parsed_uuid}")
except ValueError as e:
print(f"Error parsing UUID: {e}")
# Generate multiple UUID v4s efficiently (releases GIL)
bulk_uuids = uuid4_bulk(100)
print(f"Generated {len(bulk_uuids)} UUIDs in bulk. First one: {bulk_uuids[0]}")