This guide will walk you through the installation of the InsightFace package on a Windows environment, including the necessary dependencies and configurations.
python -m venv venv
venv\Scripts\activate
pip install "numpy<2"
pip install whls\insightface-0.7.3-cp310-cp310-win_amd64.whl onnx==1.16.1 onnxruntime-gpu==1.19.2- Python: Make sure you have Python 3.9 or higher installed on your system.
- Desktop Development with C++: This can be installed via Visual Studio Installer to ensure compatibility with the necessary packages.
- Microsoft Visual C++ Redistributable: Download and install the Microsoft Visual C++ Redistributable from the link below:
- 
Install Desktop Development with C++ - Open Visual Studio Installer.
- Install the Desktop Development with C++ workload to ensure compatibility with the required C++ components for packages like ONNX and InsightFace.
 
- 
Set up a Python Virtual Environment Open a terminal or command prompt and navigate to your project directory. Then run the following commands to create and activate a virtual environment: python -m venv venv venv\Scripts\activate This creates a virtual environment named venvand activates it.
- 
Install Required Packages - 
Install NumPy version compatible with ONNX (NumPy 1.x): InsightFace and ONNX currently require NumPy 1.x for compatibility. You can install it with the following command: pip install "numpy<2"
- 
Install InsightFace, ONNX, and ONNXRuntime-GPU: - Download the necessary .whlfiles for InsightFace and the specific version of ONNX/ONNXRuntime-GPU from a trusted source.
- Navigate to the folder containing your .whlfiles or update the path as needed.
 Install them using the following command: pip install -m whls/insightface_<your_version>.whl onnx==1.16.1 onnxruntime-gpu==1.19.2 
- Download the necessary 
 
- 
- 
Verify the Installation After the installation is complete, verify that the packages have been installed successfully by running the following command in the Python REPL: >>> import insightface >>> import onnx >>> import onnxruntime If no errors are encountered, the installation was successful. 
- DLL Load Failure: If you encounter any errors related to DLL loading or missing files, ensure that the Microsoft Visual C++ Redistributable is installed and that your system’s PATH includes the correct Python and library directories.
- NumPy Compatibility Issues: If there are issues related to NumPy, ensure that you have downgraded to numpy<2.
If you do not have a GPU or prefer to run ONNX on the CPU, you can install the CPU-only version of onnxruntime instead of the GPU version:
pip uninstall onnxruntime-gpu
pip install onnxruntime