Rate This Document
Findability
Accuracy
Completeness
Readability

Installation by Compiling Source Code

Obtain the Safetensors source code, build a wheel from the source code, and install the build product.

  1. 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.

  2. 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.
    1
    safetensors-0.7.0-cp38-abi3-linux_aarch64.whl
    
  3. Install the local build product.
    1
    python3 -m pip install --no-index --find-links /tmp/safetensors-build/dist safetensors==0.7.0