Pipenv tries to resolve packages where their markers evaluates to false
See original GitHub issueIssue description
In Pipfile, packages that were expected to become a dependency only if marker expressions evaluates to true, has unexpectedly become a dependecy when markers evaluates to false
Expected result
Packages won’t be resolved and installed under environment where markers evaluates to false.
Actual result
Pipenv tries to resolve those packages
Steps to replicate
OS is Archlinux
mkdir -p ~/temp
cat > ~/temp/Pipfile <<EOF
[packages]
pywin32 = {version = "==227", markers="sys_platform == 'win32'"}
EOF
pipenv install --verbose
python 3.8 and pipenv are installed through Archlinux offical software repositories and its versions are:
% pacman -Qs | grep -E "(/python-pipenv )|(/python )"
local/python 3.8.3-1
local/python-pipenv 2020.6.2-1
Contents of `~/.pip/pip.conf`
[global]
trusted-host = mirrors.aliyun.com
index-url = https://pypi.doubanio.com/simple/
extra-index-url =
https://mirrors.aliyun.com/pypi/simple/
https://pypi.tuna.tsinghua.edu.cn/simple
$ pipenv --support
Pipenv version: '2020.6.2'
Pipenv location: '/usr/lib/python3.8/site-packages/pipenv'
Python location: '/usr/bin/python'
Python installations found:
3.8.3:/usr/bin/python33.8.3:/usr/bin/python3.82.7.18:/usr/bin/python22.7.18:/usr/bin/python2.7
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.8.3',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '5.7.2-arch1-1',
'platform_system': 'Linux',
'platform_version': '#1 SMP PREEMPT Wed, 10 Jun 2020 20:36:24 +0000',
'python_full_version': '3.8.3',
'python_version': '3.8',
'sys_platform': 'linux'}
System environment variables:
INVOCATION_IDSSH_AUTH_SOCKLANGUAGELANGSSH_AGENT_PIDXDG_CURRENT_DESKTOPGRADLE_HOMEANDROID_HOMEWINDOWIDHGCUDA_PATHSESSION_MANAGERQT_IM_MODULEDESKTOP_SESSIONUSERXDG_MENU_PREFIXHOMEOLDPWDQT4_IM_MODULEDBUS_SESSION_BUS_ADDRESSXDG_VTNRXDG_SEATGTK_MODULESXDG_CONFIG_DIRSWINDOWPATHGTK_IM_MODULELC_TYPEVTE_VERSIONJOURNAL_STREAMMAILLOGNAMELOCALEUBUNTU_MENUPROXYXDG_RUNTIME_DIRXMODIFIERSSHELLXDG_SESSION_TYPEPANEL_GDK_CORE_DEVICE_EVENTSXDG_SESSION_IDXDG_DATA_DIRSPATHQT_QPA_PLATFORMTHEMESHLVLPWDXAUTHORITYCOLORTERMXDG_SESSION_CLASSTERMDISPLAYEDITORPAGERLS_COLORSLESS_TERMCAP_mbLESS_TERMCAP_mdLESS_TERMCAP_meLESS_TERMCAP_seLESS_TERMCAP_soLESS_TERMCAP_ueLESS_TERMCAP_usnpm_config_prefixCONDA_EXE_CE_M_CE_CONDACONDA_PYTHON_EXECONDA_SHLVL_PIP_DISABLE_PIP_VERSION_CHECKPYTHONDONTWRITEBYTECODEPIP_SHIMS_BASE_MODULEPIP_PYTHON_PATHPYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH:/home/gnaggnoyil/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/emulator:/opt/android-sdk/build-tools/18.0.1/:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/gnaggnoyil/.dotnet/tools:/home/gnaggnoyil/.npm/node_modules/binSHELL:/bin/zshEDITOR:vimLANG:zh_CN.UTF-8PWD:/home/gnaggnoyil/temp
Contents of Pipfile (‘/home/gnaggnoyil/temp/Pipfile’):
[packages]
pywin32 = {version = "==227", markers="sys_platform == 'win32'"}
$ pipenv install --verbose
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Building requirements...
Resolving dependencies...
⠴ Locking...Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 807, in <module>
✘ Locking Failed!
main()
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 802, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 785, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages)
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 746, in resolve_packages
results, resolver = resolve(
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 728, in resolve
return resolve_deps(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 1378, in resolve_deps
results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 1090, in actually_resolve_deps
resolver = Resolver.create(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 647, in create
constraints, skipped, index_lookup, markers_lookup = cls.get_metadata(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 462, in get_metadata
constraint_update, lockfile_update = cls.get_deps_from_req(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 610, in get_deps_from_req
best_match = pypi.find_best_match(req.ireq) if pypi else None
File "/usr/lib/python3.8/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 202, in find_best_match
raise NoCandidateFound(ireq, all_candidates, self.finder)
pipenv.patched.piptools.exceptions.NoCandidateFound: Could not find a version that matches pywin32==227
No versions found
Were https://pypi.org/simple or https://mirrors.aliyun.com/pypi/simple/ or https://pypi.tuna.tsinghua.edu.cn/simple reachable?
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 807, in <module>
main()
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 802, in main
_main(parsed.pre, parsed.clear, parsed.verbose, parsed.system, parsed.write,
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 785, in _main
resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages)
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 746, in resolve_packages
results, resolver = resolve(
File "/usr/lib/python3.8/site-packages/pipenv/resolver.py", line 728, in resolve
return resolve_deps(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 1378, in resolve_deps
results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 1090, in actually_resolve_deps
resolver = Resolver.create(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 647, in create
constraints, skipped, index_lookup, markers_lookup = cls.get_metadata(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 462, in get_metadata
constraint_update, lockfile_update = cls.get_deps_from_req(
File "/usr/lib/python3.8/site-packages/pipenv/utils.py", line 610, in get_deps_from_req
best_match = pypi.find_best_match(req.ireq) if pypi else None
File "/usr/lib/python3.8/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 202, in find_best_match
raise NoCandidateFound(ireq, all_candidates, self.finder)
pipenv.patched.piptools.exceptions.NoCandidateFound: Could not find a version that matches pywin32==227
No versions found
Were https://pypi.org/simple or https://mirrors.aliyun.com/pypi/simple/ or https://pypi.tuna.tsinghua.edu.cn/simple reachable?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:6 (1 by maintainers)
Top Results From Across the Web
pipenv Documentation - Read the Docs
Pipenv uses a set of commands to manage your Project's dependencies and ... to always evaluate the requirement markers fresh (without lru_cache) to...
Read more >Frequently Encountered Pipenv Problems - Read the Docs
Here are some common questions people have using Pipenv. Please take a look below and see if they resolve your problem. Note. Make...
Read more >How to use the packaging.markers.Marker function in ... - Snyk
To help you get started, we've selected a few packaging.markers.Marker examples, based ... "CPython"}] assert Marker(marker_string).evaluate(*args) is False.
Read more >PEP 508 – Dependency specification for Python Software ...
Environment Markers · argparse;python_version<"2.7". A marker expression evaluates to either True or False. · "dog" ~= "fred" python_version ~= "surprise". User ...
Read more >pipenv Changelog - PyUp.io
Solve issue where null markers were getting added to lock file when extras were ... is set but does not evaluate to ``False``...
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

I, too, am running into this issue… except I have
pywin32 = {version = "*", markers = "platform_system == 'Windows'"}Same error, though.
@frostming I’m sorry but I don’t quite understand your meaning of “generate correctly for all possible platforms”. How does it have anything to do with platform-specific markers?