Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Systemcluster opened this issue Sep 11, 2020 · 5 comments

Comments

@Systemcluster
Copy link

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.

@frostming
Copy link
Contributor

Lock the dependencies on non-windows platforms.

--keep-outdated exists so that the transient dependencies won't get removed if the lock file is regenerated on Windows.

@Systemcluster
Copy link
Author

That's a workaround but not a great solution. If you have windows-only and linux-only dependencies, you would always have to run pipenv update on two different systems to get an up-to-date lockfile.

Also, in my case, I develop a cross-platform application but currently only have access to a Windows system. I only noticed this behavior when a user notified me that a dependency was missing. I worked around this by specifying the sub-dependency directly in the Pipfile, but that's not a great solution either.

@frostming
Copy link
Contributor

See my explanation in #4451 #4451 (comment)

Basically, it is hard to make cross-platform dependency resolution work without failures.

@frostming
Copy link
Contributor

Also I would like to close this due to the duplication

@Systemcluster
Copy link
Author

Ah, I completely missed that existing issue, apologies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants