Installation · Apache SINGA 5.0.0_Chinese Docs Community News API GitHub ›Getting Started Getting Started Installation Software Stack Examples Guides Device Tensor Autograd Optimizer Model ONNX Distributed Training Time Profiling Half Precision Development Download SINGA Build SINGA from Source How to Contribute Code How to Contribute to Documentation How to Prepare a Release Git Workflow EditInstallation 使用 pip 只使用 CPU pip install singa -f http://singa.apache.org/docs/next/wheel-cpu.html --trusted-host singa.apache.org 您可以通过singa==<version>安装特定版本的 SINGA,其中<version>字段应被替换, 例如 5.0.0。可用的 SINGA 版本在链接中列出。 要安装最新的开发版本,请将链接替换为 http://singa.apache.org/docs/next/wheel-cpu-dev.html 使用 CUDA 和 cuDNN 的 GPU pip install singa -f http://singa.apache.org/docs/next/wheel-gpu.html --trusted-host singa.apache.org 您也可以配置 SINGA 版本和 CUDA 版本,比如 s5.0.0+cuda10.2,SINGA 版本和 CUDA 版 本的可用组合在链接中列出。 要安装最新的开发版本,请将链接替换为 http://singa.apache.org/docs/next/wheel-gpu-dev.html 注意:你本地 Python 环境的 Python 版本将被用来寻找相应的 wheel 包。例如,如果你 本地的 Python 是 3.9,那么就会通过 pip 选择在 Python 3.9 上编译的 wheel 包并安装 。事实上,wheel 文件的名称包括 SINGA 版本、CUDA 版本和 Python 版本。因此 ,pip知道要下载和安装哪个 wheel 文件。 参考 setup.py 文件顶部的注释,了解如何构建 wheel 包。 如果运行以下命令没有报错: $ python -c "from singa import tensor" 那么 SINGA 就安装成功了。 使用 Docker 按照说明在你的本地主机上安装 Docker。将您的 用户添加 到docker 组中,以便 在没有sudo的情况下运行 docker 命令。 仅使用 CPU $ docker run -it apache/singa:X.Y.Z-cpu-ubuntu16.04 /bin/bash 要使用 GPU,在安装 Docker 后安装 Nvidia-Docker $ nvidia-docker run -it apache/singa:X.Y.Z-cuda9.0-cudnn7.4.2-ubuntu16.04 /bin/bash 关于 SINGA Docker 镜像(标签)的完整列表,请访 问docker hub site。对于每个 docker 镜像,标签的命名为: version-(cpu|gpu)[-devel] TagDescriptionExample value versionSINGA version'2.0.0-rc0', '2.0.0', '1.2.0' cputhe image cannot run on GPUs'cpu' gputhe image can run on Nvidia GPUs'gpu', or 'cudax.x-cudnnx.x' e.g., 'cuda10.0-cudnn7.3' develindicator for developmentif absent, SINGA Python package is installed for runtime only; if present, the building environment is also created, you can recompile SINGA from source at '/root/singa' OSindicate OS version number'ubuntu16.04', 'ubuntu18.04' 从源码编译 您可以使用本地构建工具或 conda-build 在本地主机操作系统上或在 Docker 容器中从源 代码构建和安装 SINGA。 FAQ Q: from singa import tensor错误 A: 执行下面的命令,检查详细的错误: python -c "from singa import _singa_wrap" # go to the folder of _singa_wrap.so ldd path to _singa_wrap.so python >> import importlib >> importlib.import_module('_singa_wrap') _singa_wrap.so 的文件夹是 ~/miniconda3/lib/python3.10/site-packages/singa。通常情况下,这个错误是由于 依赖的库不匹配或缺失造成的,例如 cuDNN 或 protobuf。解决方法是创建一个新的虚拟 环境,并在该环境中安装 SINGA,例如: conda create -n singa conda activate singa conda install -c nusdbsystem -c conda-forge singa-cpu Q: 使用虚拟环境时,每次安装 SINGA 时,都会重新安装 numpy。但是,当我运 行import numpy时,numpy 没有被使用。 A: 这可能是由PYTHONPATH环境变量引起的,在使用虚拟环境时,应将其设置为空,以 避免与虚拟环境的路径冲突。 Q: 当我在 Mac OS X 中运行 SINGA 时,得到如下错误 "Fatal Python error: PyThreadState_Get: no current thread Abort trap: 6" A: 这个错误通常发生在系统中有多个 Python 版本的时候,例如,操作系统自带的版本 和 Homebrew 安装的版本。SINGA 链接的 Python 必须与 Python 解释器相同。您可以通 过which python来检查解释器 python 版本并通 过otool -L <path to _singa_wrap.so> 检查 SINGA 链接的 Python,如果通过 conda 安装 SINGA,这个问题应该可以解决。 Last updated on 3/24/2025 Software Stack → 使用 pip 使用 Docker 从源码编译 FAQ DocsGetting StartedGuidesAPI ReferenceExamplesDevelopment CommunityUser ShowcaseSINGA HistorySINGA TeamSINGA NewsGitHub apache/singa Follow @ApacheSINGA Apache Software FoundationFoundationLicenseSponsorshipThanksEventsSecurity Copyright © 2026 The Apache Software Foundation. All rights reserved. Apache SINGA, Apache, the Apache feather logo, and the Apache SINGA project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.