0

While I was installing python 3.8 jupyter notebook, I was getting an error at pyzmq library installation - it was showing failed in building wheels for pyzmq.

This often happens on Windows when a wheel is not available for a given package and python version combination e.g. when the package authors have failed to provide a wheel at all or when there is a new version of python and the package authors have not caught up yet. Of course pip deals with the lack of a wheel by downloading the source and trying to build the software but the lack of built pre-installed compilers on the Windows platform and possible missing build dependencies often make builds fail.

What software can be installed to resolve this problem?

1

First some background:

A part of the magic of python is the pip & install tools which will fetch and install libraries and their dependencies. However, sometimes the library or it's dependency includes platform specific binary code built from other languages such as C & C++.

The initial solution to dealing with these was to distribute the source code and the build instructions for them and for setup tools to auto-magically build the source into the binaries for the current platform.

The shortcomings of this system are that you might not have some of the files that are needed to build the item(s) and of course you need the correct compiler. On systems such as Linux this is not a problem as the build tools are usually pre-installed and are freely available if they are missing. One MS-Windows there isn't a default compiler shipped with the systems and the build tool chain may cost serious money. From this the Wheel format was born which allow package authors to pre-build the extensions for each platform and upload the resulting wheels which pip can find and install.

The only problem that remains is not all package authors have the time or tools to do this build. Enter the marvelous Christoph Gohlke of Laboratory for Fluorescence Dynamics, University of California, Irvine who has for several years made the effort to unofficially build many of the commonly used packages and a lot of us know, when we hit errors such as yours, to head over to https://www.lfd.uci.edu/~gohlke/pythonlibs/ find the correct package, download it and install it.

Finally the solution

There is now a lovely tool called pipwin which does the job for you.

The process goes as follows:

  • Install pipwin with:

    pip install pipwin

  • Try to install your target package in a normal way, (in your case jupyter notebook):

    pip install jupyter_notebook

  • Hit an error, e.g. in this case pyzmq

    pipwin install pyzmq

This will find pyzmq for your specific python on the site above, download and install it

  • Try to pip install the original package again in the normal way, this time it doesn't try to install pyzmq as it already exists but of course you may hit another error - if you do just pipwin install that package and repeat until it works.

Alternatively

You can look up which specific compiler you need for the python that you are running, find a free copy if one exists or buy a copy of it, install it correctly not always easy & set all of the appropriate environmental variables, download the required package build dependencies and then pip will likely do the job nicely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.