Skip to content

Guide · Open source

How to use tweepy: install and work with the Twitter API in Python

Updated · written with AI from the project's own documentation and checked against our catalogue data

Tweepy is a Python library that wraps the Twitter API, so your Python code can read and interact with Twitter data without you building raw web requests by hand. This guide is for Python developers who want to write scripts or applications that work with tweets and accounts. By the end you will know how to install tweepy, what you need before you start, and where to find the detailed documentation.

Tweepytweepy/tweepy · ★ 11.2k · MIT

Quick start

  1. 1Check your Python setup. Confirm you have a currently supported version of Python and pip available on your system.
  2. 2Install tweepy. Run pip install tweepy to install the latest version from PyPI.
  3. 3Install async support if needed. If you plan to use the tweepy.asynchronous subpackage, run pip install tweepy[async] instead.
  4. 4Get Twitter API access. Set up an account with Twitter's API, since access is governed by Twitter and the README links to its documentation.
  5. 5Read the documentation. Open the tweepy documentation linked from the README and follow it to make your first API call from Python.

What tweepy is and who it is for

Tweepy is a code library, not a ready-made app. You use it inside your own Python programs to access the Twitter API. Developers use it to write scripts or applications that work with tweets and accounts.

It suits people building bots or scripts that read or post on Twitter/X, and developers who want an async option through the tweepy.asynchronous subpackage. It is not a good fit if you need a language other than Python, since the library is Python-only.

What you need before you install tweepy

You need Python and pip. The README says the latest version of Python and older versions that are not end of life (bugfix and security) are supported. It does not name a specific minimum version, so check the documentation or the PyPI page for current details.

Tweepy talks to the Twitter API, and access is governed by Twitter. The README links to Twitter's own API documentation. If you do not have an API account, tweepy alone will not give you access to Twitter data.

  • Python (a currently supported version)
  • pip, the Python package installer
  • A Twitter API account, if you want to make real API calls

Install tweepy with pip

The easiest way to install the latest version from PyPI is with pip. If you want to use the tweepy.asynchronous subpackage, install with the async extra instead.

The README also describes cloning the repository from GitHub or installing directly from the GitHub URL to get the development version.

pip install tweepy pip install tweepy[async]

Find the documentation and examples

The README is brief and mainly covers installation. For usage details, follow the links to the official documentation, which is hosted on Read the Docs. The project also has an official Discord server linked from the README.

The README does not include code examples, so the documentation is where you should look for how to call the API from your code.

  • Documentation: tweepy.readthedocs.io (linked from the README)
  • Official Discord server (linked from the README)
  • Twitter API Documentation: developer.twitter.com (linked from the README)

Compare tweepy with similar projects

Other Python projects in this space include python-twitter, snscrape and twikit. They are different tools, so compare them on the features you need, the Twitter access method each uses, and how well each is maintained.

Tweepy's distinguishing points, based on the README, are its Python-only focus, its wrapper around the Twitter API, and its optional async support.

What people use it for

  • Writing a Python script that reads tweets or account data from the Twitter API
  • Building a bot that posts on Twitter/X from your own code
  • Creating an application with async code using the tweepy.asynchronous subpackage

Frequently asked questions

How do I install tweepy?

Run pip install tweepy in your terminal to install the latest version from PyPI. If you want the tweepy.asynchronous subpackage, run pip install tweepy[async] instead.

Is tweepy free?

Tweepy is released under the MIT licence, which is stated in the project details. The library itself is open source, but access to the Twitter API is governed by Twitter, so check Twitter's own terms for API access.

What Python version does tweepy need?

The README says the latest version of Python and older versions that are not end of life are supported. It does not state a specific minimum version, so check the documentation for current details.

Do I need a Twitter API account to use tweepy?

Yes, for real API access. The README links to Twitter's API documentation, and access is governed by Twitter. Tweepy is a wrapper, so it cannot give you Twitter data on its own.

What are the alternatives to tweepy?

The comparable projects listed are python-twitter, snscrape and twikit. Each works differently, so compare them on the features you need and how each one accesses Twitter.

Can I use tweepy without writing code?

No. Tweepy is a Python code library. If you need a ready-made app, it is not the right tool.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Tweepy is a good choice for Python developers who want to call the Twitter API from their own scripts, bots or apps, including async code via the tweepy.asynchronous subpackage. It is not suitable for non-programmers, for projects that need a language other than Python, or for anyone without Twitter API access.

Install options & downloads