Installation by Compiling Source Code
Obtain the Safetensors source code, build a wheel from the source code, and install the build product.
- Obtain the Safetensors 0.7.0 source code.
1 2 3
mkdir -p /tmp/safetensors-build/dist python3 -m pip download --no-build-isolation --no-binary=:all: --no-deps \ --dest /tmp/safetensors-build safetensors==0.7.0
--no-binary=:all: is used to disable the download of the precompiled wheel and ensure that the source package is obtained and local build is performed.
- Build the wheel from the source package.
1 2 3
python3 -m pip wheel --no-build-isolation --no-binary=:all: --no-deps \ --wheel-dir /tmp/safetensors-build/dist \ /tmp/safetensors-build/safetensors-0.7.0.tar.gz
The following is an example of the build product.1safetensors-0.7.0-cp38-abi3-linux_aarch64.whl
- Install the local build product.
1python3 -m pip install --no-index --find-links /tmp/safetensors-build/dist safetensors==0.7.0
Parent topic: Developer Guide