All Products
Search
Document Center

Object Storage Service:Error: "No module named oss2" when using Python with OSS

Last Updated:Mar 20, 2026
Important

This article may be contributed by a community or involve information about third-party products. For help and support, visit the official website of the relevant community or third-party product. Third-party products are not covered by Alibaba Cloud after-sales support. This article is for reference only.

If you run a Python script that uploads or downloads objects in Object Storage Service (OSS) and receive No module named oss2, the OSS SDK for Python (oss2 package) is not installed in your environment. Install it with pip.

Prerequisites

Before you begin, ensure that you have:

  • Python installed

  • pip available in your environment

Install the OSS SDK for Python

Run the following commands in sequence on Linux:

sudo yum install -y python-devel
sudo yum install -y epel-release
sudo yum install -y python-pip
pip install oss2

Verify the installation

After installation, confirm that your Python script file can be run normally.