"Could not find a version that satisfies the requirement" error for Django2 app installation

11,741

Solution 1

I can fix my problem by adding options:

--proxy=http://[proxy_user_id]:[proxy_user_password]@[proxy_host]:[proxy_port]/ --trusted-host pypi.python.org  --trusted-host pypi.org  --trusted-host files.pythonhosted.org

to pip install.

Solution 2

The package certifi==2018.1.18 was removed from PyPI. The current version is certifi==2018.4.16. The reason for this is that certifi is somewhat special: it is nothing else but a collection of root SSL certificates, so once they become stale and a new version of certifi with new certs is released, the old ones are being deleted for security reasons - so you don't accidentally continue to install and use old and potentially revoked or compromised certificates.

The solution for you is to either drop the exact version requirement alltogether:

setup(
    ...
    install_requires=['certifi'],
    ...
)

or to require a minimal version and (optionally) bump it with new releases of your package:

setup(
    ...
    install_requires=['certifi>=2018.4.16'],
    ...
)

The latter is what I usually use: this way,

  1. you always know a minimum version of the requirement you've tested with (and thus know that your package works fine with it),
  2. if the user happens to have an old version of certifi installed, it will be upgraded automatically to the currently newest one when your package is installed.
Share:
11,741
Kohei TAMURA
Author by

Kohei TAMURA

Software engineer. Working on technical support for OSS, especially OpenAM. GitHub: https://github.com/k-tamura

Updated on August 04, 2022

Comments

  • Kohei TAMURA
    Kohei TAMURA over 1 year

    I'm newbie Python/Django programmer.

    I created an application based on Django 2.0 and packaged it according to the official document. Then I run the command:

    $ pip install --user django-easybuggy-0.1.tar.gz
    

    However, I get the error and cannot install.

    Processing ./django-easybuggy-0.1.tar.gz
    Collecting certifi==2018.1.18 (from django-easybuggy==0.1)
      Could not find a version that satisfies the requirement certifi==2018.1.18 (from django-easybuggy==0.1) (from versions: )
    No matching distribution found for certifi==2018.1.18 (from django-easybuggy==0.1)
    

    Does anyone know the reason why the error occurs and how to fix it?

    In addition, I created requirements.txt by the command:

    $ pip freeze > requirements.txt
    

    Steps to reproduce:

    1. Download my application archive:

      $ wget https://github.com/k-tamura/easybuggy4django/releases/download/0.0.1/django-easybuggy-0.1.tar.gz
      
    2. Run the command:

      $ pip install --user django-easybuggy-0.1.tar.gz
      

    Best regards,

  • Kohei TAMURA
    Kohei TAMURA almost 6 years
    Thank you for your answer. Your answer may be one of the solution of my question but it cannot be applied to my case (vote+1).