Problem with Pipfile and system specific packages
See original GitHub issueSpecifying certain packages to be installed only for some operating systems sometimes works, but sometimes not. For me it is difficult to overcome the problem of pyqt5 and pypiwin32 package entries in Pipfile when deploying on Linux.
Describe your environment
- OS:
Ubuntu 17.04
- Python version:
3.5.3
- Pipenv version:
11.0.2
Example
In my Pipfile the [packages]
entry looks like this (as per the doc example):
[packages]
"pypiwin32" = {version = "*", os_name = "== 'windows'"}
or like this:
[packages]
"pyqt5" = {version = "*", os_name = "== 'windows'"}
Expected result
In the pypiwin32
example I simply expected this package not to be installed on other platforms than Windows. Self-explanatory.
In the pyqt5
example I would also expect this package to be omitted on other platforms than Windows. For whatever reason on Linux (not sure if every, but some) we can’t install pyqt5 with pip anyways.
Or at least let the warning be thrown but I would like the rest of the packages listed in Pipfile to be installed at least.
Actual result
In pypiwin32
example:
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Could not find a version that matches pywin32>=223
Tried: (no version found at all)
In pyqt5
example:
Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
You can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
Could not find a version that matches pyqt5
Tried: (no version found at all)
As you can see it did not matter if I specified to not install those packages - the error still occurs. In fact it does not matter at all what I write after the "packagename" =
bit because apparently the packages themselves just being there listed cause some problems. And non of the ‘correct’ packages that might be listed in Pipfile will be installed
And just for the record, the docs example of doing exactly the same thing (with pywinusb = {version = "*", os_name = "== 'windows'"}
) worked seamlessly.
Steps to replicate
Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
"pypiwin32" = {version = "*", os_name = "== 'windows'"}
"pyqt5" = {version = "*", os_name = "== 'windows'"}
requests = "*"
[dev-packages]
[requires]
pipenv --python 3.5
pipenv install
orpipenv update
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:18 (9 by maintainers)
Thank you @kennethreitz for fixing the docs, but the problem is, that you have closed this issue while it is still unresolved. My problem was not related to whether to use
sys_platform
,os_name
orplatform_version
. My problem is thatpypiwin32= {version = "*", sys_platform = "== 'win32'"}
when used on Linux crashes all packages installation and throws error. Its installation should be omitted butpipenv
still searches for this package.I managed to get the lock and install to work on a Linux machine by simply adding another line for
pywin32
:Output of
pipenv lock -r
:I haven’t tried running it on Windows yet, but I expect it to work.