Installation

The library can be run at Linux, Windows, MacOS, and EulerOS, etc. It is easy to install XuanCe.

Before installing XuanCe, you should install Anaconda to prepare a python environment (recommend).

After that, open a terminal and install XuanCe by the following steps. You can choose two ways to install XuanCe.

Attention

XuanCe can be installed on MacOS and be compatible with both Intel and Apple’s M CPUs.



Install via PyPI

Step 1: Create a new conda environment (python>=3.7 is suggested).

conda create -n xuance_env python=3.7

Step 2: Activate conda environment.

conda activate xuance_env

Step 3: Install the library.

pip install xuance

Install from GitHub repository

Alternatively, you can install XuanCe from its GitHub repository.

Note

Note: The steps 1-2 are the same as above.

Step 1: Create a new conda environment (python>=3.7 is suggested).

conda create -n xuance_env python=3.7

Step 2: Activate conda environment.

conda activate xuance_env

Step 3: Download the source code of XuanCe from GitHub.

git clone https://github.com/agi-brain/xuance.git

Step 4: Change directory to the xuance.

cd xuance

Step 5: Install xuance.

pip install -e .

Note

Note: Some extra packages should be installed manually for further usage.

Tip

If your IP address is in Chinese mainland, you can install it with a mirror image to speed up the installation, for example, you can choose one of the following commands to finish installation.

pip install xuance -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install xuance -i https://pypi.mirrors.ustc.edu.cn/simple
pip install xuance -i http://mirrors.aliyun.com/pypi/simple/
pip install xuance -i http://pypi.douban.com/simple/

Tip

During the installation of XuanCe, you might encount the following error:

Error: Failed to building wheel for mpi4py
Failed to build mpi4py
ERROR: Could not build wheels for mpi4py, which is required to install pyproject.toml-based projects

Solution 1: You can solve that issue by install mpi4py manually via

conda install mpi4py

Solution 2: If that doesn’t work, you can type and install gcc_linux-64 via:

conda install gcc_linux-64

And then, retype the installation command for mpi4py via pip:

pip install mpi4py


Testing whether the installation was successful

After installing XuanCe, you can enter the Python runtime environment by typing “python” in the terminal. Then, test the installation of xuance by typing:

import xuance

If no error or warning messages are displayed, it indicates that XuanCe has been successfully installed. You can proceed to the next step and start using it.