Search code examples
pythonwindowspippython-wheel

How to package a wheel for a library meant to run on python3.8 32bits on windows10?


Initial question (2020-02-15)

I'm building a python library: my_custom_library, with standard requirements (NumPy, pandas, librosa ...) and custom functions.

I would like to build a wheel of my_custom_library to then pip install this library on python3.8 32bits on windows10 on a machine with no access to internet (flash drive transfert). This install should be a "true" windows10 install and should not require WSL.

I would consider the packaging a success if I could produce one file my_custom_library-0.0.0-win32.whl similar to numpy-1.18.1-cp38-cp38-win32.whl on https://pypi.org/project/numpy/#files. This package is meant to stay private, I don't want to publish anything on pypi.

What is the best practice to build the wheel of my_custom_library for windows10 ?

What is the shortest list of commands to do that ?

From what I saw, it seems I need to build the wheel on the same OS as the OS where the wheel will be installed.

Can I build the wheel on a linux machine (ubuntu 18.04LTS) and install it on windows10 ?

If it's possible, what is the shortest list of commands to do that ?


Requirements (2020-02-17)

my_custom_library will import many well-known libraries including:

librosa==0.7.1 
matplotlib==3.1.1
numpy==1.16.4
opencv-python==4.1.2.30
pandas==0.24.2
scikit-learn==0.21.3
scipy==1.3.2

Solution

  • Can I build the wheel on a linux machine (ubuntu 18.04LTS) and install it on windows10 ?

    Pure Python library — yes. Actually a pure Python library doesn't need to be platform-specific at all, you can build a universal wheel or use sdist (source distribution).

    But if the library has code written in C/C++ then no, you have to build it on an exact platform (processor architecture, minimal OS version, exact Python version). You can build 32-bit library on a 64-bit Windows using 32-bit Python. But not the other way around — you cannot build 64-bit library on a 32-bit Windows.