Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cross-platform Pipenv.lock?

See original GitHub issue

I am creating a cross-platform Python app.

While trying to build the app on Windows and Linux I noticed that Pipenv.lock is platform-specific.

For example, I create a project on Windows and add pytest, it has colorama with "markers": "sys_platform == 'win32'" in the lock file. But when modifying the lock file on Linux, such as adding a new lib (pipenv install hello-world), this dependency will disappear.

diff ../py-win/Pipfile.lock Pipfile.lock 
<             "sha256": "828b8ad012f4c8773e6e61e3ac2be0ffcd7540fd7ed175a8355676c8e31c4d3d"
>             "sha256": "c4a1bdfad8e2d208344003d9c704432100fbcb9bd87f713178895637222767a4"
<         "colorama": {
>         "hello-world": {
<                 "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d",
<                 "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"
>                 "sha256:f236ab36224613dff8db190dc4a02b3787c3d19e95f7e0876e3098966118bc1e"
<             "markers": "sys_platform == 'win32'",
<             "version": "==0.4.1"
>             "index": "pypi",
>             "version": "==0.2"

Here is the full output on both systems:

Is it supposed to work like that? If yes, what is the best way to handle that for cross-platform apps? Is there any better solution than just committing lock files for all platforms to the Git repo (such as Pipenv-win.lock, Pipenv-linux.lock) and renaming one of them to Pipenv.lock when building?

Pipenv version: '2018.11.26'

Pipenv location: 'C:\\Users\\user\\AppData\\Roaming\\Python\\Python37\\site-packages\\pipenv'

Python location: 'c:\\python37\\python.exe'

Python installations found:

  • 3.7.3: C:\Python37\python.exe

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.3',
 'os_name': 'nt',
 'platform_machine': 'AMD64',
 'platform_python_implementation': 'CPython',
 'platform_release': '10',
 'platform_system': 'Windows',
 'platform_version': '10.0.17763',
 'python_full_version': '3.7.3',
 'python_version': '3.7',
 'sys_platform': 'win32'}

Pipenv version: '2018.11.26'

Pipenv location: '/home/alex/.local/lib/python3.7/site-packages/pipenv'

Python location: '/usr/bin/python3'

Python installations found:

  • 3.7.3: /usr/bin/python3.7
  • 3.7.3: /usr/bin/python3.7m
  • 2.7.16: /usr/bin/python

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.3',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.0.0-21-generic',
 'platform_system': 'Linux',
 'platform_version': '#22+system76-Ubuntu SMP Tue Jul 16 19:57:52 UTC 2019',
 'python_full_version': '3.7.3',
 'python_version': '3.7',
 'sys_platform': 'linux'}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

AlexP11223commented, Sep 10, 2019

I mean that it should be the default behavior (otherwise someone will forget to add it sooner or later), not hidden under some switch with an unrelated name (which probably does more than just keeping dependencies marked as for other platforms).

jamesstidardcommented, Mar 24, 2021

For anyone that may have initially thought to use --keep-outdated as I did and doing a pipenv install --dev --keep-outdated pytest this will not reinstall and capture the pytest dependancies for that platform. Instead, you can used it with the lock command and get all the platform specific dependancies for your whole project:

pipenv lock --keep-outdated

Probably most people read it that way to begin with, but not I, for whatever reason.

Maybe worth scanning your the diff of your Pipfile.lock though, to make sure no unexpected versions get changed or removed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cross platform Pipenv.lock - python - Stack Overflow
I have a "cross-platform" Pipfile.lock file in my repo, i.e. have entries such as ... However, if I pipenv install a new package...
Read more >
Advanced Usage of Pipenv - Read the Docs
Dependencies of wheels provided in a Pipfile will not be captured by $ pipenv lock . There are some known issues with using...
Read more >
It took me a while to learn to love pipenv. It also bothers me ...
iirc Poetry does have cross-platform lock files and a coherent story. I'm just blocked on some PRs due to the original author getting...
Read more >
Common Pipenv Errors and How to Solve Them: Why Won't it ...
Now let's look at some other error messages that populated the console when locking failed. Notice the suggestion pipenv install --skip-lock .
Read more >
pipenv Documentation - Read the Docs
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version when pyenv is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found