Menu

#669 'pip install pywin32' doesn't work

v1.0 (example)
open
nobody
None
5
2015-01-10
2014-04-05
No

It would be great if pywin32 could be distributed as a binary wheel. This is the last remaining dependency of Twisted on Windows which requires manual intervention and installation.

Discussion

  • Vernon Cole

    Vernon Cole - 2014-04-21

    This should be listed as a "Feature Request", rather than a "Bug".

     
  • Alex Walters

    Alex Walters - 2014-06-16

    Sorry, not packaging for python (bdist_wininst is NOT packaging for python) is a bug.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2014-06-16

    For what it's worth, python setup.py bdist_wheel almost works. I tweaked the .pth file to append the directories with the DLLs in it to os.environ["PATH"], and everything seems to work reasonably well.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2014-07-01

    You can see my binary wheel here: https://glyph.im/pywin32/index/pywin32/index.html

    I screwed up the version information (".glyph" is apparently not a valid version suffix) so pip has a little trouble with it, you have to identify it just right to install it, but it otherwise works reasonably well.

     
  • stopiccot

    stopiccot - 2014-08-04

    So is there any chance that pywin32 could be installed via pip one day? Problem is that .exe installers couldn't be installed from command line.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2014-08-12

    To be clear, there is almost no development work to do here; it is, at most, a one-line change. The issue is that someone with an interest in this problem needs to be granted access to the PyPI packages. I am "glyph" on PyPI and would gladly do the legwork necessary to upload binary wheels that would allow pip to install pywin32. If someone would grant me access to the project I could probably have it done in under a week.

     
  • Alex Walters

    Alex Walters - 2014-08-14

    If it is a matter of volunteers with compilers, count me in.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2014-12-03

    Since there has been no action on this for over six months, I have created a different distribution on PyPI:

    https://pypi.python.org/pypi/pypiwin32

    You can "pip install pypiwin32" now into virtualenvs and the like, and that should work.

     
  • Paul Moore

    Paul Moore - 2015-01-08

    I know it's a "slippery slope" type of request, but any chance of Python 3.4 builds as well, Glyph?

    It's also worth noting that (as far as I can tell) "wheel convert" on the pywin32 wininst exes works fine as well. So you don't even need a build environment.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2015-01-09

    Hi Paul,

    I can give you upload credentials to the project on PyPI if that would be helpful.

     
  • Paul Moore

    Paul Moore - 2015-01-09

    Glyph - I'd be happy to wheel convert the existing wininst builds and upload them there. But I just tried to use "pip wheel" to build a Python 3.4 wheel from source, and it failed with errors I don't have time to diagnose. If wheel converted wheels are acceptable, though, I'll take up your offer, thanks.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2015-01-09

    What's your PyPI username?

     
  • Paul Moore

    Paul Moore - 2015-01-09

    Doh. Yeah, that would help - pf_moore.

     
    • Glyph Lefkowitz

      Glyph Lefkowitz - 2015-01-09

      Done. You should be able to upload wheels.

       

      Last edit: Glyph Lefkowitz 2015-01-09
  • Paul Moore

    Paul Moore - 2015-01-09

    Thanks. Just looking further at the wheel you created for pypiwin32, I see that you have given it a name (in the metadata, as well as the project name) of pypiwin32. Presumably that means that it won't satisfy any dependencies on pywin32 specified in other projects. Was that intentional? I doubt it'll matter though as projects won't be specifying pywin32 as a dependency because of the fact that it's not on PyPI...

    One reason I ask is that wheel convert doesn't allow changing the name, so it'll need some extra work to do that. But I'll sort that out and upload the Python 3 wheels.

     
  • Paul Moore

    Paul Moore - 2015-01-09

    OK, we have (minimally tested) Python 3.x wheels uploaded.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2015-01-09

    I would certainly have preferred to upload wheels as "pywin32" but a mismatch between what's on PyPI and what's in the wheel itself will break pip. I hope you didn't actually change the name of the wheels? The package still imports under the same name.

     
  • Glyph Lefkowitz

    Glyph Lefkowitz - 2015-01-09

    (If I could upload wheels to pywin32, i would have just done it and we wouldn't be having this conversation :))

     
  • Paul Moore

    Paul Moore - 2015-01-09

    What I did was "wheel convert pywin32*.exe" which gives wheels called pywin32-bla-blah.whl. I then put together a script that modified those wheels: (a) renamed them to pypiwin32, (b) modified the metadata files to change the project name to pypiwin32, (c) changed the dist-info directory name to pypiwin32.dist-info and (d) patched up the RECORD file to reflect the changes. I also patched the pth file as you did in your wheel (in the process I "accidentally" renamed the pth file to pypiwin32.pth, but that doesn't matter so I left it like that.

    I can upload the script somewhere if it's useful to others. It's a bit of a quick hack but it does the job.

     
    • Glyph Lefkowitz

      Glyph Lefkowitz - 2015-01-10

      Huh. Where did you get the .exe's? I take it you didn't build them from the sdist I put on pyPI?

      Uploading that script and pointing to it from the PyPI page would be helpful, just to facilitate if someone with greater interest wants to maintain it :).

      It might also be interesting for me to make the other builds using "wheel convert" rather than my own hackery. However, without changes to the '.pth' files, the wheels won't actually work inside a virtualenv - did you test 'pip install' first? Ideally on a machine without a compiler?

       
  • Paul Moore

    Paul Moore - 2015-01-10

    I got the exes from here (the official pywin32 ones). I'll find somewhere to put the script and then link to it. Actually, I just made a gist for it - https://gist.github.com/pfmoore/fd09fff11b4fa5f8cb25

    I thought I said above - I made the pth file changes in the script too.

    For testing I installed in a clean virtualenv (I used pip -vvv to see the details and checked it was using the wheel and not compiling) and then just created a MessageBox. That should confirm the basic functionality. Stuff like COM might not work, because it needs stuff registered with the system, but I suspect that would be true of your build as well (it's what the postinstall script does, and wheel installs don't support postinstall scripts).

    If you have a more comprehensive set of tests that your wheel passes, I'll happily run them on my builds.

     
  • Paul Moore

    Paul Moore - 2015-01-10

    Hmm, not sure I can add the script link to the PyPI page without putting it into the distribution metadata, which means editing the sources, which (in turn) means having to build from source. So never mind, I'll just leave the link here (above).