Discussion:
[python-win32] Using pip to install pywin32
Chris Angelico
2015-02-19 10:23:46 UTC
Permalink
Has anyone successfully pip installed the pywin32 package? I'm having
some trouble with it at the moment. In theory, it should be easier to
instruct people to "type pip install pywin32" than "go to the
sourceforge download page, pick the right installer, and run it"; but
the installer is currently failing.

Full log is available if people want it, but what I'm seeing in it is
a number of lines like:

Analyzing links from page http://sourceforge.net/projects/pywin32/files/pywin32/

It never gets to the point of searching the build-specific pages, eg:

http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/

Is there a way to tell pip how to find the file?

All advice gratefully received!

ChrisA
Kevin Horn
2015-02-20 06:39:21 UTC
Permalink
check out this bug:
http://sourceforge.net/p/pywin32/bugs/669/

There's been some interest, but the pywin32 developers themselves don't
seem to have gotten involved.

I'm not sure why. It would be really nice to have pywin32 be
pip-installable.
Post by Chris Angelico
Has anyone successfully pip installed the pywin32 package? I'm having
some trouble with it at the moment. In theory, it should be easier to
instruct people to "type pip install pywin32" than "go to the
sourceforge download page, pick the right installer, and run it"; but
the installer is currently failing.
Full log is available if people want it, but what I'm seeing in it is
Analyzing links from page
http://sourceforge.net/projects/pywin32/files/pywin32/
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
Is there a way to tell pip how to find the file?
All advice gratefully received!
ChrisA
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
--
--
Kevin Horn
Vernon D. Cole
2015-02-20 14:07:59 UTC
Permalink
Pywin32 is mostly written in C, and has lots of dependencies and weird
build requirements. In order to compile it, you must have the same C
compiler that your release of Python was built with. For older Python
versions (like 2.7) that compiler is obsolete and hard to find, so installs
from source are pretty nearly impossible.

Would a binary wheel be able to do all of the crazy set up that the
Windows installer does?
The project is open source, and patches are happily accepted.
Post by Kevin Horn
http://sourceforge.net/p/pywin32/bugs/669/
There's been some interest, but the pywin32 developers themselves don't
seem to have gotten involved.
I'm not sure why. It would be really nice to have pywin32 be
pip-installable.
Post by Chris Angelico
Has anyone successfully pip installed the pywin32 package? I'm having
some trouble with it at the moment. In theory, it should be easier to
instruct people to "type pip install pywin32" than "go to the
sourceforge download page, pick the right installer, and run it"; but
the installer is currently failing.
Full log is available if people want it, but what I'm seeing in it is
Analyzing links from page
http://sourceforge.net/projects/pywin32/files/pywin32/
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
Is there a way to tell pip how to find the file?
All advice gratefully received!
ChrisA
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
--
--
Kevin Horn
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
Thomas Heller
2015-02-20 15:24:04 UTC
Permalink
Post by Vernon D. Cole
Pywin32 is mostly written in C, and has lots of dependencies and weird
build requirements. In order to compile it, you must have the same C
compiler that your release of Python was built with. For older Python
versions (like 2.7) that compiler is obsolete and hard to find, so
installs from source are pretty nearly impossible.
Would a binary wheel be able to do all of the crazy set up that the
Windows installer does?
AFAIK, wheel do not support post_install scripts.

According to the comments in Scripts\pywin32_postinstall.py, it does:

# copies PyWinTypesxx.dll and PythonCOMxx.dll into the system directory,
# and creates a pth file

According to the code, it does a lot more...

I don't think pip can run this script (it even needs admin privs!).

Thomas
Preston Landers
2015-02-20 16:31:14 UTC
Permalink
Post by Thomas Heller
I don't think pip can run this script (it even needs admin privs!).
Is there a reason it couldn't run a script that presents a UAC prompt to
elevate the process?

Something like this:
https://gist.github.com/Preston-Landers/267391562bc96959eb41

I guess for unattended installs you could just elevate the process
beforehand.

-Preston
Post by Thomas Heller
Post by Vernon D. Cole
Pywin32 is mostly written in C, and has lots of dependencies and weird
build requirements. In order to compile it, you must have the same C
compiler that your release of Python was built with. For older Python
versions (like 2.7) that compiler is obsolete and hard to find, so
installs from source are pretty nearly impossible.
Would a binary wheel be able to do all of the crazy set up that the
Windows installer does?
AFAIK, wheel do not support post_install scripts.
# copies PyWinTypesxx.dll and PythonCOMxx.dll into the system directory,
# and creates a pth file
According to the code, it does a lot more...
I don't think pip can run this script (it even needs admin privs!).
Thomas
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
Preston Landers
2015-02-20 16:58:37 UTC
Permalink
Actually that gist wouldn't help much since it uses pywin32, the thing
we're trying to install. (derp!) There may be another way though.

Possibly related: http://bugs.python.org/issue20641
Post by Preston Landers
Post by Thomas Heller
I don't think pip can run this script (it even needs admin privs!).
Is there a reason it couldn't run a script that presents a UAC prompt to
elevate the process?
https://gist.github.com/Preston-Landers/267391562bc96959eb41
I guess for unattended installs you could just elevate the process
beforehand.
-Preston
Post by Thomas Heller
Post by Vernon D. Cole
Pywin32 is mostly written in C, and has lots of dependencies and weird
build requirements. In order to compile it, you must have the same C
compiler that your release of Python was built with. For older Python
versions (like 2.7) that compiler is obsolete and hard to find, so
installs from source are pretty nearly impossible.
Would a binary wheel be able to do all of the crazy set up that the
Windows installer does?
AFAIK, wheel do not support post_install scripts.
# copies PyWinTypesxx.dll and PythonCOMxx.dll into the system directory,
# and creates a pth file
According to the code, it does a lot more...
I don't think pip can run this script (it even needs admin privs!).
Thomas
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
Thomas Heller
2015-02-20 17:59:48 UTC
Permalink
Post by Preston Landers
Actually that gist wouldn't help much since it uses pywin32, the thing
we're trying to install. (derp!) There may be another way though.
Sure, you could port the gist to ctypes instead of pywin32.

However, the problem is that pip doesn't run postinstall scripts
(or that the wheel format does not include them). Something like that.
Kevin Horn
2015-02-20 17:09:19 UTC
Permalink
Post by Vernon D. Cole
Pywin32 is mostly written in C, and has lots of dependencies and weird
build requirements. In order to compile it, you must have the same C
compiler that your release of Python was built with. For older Python
versions (like 2.7) that compiler is obsolete and hard to find, so installs
from source are pretty nearly impossible.
Microsoft provides a compiler package for Python 2.7 specifically for
creating binary wheels (and other binary distros):
http://www.microsoft.com/en-us/download/details.aspx?id=44266
Post by Vernon D. Cole
Would a binary wheel be able to do all of the crazy set up that the
Windows installer does?
No it wouldn't, but a lot of the postinstall stuff isn't necessary for many
uses of pywin32. It's probably still worthwhile to package it as a wheel
for those use cases.

At least it's useful enough that there's an alternate distribution called
"pypiwin32":
https://pypi.python.org/pypi/pypiwin32
Post by Vernon D. Cole
The project is open source, and patches are happily accepted.
According to the bug I referenced above, the only thing necessary to get
most functionality working is a tweak to the path files.

Also according to the same bug, it looks as though those involved couldn't
figure out where to send patches. Where should patches/contributions be
sent in order to get the attention of those who can merge them?
Post by Vernon D. Cole
Post by Kevin Horn
http://sourceforge.net/p/pywin32/bugs/669/
There's been some interest, but the pywin32 developers themselves don't
seem to have gotten involved.
I'm not sure why. It would be really nice to have pywin32 be
pip-installable.
Post by Chris Angelico
Has anyone successfully pip installed the pywin32 package? I'm having
some trouble with it at the moment. In theory, it should be easier to
instruct people to "type pip install pywin32" than "go to the
sourceforge download page, pick the right installer, and run it"; but
the installer is currently failing.
Full log is available if people want it, but what I'm seeing in it is
Analyzing links from page
http://sourceforge.net/projects/pywin32/files/pywin32/
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/
Is there a way to tell pip how to find the file?
All advice gratefully received!
ChrisA
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
--
--
Kevin Horn
_______________________________________________
python-win32 mailing list
https://mail.python.org/mailman/listinfo/python-win32
--
--
Kevin Horn
Loading...