Deploy Python programs on Windows and select large library dependencies

I have small Python programs that depend on several large libraries, such as:

  • NumPy and SciPy
  • Matplotlib
  • Pyqt
  • Opencv
  • Pil

I would like to simplify the installation of these programs for Windows users. I currently have two options:

  • either create huge executable packages with PyInstaller, py2exe or a similar tool,
  • or write step-by-step installation instructions.

Executable packages are too large. I always feel that there is some kind of magic that may or may not work the next time I use another library or a new version of the library. I also don't like empty space. Manual installation is too easy to execute incorrectly, too many steps: download this version of the interpreter, download the numpy, scipy, pyqt, pil files, make sure that they are all created for the same version of python and the same platform, install it after another, download and unzip OpenCV, copy its .pyd file in depth inside Python, set the installation environment variables and asssociations files ... You see that few users will have the patience and self-confidence to do all this.

What I would like to do: distribute only a small Python source and, possibly, install a script that extracts and installs all the missing dependencies (the correct versions, the correct platform, installs them in the correct order). This is a trivial task with any Linux package manager, but I just don’t know what tools can run it on Windows. Are there simple tools that Windows installers can generate from dependency list 1 ?

1 As you may have noticed, most of the libraries I have listed are not installed using pip / easy_install, but require running your own installers and changing some files and environment variables.

+4
source share
3 answers

npackd exists http://code.google.com/p/windows-package-manager/ You can do it here or use the distribution (python 3.x) or setuptools (python 2.x) with easy_install, maybe pip (don't know , compatibility with Windows). But I would choose npackd, because PyQt and an unusual setting for pip / easy_install (do not play with them nicely, using configure.py instead of setup.py). Although you will need to create your own repo for npackd to use for some of them. I forget what was contributed to the total amount for python libs with it.

+2
source

AFAIK is not a tool (and I would suggest that you are googled), so you have to do it yourself.

Getting the right library versions seems easy enough - with python ftplib you can get the right installers for each library. How to find out which version is compatible with custom python? You can keep different lists of download URLs, each for a different version of python (this method got out of my head and probably the best way, and not that it matters much if it's simple and works).

After you start the installation process for each installer, you can download the install2 script file and even use it to extract the program itself.


EDIT

Some considerations

There are several things that appeared in my head, as I wrote: Firstly, some kind of pseudo-code (how would I fit it)

#first, we check modules try: import numpy except ImportError: #flag numpy for installation #lather, rinse repeat for all dependencies #next we check version compatibility -- note that if a library version you need #is not backwards-compatible, you're in DLL hell, and there is little we can do. <insert version-checking code here> #once you have your unavailable dependencies, you install them import ftplib <all your file-downloading here> #now you install. sorry I can't help you here. 

There are several things you can do to make your utility reusable -

  • put all url lists, minimum version numbers, required library names, etc. in configuration files.
  • Write a script to help you configure the installer
  • Py2exe installer-producer- script
  • Sell ​​it
  • Better yet, release it under the GPL so that we can all revel in the fruits of your labors.
+1
source

I have the same need as yours, but I also need the packaged application to work on multiple platforms. I am currently studying the solutions currently available, here are some interesting ones:

I will update here if I find something that fills my account.

0
source

All Articles