Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring a Python Environment

To facilitate the access to TVM using Python, build a Python virtual environment. Python 3.7 or 3.8 is recommended. Python 3.9 is not supported yet.

  1. Obtain the Anaconda installation package by following instructions in OS and Software Requirements.
    1
    wget https://repo.anaconda.com/archive/Anaconda3-2024.10-1-Linux-aarch64.sh
    
  2. Run the installation script and complete the installation and initialization as prompted.
    1
    bash Anaconda3-2024.10-1-Linux-aarch64.sh
    
  3. Reactivate the shell.
    1
    source ~/.bashrc
    
  4. Check whether Anaconda is successfully installed. If Anaconda is successfully installed, the installed package is displayed in the command output.
    1
    conda list
    
  5. Use conda to build a Python 3.7 virtual environment and activate it.
    1
    2
    conda create -n tvm python=3.7
    conda activate tvm
    
  6. Configure the PIP source. Open or create the ~/.pip/pip.conf file and add the following content:
    1
    2
    [global]
    index-url = https://mirrors.huaweicloud.com/repository/pypi/simple/
    
  7. Create the requirements.txt file to specify the Python dependencies to be installed.
    numpy==1.19.2
    decorator
    attrs
    typing-extensions
    psutil
    scipy
    tornado
    xgboost==1.5.0
    pybind11
    cython==0.29.32
    pythran
    cloudpickle
    synr==0.6.0
    pytest 
    junitparser 
    onnx
  8. Install the software packages specified in the requirements.txt file.
    1
    pip install -r requirements.txt