Search code examples
pythonpipenvpyenv

Pipenv install does not install everything from Pipfile


I am running this on a fresh Ubuntu 20.04 install:

pipenv install with Pipfile:

$ cat Pipfile
[packages]
Django = "*"
django-split-settings = "*"
python-dotenv = "*"
django-compressor = "*"
django-libsass = "*"
Brotli = "*"
django-htmlmin = "*"
gunicorn = "*"
dj-database-url = "*"
wagtail = "*"
wagtail-metadata = "*"
wagtail-blocks = "*"
psycopg2 = "*"
django-tz-detect = "*"
wagtailcodeblock = "*"
django-taggit = "*"
django-taggit-templatetags2 = "*"
django-fontawesome-5 = "*"
django-debug-toolbar = "*"
wagtail-robots = "*"
wand = "*"

[dev-packages]
pylint = "*"
django-debug-toolbar = "*"

[requires]
python_version = "3.7"

[packages.whitenoise]
extras = [ "brotli",]

[packages.django-storages]
extras = [ "dropbox",]

then running:

$ pipenv run pip list
Package         Version
--------------- -------
django-storages 1.9.1
pip             20.2.2
setuptools      49.6.0
wheel           0.35.1
whitenoise      5.2.0

it only installs whitenoise and django-storages for some reason, how can i fix this?

additional information:

$ which python
/home/maks/.local/share/virtualenvs/personal-website-lhNGB4ub/bin/python

$ which pip
/home/maks/.local/share/virtualenvs/personal-website-lhNGB4ub/bin/pip

$ pyenv which python
/home/maks/.pyenv/versions/3.7.8/bin/python

This issue has popped up recently after developing on windows for a while, when it happened I switched to just using a requirements.txt file instead, but now I want to go back to using pipenv.

as far as I can tell it's not a problem with the encoding of the file or the line endings, and I am uncertain as to when/why exactly this started happening.

EDIT: running pipenv install django will install django properly but the pipfile and pipfile.lock remain identical meaning that this is not a problem with the Pipfile


Solution

  • FIX: So what worked was removing the pipfile and manually re-installing each package with pipenv install, this resulted in a slightly different looking pipfile, by the looks of it what caused me this issue, was an update to pipenv itself... have a look:

    old Pipfile:

    [[source]]
    url = "https://pypi.python.org/simple"
    verify_ssl = true
    name = "pypi"
    
    [requires]
    python_version = "3.7"
    
    [packages]
    Django = "*"
    django-split-settings = "*"
    python-dotenv = "*"
    django-compressor = "*"
    django-libsass = "*"
    Brotli = "*"
    django-htmlmin = "*"
    dj-database-url = "*"
    wagtail = "*"
    wagtail-metadata = "*"
    wagtail-blocks = "*"
    psycopg2 = "*"
    django-tz-detect = "*"
    wagtailcodeblock = "*"
    django-taggit = "*"
    django-taggit-templatetags2 = "*"
    django-fontawesome-5 = "*"
    django-debug-toolbar = "*"
    wagtail-robots = "*"
    wand = "*"
    gunicorn = "*"
    
    [dev-packages]
    pylint = "*"
    django-debug-toolbar = "*"
    
    [packages.whitenoise]
    extras = [ "brotli",]
    
    [packages.django-storages]
    extras = [ "dropbox",]
    
    

    after manually re-installing each package on fresh environment:

    [[source]]
    name = "pypi"
    url = "https://pypi.org/simple"
    verify_ssl = true
    
    [dev-packages]
    pylint = "*"
    django-debug-toolbar = "*"
    
    [packages]
    django = "*"
    django-split-settings = "*"
    python-dotenv = "*"
    django-compressor = "*"
    django-libsass = "*"
    brotli = "*"
    django-htmlmin = "*"
    dj-database-url = "*"
    wagtail = "*"
    wagtail-metadata = "*"
    wagtail-blocks = "*"
    django-tz-detect = "*"
    wagtailcodeblock = "*"
    django-taggit = "*"
    django-taggit-templatetags2 = "*"
    django-fontawesome-5 = "*"
    django-debug-toolbar = "*"
    wagtail-robots = "*"
    wand = "*"
    whitenoise = {extras = ["brotli"], version = "*"}
    django-storages = {extras = ["dropbox"], version = "*"}
    gunicorn = "*"
    
    [requires]
    python_version = "3.7"
    
    

    Installing from this pipfile using pipenv install worked fine, and all packages were installed.

    I am not exactly sure why this all happened, perhaps it's a bug in pipenv, or maybe there is no backward-compatibility. If anyone knows please let me know.

    If you want to fix this without reinstalling every package, you can simply replace bits looking like this:

    [packages.whitenoise]
    extras = [ "brotli",]
    

    and convert them to this format:

    whitenoise = {extras = ["brotli"], version = "*"}
    

    after doing that run pipenv install and all your dependencies will be installed correctly

    I submitted an issue on the Pipenv repository: https://github.com/pypa/pipenv/issues/4433