question-mark
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.

Problem with Pipfile and system specific packages

See original GitHub issue

Specifying 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
  1. OS: Ubuntu 17.04
  2. Python version: 3.5.3
  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 or pipenv update

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
Devliguecommented, Mar 7, 2018

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 or platform_version. My problem is that pypiwin32= {version = "*", sys_platform = "== 'win32'"} when used on Linux crashes all packages installation and throws error. Its installation should be omitted but pipenv still searches for this package.

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)
2reactions
ErikBjarecommented, Nov 13, 2019

I managed to get the lock and install to work on a Linux machine by simply adding another line for pywin32:

[packages]
pypiwin32 = {version = "*", sys_platform = "== 'win32'"}
pywin32 = {version = "*", sys_platform = "== 'win32'"}

Output of pipenv lock -r:

-i https://pypi.org/simple
pypiwin32==223 ; sys_platform == 'win32'
pywin32==226 ; sys_platform == 'win32'

I haven’t tried running it on Windows yet, but I expect it to work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Pipenv Errors and How to Solve Them: Why Won't it ...
Locking Issue: Pipfile Contains a Reference to an Inexistent Package ... Pipfile won't lock when it tries to install packages that don't exist,...
Read more >
Frequently Encountered Pipenv Problems - Read the Docs
This is usually a result of mixing Pipenv with system packages. We strongly recommend installing Pipenv in an isolated environment.
Read more >
ERROR:: --system is intended to be used for pre-existing ...
I pulled from github my project and then on virtual computer on aws(ubuntu) run pipenv install,I am getting this error every time. ERROR::...
Read more >
pipenv Documentation
--dev — Install both develop and default packages from Pipfile. • --system — Use the system pip command rather than the one from...
Read more >
pipenv Documentation - manpages.ubuntu!
While pip can install Python packages, Pipenv is recommended as it's a ... like to specify that a specific package only be installed...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found