Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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,

like image 874
Kohei TAMURA Avatar asked May 10 '18 05:05

Kohei TAMURA


1 Answers

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.
like image 75
hoefling Avatar answered Sep 30 '22 15:09

hoefling