Skip to content

Sub-dependencies of platform-specific dependencies are not added to the lockfile #4461

@Systemcluster

Description

@Systemcluster

Issue description

When a Pipfile.lock is created (with pipenv lock or pipenv update), sub-dependencies of platform specific dependencies for other platforms (e.g. those with a sys_platform="!='win32'" marker) aren't added.

Users installing the project will then be missing the sub-dependency.

A similar issue was reported under #3902, but the then-proposed solution of pipenv lock --keep-outdated does not change this behavior.

Expected result

I would expect sub-dependencies to be added with the same marker as the main dependency.

Actual result

The sub-dependencies are missing from Pipfile.lock.

Steps to replicate

Create a project with the following Pipfile (adjust the platform marker to exclude your current platform):

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
pyunpack = { version=">=0.2.1", sys_platform="!='win32'" }

Then run pipenv lock. Pipfile.lock now contains pyunpack, but not its dependency easyprocess.


$ pipenv --support

Pipenv version: '2020.8.13'

Pipenv location: 'c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\lib\\site-packages\\pipenv'

Python location: 'c:\\users\\chris\\appdata\\local\\programs\\python\\python38\\python.exe'

Python installations found:

Traceback (most recent call last):
  File "c:\users\chris\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\chris\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Scripts\pipenv.exe\__main__.py", line 7, in <module>
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1236, in invoke
    return Command.invoke(self, ctx)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\Chris\AppData\Local\Programs\Python\Python38\Lib\site-packages\pipenv\vendor\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\chris\appdata\local\programs\python\python38\lib\site-packages\pipenv\cli\command.py", line 139, in cli    get_pipenv_diagnostics()
  File "c:\users\chris\appdata\local\programs\python\python38\lib\site-packages\pipenv\help.py", line 33, in get_pipenv_diagnostics
    python_paths = finder.find_all_python_versions()
  File "c:\users\chris\appdata\local\programs\python\python38\lib\site-packages\pipenv\vendor\pythonfinder\pythonfinder.py", line 328, in find_all_python_versions
    path_list = sorted(versions, key=version_sort, reverse=True)
AttributeError: 'NoneType' object has no attribute 'version_sort'

It seems like pipenv --support still crashes while trying to enumerate the python installations, but I'm reporting this from Python 3.8.5.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions