Sentence embedding projects need a Python environment that can load pretrained embedding and reranking models before application code calls them. Sentence Transformers ships as the sentence-transformers package on PyPI, so pip is the direct install path for a project virtual environment or another interpreter that owns the application dependencies.

The package depends on PyTorch and Transformers. On Linux, a plain PyPI torch install can select wheels that include CUDA runtime packages, so CPU-only projects can install the CPU PyTorch wheel first and then let sentence-transformers reuse it.

The default package covers text model loading, saving, and inference. Optional extras add image, audio, video, training, ONNX, OpenVINO, or development dependencies, so add an extra only for the feature the project will run.

Steps to install Sentence Transformers with pip:

  1. Activate the Python environment that should receive the package.
    $ source .venv/bin/activate

    Use a project virtual environment when possible. On Windows, activate the environment with .\.venv\Scripts\activate or run the same install through the selected py launcher.

  2. Confirm that pip belongs to the active environment.
    (.venv) $ python -m pip --version
    pip 25.1.1 from /srv/apps/semantic-search/.venv/lib/python3.14/site-packages/pip (python 3.14)

    The path after from should point inside the intended virtual environment or interpreter prefix before packages are installed.

  3. Install the CPU PyTorch wheel first when the project does not need CUDA acceleration.
    (.venv) $ python -m pip install --upgrade torch --index-url https://download.pytorch.org/whl/cpu
    Looking in indexes: https://download.pytorch.org/whl/cpu
    Collecting torch
    ##### snipped #####
    Successfully installed torch-2.12.1+cpu typing-extensions-4.15.0

    Skip this step when a matching CUDA, ROCm, or Apple Metal PyTorch runtime is already installed. For NVIDIA CUDA, use the wheel command from the PyTorch selector instead of the CPU index.
    Related: Enable PyTorch CUDA support

  4. Install Sentence Transformers from PyPI in the same environment.
    (.venv) $ python -m pip install --upgrade sentence-transformers
    Collecting sentence-transformers
    Requirement already satisfied: torch>=1.11.0 in ./.venv/lib/python3.14/site-packages (from sentence-transformers) (2.12.1+cpu)
    ##### snipped #####
    Successfully installed sentence-transformers-5.6.0 transformers-5.12.1

    Use quoted extras only when the project needs them, such as sentence-transformers[image], sentence-transformers[audio], sentence-transformers[video], sentence-transformers[train], sentence-transformers[onnx], sentence-transformers[onnx-gpu], or sentence-transformers[openvino].

  5. Show the installed package metadata.
    (.venv) $ python -m pip show sentence-transformers
    Name: sentence-transformers
    Version: 5.6.0
    Summary: Embeddings, Retrieval, and Reranking
    Location: /srv/apps/semantic-search/.venv/lib/python3.14/site-packages

    The exact version changes as newer compatible releases appear on PyPI. The Location line should remain inside the selected environment.

  6. Check the installed dependency metadata.
    (.venv) $ python -m pip check
    No broken requirements found.
  7. Import the package and print the installed version.
    (.venv) $ python -c "import sentence_transformers; print(sentence_transformers.__version__)"
    5.6.0

    The command should print a version without a traceback.