Error executing "pip install pywin32"

skip.montanaro's Avatar

skip.montanaro

26 Dec, 2017 03:02 PM

I'm trying to convert an existing distribution build setup for SpamBayes (www.spamayes.org). That uses Inno Setup, py2exe, and pywin32. I see that I can choco install Inno Setup, and pip install py2exe works, but the pip install of pywin32 fails with this error:

Collecting pywin32
  Could not find a version that satisfies the requirement pywin32 (from versions: )
No matching distribution found for pywin32

Looking on the pywin32 download page (https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/) I see this warning:

The SourceForge file system is horrible, making it very painful to
locate the latest build - please follow the instructions below.

The instructions make sense for a human. Is there some way to coax pip install (or the appveyor.yml script itself) to get the right stuff downloaded and installed? I'm trying to build both 32-bit and 64-bit installers. I think I want both of these, at the appropriate part of the build matrix:

https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/pywin32-221.win-amd64-py2.7.exe/download
https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/pywin32-221.win32-py2.7.exe/download

If I understand correctly, I can define something like:

      PYWIN32: "https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/pywin32-221.win32-py2.7.exe/download"

in my matrix section, then add

  - curl -s "%PYWIN32%"

in the install section. I'm a bit stumped, though. I tried this:

  - choco install InnoSetup
  - choco install cURL
  - set PATH=%PATH%;"C:\Program Files (x86)\Inno Setup 5";"C:\Program Files (x86)\cURL"
  - dir "C:\Program Files (x86)"
  # Need a couple other packages
  - pip install py2exe_py2
  # pywin32 is weird, so we download matrix-dependent versions and run the
  # installer manually.
  - curl -sS -o"C:\Program Files (x86)\pywin32.exe" %PYWIN32%
  - pywin32

but it aborts with this error message:

'pywin32' is not recognized as an internal or external command,
operable program or batch file.
Command exited with code 1

Where can I put the installer (pywin32.exe) so it can be run?

  1. Support Staff 1 Posted by Ilya Finkelshte... on 26 Dec, 2017 08:14 PM

    Ilya Finkelshteyn's Avatar

    Those URLs are what you click in browser, not what files actually being downloaded from. Usually use Fiddler to understand what is real file location. In this case they are:

    https://superb-sea2.dl.sourceforge.net/project/pywin32/pywin32/Build%20221/pywin32-221.win-amd64-py2.7.exe
    

    and

    https://superb-dca2.dl.sourceforge.net/project/pywin32/pywin32/Build%20221/pywin32-221.win32-py2.7.exe
    
    So in appveyor.yml you can use any of file download approaches, for example:
    - ps: start-filedownload "https://superb-sea2.dl.sourceforge.net/project/pywin32/pywin32/Build%20221/pywin32-221.win-amd64-py2.7.exe"
    

    and

    - ps: start-filedownload "https://superb-dca2.dl.sourceforge.net/project/pywin32/pywin32/Build%20221/pywin32-221.win32-py2.7.exe"
    
    However I would not 100% rely on those URLs. I would recommend to download them to some special folder, cache it and tune your build script to download those files if they cannot be found in cache (do not rely 100% on cache too, it is best effort approach).

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac