Python build is failing with Pipfile.lock and null markers
See original GitHub issueIssue
When try to build a Python serverless project on Vercel, the build is sometimes failing with the following error:
[20:15:35.199] Retrieving list of deployment files...
[20:15:35.473] Previous build caches not available
[20:15:37.624] Downloading 13 deployment files...
[20:15:38.535] Running "vercel build"
[20:15:39.191] Vercel CLI 28.5.3
[20:15:39.361] WARN! Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings
[20:15:39.460] Installing required dependencies...
[20:15:41.462] Failed to run "pipfile2req"
[20:15:41.522] Error: Command failed: /tmp/1d640a54/bin/pipfile2req
[20:15:41.523] Traceback (most recent call last):
[20:15:41.523] File "/tmp/1d640a54/bin/pipfile2req", line 8, in <module>
[20:15:41.523] sys.exit(main())
[20:15:41.523] File "/tmp/1d640a54/pipfile2req/__init__.py", line 112, in main
[20:15:41.523] lines = convert_pipfile_or_lock(
[20:15:41.523] File "/tmp/1d640a54/pipfile2req/__init__.py", line 96, in convert_pipfile_or_lock
[20:15:41.524] lines = [
[20:15:41.524] File "/tmp/1d640a54/pipfile2req/__init__.py", line 97, in <listcomp>
[20:15:41.524] requirement_from_pipfile(name, package, hashes)
[20:15:41.524] File "/tmp/1d640a54/pipfile2req/requirements.py", line 10, in requirement_from_pipfile
[20:15:41.524] return Requirement.parse(name, package).as_line(include_hashes)
[20:15:41.524] File "/tmp/1d640a54/pipfile2req/requirements.py", line 97, in parse
[20:15:41.524] kwargs["markers"] = _merge_markers(markers)
[20:15:41.525] File "/tmp/1d640a54/pipfile2req/requirements.py", line 14, in _merge_markers
[20:15:41.525] result = Marker(markers[0])
[20:15:41.525] File "/tmp/1d640a54/packaging/markers.py", line 278, in __init__
[20:15:41.525] self._markers = _coerce_parse_result(MARKER.parseString(marker))
[20:15:41.525] File "/tmp/1d640a54/pyparsing/core.py", line 1129, in parse_string
[20:15:41.525] instring = instring.expandtabs()
[20:15:41.525] AttributeError: 'NoneType' object has no attribute 'expandtabs'
[20:15:41.525]
[20:15:41.526]
Investigations
Investigation on my part across multiple project with the same error showed the following:
Pipfile.lock
(generated bypipenv
) is containing"markers": null
for some packagespipfile2req
(used by Vercel Python runtime) is trying to parse markers without checking for null values thus failing
Potential solutions
- Submit a PR to
pipfile2req
to fix the behavior - Instead of
pipfile2req
, usepipenv requirements
within Vercel Python runtime to generate therequirements.txt
file
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Should `pipenv lock` be generating a marker of `null ... - GitHub
Issue description A Pipfile.lock is being generated with a marker of null. ... Python build is failing with Pipfile.lock and null markers vercel/vercel#8933....
Read more >How to resolve Python package dependencies with pipenv?
First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again. Alternatively, you can use $ pipenv...
Read more >Build failed using pipenv - Binder - Jupyter Community Forum
I have a notebook available in a git repo here (5d95b). The repository includes both Pipfile and Pipfile.lock which I understand should be ......
Read more >pipenv Documentation
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version ...
Read more >pipenv Documentation - manpages.ubuntu!
Make sure you've got Python & pip Before you go any further, make sure you have ... --deploy This will fail a build...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Issue is fixed starting with
pipenv
version2022.12.17
: https://github.com/pypa/pipenv/releases/tag/v2022.12.17FYI: Renovatebot seems to have picked up the latest version of
pipenv
as null markers are not appearing inPipfile.lock
anymoreOops, thanks for spotting that.