Python packages installation in Windows

By : Amro

I recently began learning Python, and I am a bit confused about how packages are distributed and installed.

I understand that the official way of installing packages is distutils: you download the source tarball, unpack it, and run: python install, then the module will automagically install itself

I also know about setuptools which comes with easy_install helper script. It uses eggs for distribution, and from what I understand, is built on top of distutils and does the same thing as above, plus it takes care of any dependencies required, all fetched from PyPi

Then there is also pip, which I'm still not sure how it differ from the others.

Finally, as I am on a windows machine, a lot of packages also offers binary builds through a windows installer, especially the ones that requires compiling C/Fortran code, which otherwise would be a nightmare to manually compile on windows (assumes you have MSVC or MinGW/Cygwin dev environment with all necessary libraries setup.. nonetheless try to build numpy or scipy yourself and you will understand!)

So can someone help me make sense of all this, and explain the differences, pros/cons of each method. I'd like to know how each keeps track of packages (Windows Registry, config files, ..). In particular, how would you manage all your third-party libraries (be able to list installed packages, disable/uninstall, etc..)

By : Amro


I use windows and python. It is somewhat frustrating, because pip doesn't always work to install things. Python is moving to pip, so I still use it. Pip is nice, because you can uninstall items and use

pip freeze > requirements.txt
pip install -r requirements.txt

Another reason I like pip is for virtual environments like venv with python 3.4. I have found venv a lot easier to use on windows than virtualenv.

If you cannot install a package you have to find the binary for it.

I have found these binaries to be very useful.

Pip is trying to make something called a wheel for binary installations.

pip install wheel
wheel convert path\to\binary.exe
pip install converted_wheel.whl

You will also have to do this for any required libraries that do not install and are required for that package.

By : HashSplat

This video can help you solving your question :)
By: admin