This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess32 unable to be installed via pip
Type: compile error Stage: resolved
Components: Library (Lib), Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: Marat.Mavlyutov, berker.peksag, gajdig, gregory.p.smith, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2015-01-11 14:58 by gajdig, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue23223.diff berker.peksag, 2015-01-14 03:28 review
Messages (8)
msg233857 - (view) Author: gajdig (gajdig) Date: 2015-01-11 14:58
The latest subprocess32, 3.2.6, is unable to be installed in Windows 7 via pip. 

The error messages:

_posixsubprocess.c(10) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

error: command 'C:\\Users\\user1\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

Read that unistd.h is not a Windows file.
msg233990 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2015-01-14 01:26
subprocess32 is not part of Python, it's a third party mode. Report the issue to his author.
msg234002 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-01-14 03:23
Quoting from https://code.google.com/p/python-subprocess32/:

"Think you've found an issue? Please try to reproduce it using Python 3.4 and file it using http://bugs.python.org/. Work will be done upstream and backported to this project."
msg234003 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-01-14 03:28
Here is a patch.
msg234004 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-01-14 03:39
_posixsubprocess should not be compiled on Windows, as it will not work and
has the potential to completely screw up subprocess on Windows.  This
appears to be a bug in subprocess32's setup.py, and thus does not apply to
Python itself at all.  I agree with Victor that this bug doesn't belong
here.
msg234005 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015-01-14 03:46
Oh, good point! I missed that, thanks.
msg234570 - (view) Author: Marat Mavlyutov (Marat.Mavlyutov) Date: 2015-01-23 18:34
HI!
need that thingie too, did you poke the author?
cant find issue tracker at code.google.com
msg234576 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2015-01-23 20:29
I can apply this to subprocess32 but it is going to look much more like:

+#ifndef MS_WINDOWS  /* WTF is anyone compiling on Windows?  Shouldn't work! */
+# define HAVE_UNISTD_H 1
+#endif
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif

The real question is why do you need it?

_posixsubprocess.c makes no sense to compile on Windows as far as I understand it.  subprocess32 in its entirety makes no sense to use on Windows as nobody is testing, maintaining or updating the Windows side of its code.

The module backport was created for reliable use on POSIX platforms where the existing python 2.x subprocess module falls short.

I recommend:

try:
    import subprocess32 as subprocess
except ImportError:
    import subprocess

OR

if sys.platform.startswith('win'):
    import subprocess
else:
    import subprocess32 as subprocess

in cross platform code that needs to run on Windows.

....

BTW, anyone know what update do I need to make to setup.py and its PIP categorization to mark it as unavailable on Windows?
History
Date User Action Args
2022-04-11 14:58:11adminsetgithub: 67412
2015-01-23 20:30:02gregory.p.smithsetassignee: gregory.p.smith
2015-01-23 20:29:27gregory.p.smithsetmessages: + msg234576
2015-01-23 18:34:54Marat.Mavlyutovsetnosy: + Marat.Mavlyutov
messages: + msg234570
2015-01-14 03:46:57berker.peksagsetstatus: open -> closed
resolution: not a bug
messages: + msg234005

stage: patch review -> resolved
2015-01-14 03:39:28zach.waresetmessages: + msg234004
2015-01-14 03:28:33berker.peksagsetfiles: + issue23223.diff
keywords: + patch
messages: + msg234003

stage: patch review
2015-01-14 03:23:07berker.peksagsetstatus: closed -> open

nosy: + berker.peksag
messages: + msg234002

resolution: not a bug -> (no value)
2015-01-14 01:26:19vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg233990

resolution: not a bug
2015-01-11 15:04:35SilentGhostsetnosy: + gregory.p.smith
components: + Library (Lib), - Installation
2015-01-11 14:58:55gajdigcreate