Number of installations statistics for PyPI packages?

Question:

I’ve got a couple of packages on the Python Package Index (PyPI) now. Is there any way to get hold of statistics as to how many times they have been downloaded (either manually or via easy_install or pip?

Or, alternatively, how many views the main package page has received?

Asked By: robintw

||

Answers:

UPDATE 2: it’s back! There’s now a “Downloads (All Versions)” just after the list of downloads (below the user-supplied docs).

announcement at http://mail.python.org/pipermail/distutils-sig/2013-June/021344.html – it’s currently daily counts; weeks and months will be added as they become available. but, curiously, no total.

UPDATE: this no longer works (the info is not displayed) – see http://mail.python.org/pipermail/distutils-sig/2013-May/020855.html (unfortunately this affects the other answer too).

maybe i’m misunderstanding (sorry) but i think this is on the pypi main page for your project!

see updates above for latest details (i’ve deleted info below that’s no longer correct).

Answered By: andrew cooke

There are at least two packages that help with this: pypstats and vanity. Vanity is very easy to use from the command line:

vanity numpy 

and you’ll get a printout to your console.

Answered By: pastephens

Pip statistics is not available on pypi.python.org website and vanity package does not work as well.

Today you can get pip statistics only through this dataset in BigQuery: https://bigquery.cloud.google.com/dataset/the-psf:pypi

Query example for https://pypi.python.org/pypi/dvc package:

SELECT
  details.system.name,
  COUNT(*) as download_count,
FROM
  TABLE_DATE_RANGE(
    [the-psf:pypi.downloads],
    DATE_ADD(CURRENT_TIMESTAMP(), -31, "day"),
    DATE_ADD(CURRENT_TIMESTAMP(), -1, "day")
  )
WHERE
  file.project = 'dvc'
GROUP BY details.system.name

Please note, some of the download signals are generated by monitoring tools and should not be counted as user’s downloads. For example, you should exclude null values from the output:

Row details_system_name download_count   
1   Darwin  1111     
2   null    10000    
3   Windows 222  
4   Linux   3333     
Answered By: Dmitry Petrov

There is a site which I found: https://pypistats.org/packages/py3-pinterest

They track downloads but only for 1 day, 1 week and 1 month. @Dmitry Petrov’s answer is better though.

Answered By: Borislav Stoilov

If you like to filter the data and check all downloads per installer run:

SELECT
  details.installer.name,
  COUNT(*) as download_count,
FROM `the-psf.pypi.downloads*`
WHERE
file.project = 'dvc'
AND _TABLE_SUFFIX
BETWEEN FORMAT_DATE('%Y%m%d', DATE('2020-01-04'))
AND FORMAT_DATE('%Y%m%d', DATE('2020-02-04'))
GROUP BY details.installer.name

So you should see all the installers for e.g:
enter image description here

For more information check useful-queries

Answered By: Zoran Pandovski

You can now use the pypistats website to check your statistics.

For the pytest package: https://pypistats.org/packages/pytest

The figures are coherent with the bigquery’s ones. For instance for day 13-04: 501685 downloads without mirror.

Using request :

#standardSQL
SELECT
  COUNT(*) AS num_downloads,
  SUBSTR(_TABLE_SUFFIX, 7, 8) AS `day`
FROM `the-psf.pypi.downloads*`
WHERE file.project = 'pytest'
  AND _TABLE_SUFFIX
    BETWEEN FORMAT_DATE(
      '%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 10 DAY))
    AND FORMAT_DATE('%Y%m%d', CURRENT_DATE())
GROUP BY `day`
ORDER BY `day`
Answered By: BlueSheepToken

I have tried the different methods in the other answers. As far as I am concerned, vanity does not work anymore, the reason is here. Pip statistics are not available on pypi.python.org website, the reason is mention in the Python Packaging Guide together with a detailed guide on how you can analyze PyPI download using Google Big Query (summarized below in this answer).

There are 2 methods which are still available.

PyPIstats.org

First method is easier than the second one but seems less reliable as it sometimes returns 429 RATE LIMIT EXCEEDED

  1. Go to pypistats.org;
  2. search the package name;
  3. get the statistics of its download. The following figure is the results of numpy. enter image description here

Google Big Query

Second method is Google Big Query, recommended by PiPy officially.

  1. Go to https://bigquery.cloud.google.com/dataset/the-psf:pypi
  2. Copy the following code into the editor window.
SELECT
  details.installer.name,
  COUNT(*) as download_count,
FROM `the-psf.pypi.downloads*`
WHERE
file.project = 'dvc'
AND _TABLE_SUFFIX
BETWEEN FORMAT_DATE('%Y%m%d', DATE('2020-01-04'))
AND FORMAT_DATE('%Y%m%d', DATE('2020-02-04'))
GROUP BY details.installer.name
  1. Click run button, get the results. The following 2 figures show the code and results of numpy.
    code results

Please noter that the second method requires you have a google cloud account, and require you to provide your credict card information, and has limited query times every day. So I personally recommend the first method.

Answered By: Jingnan Jia

you can use this website for statistics – https://pypistats.org/

if you want to use it in a script you can use the api –

https://pypistats.org/api/packages/{package_name}/recent

Answered By: Tal Folkman

https://pepy.tech/ will show information on the number of downloads and trends over time.

enter image description here

Answered By: joelostblom

I came across https://www.piwheels.org which shows how many downloads a PyPi library has had. Just add the library you are checking to the end of this url e.g. numpy

https://www.piwheels.org/project/numpy/

enter image description here

Answered By: Christopher
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.