Being a Python library, Pyrogram requires Python to be installed in your system. We recommend using the latest version of Python 3 and pip.
Pyrogram supports Python 3 only, starting from version 3.4. PyPy is supported too.
The easiest way to install and upgrade Pyrogram to its latest stable version is by using pip:
$ pip3 install --upgrade pyrogram
or, with TgCrypto as extra requirement (recommended):
$ pip3 install --upgrade pyrogram[fast]
If you want the latest development version of Pyrogram, you can install it straight from the develop branch using this command (you might need to install git first):
$ pip3 install --upgrade git+https://github.com/pyrogram/pyrogram.git
Pyrogram heavily depends on IO-bound network code (it’s a cloud-based messaging client library after all), and here’s where asyncio shines the most by providing extra performance while running on a single OS-level thread only.
A fully asynchronous variant of Pyrogram is therefore available (Python 3.5+ required). Use this command to install:
$ pip3 install --upgrade git+https://github.com/pyrogram/[email protected]
Pyrogram API remains the same and features are kept up to date from the non-async, default develop branch, but you are obviously required Python asyncio knowledge in order to take full advantage of it.
The idea to turn Pyrogram fully asynchronous is still under consideration, but is wise to expect that in future this would be the one and only way to work with Pyrogram.
You can start using Pyrogram Async variant right now as an excuse to learn more about asynchronous programming and do experiments with it!
Subscribe to @Pyrogram for news and announcements
To verify that Pyrogram is correctly installed, open a Python shell and import it. If no error shows up you are good to go.
>>> import pyrogram >>> pyrogram.__version__ '0.9.3'