What's the best way to deploy a Python package to a Windows Server if some of the dependencies need to be compiled? Installing Visual Studio is out of the question and I'm reluctant to pass a 250MB file around everytime things need updating. pip install -r requirements.txt
is the goal.
Any suggestions?
Using a compile-once, deploy-many-times strategy might help, with the use of Python's newest package distribution format, wheels. They are an already-compiled, binary format. So the requirements are just a development / build platform that's similar / running the same python as the deployment platform (the latter won't require a build chain anymore).
Install the latest pip
, setuptools
and wheel
packages. You can then use the pip wheel
command as you would pip install
, except it will instead produce a folder called (by default) wheelhouse
full of the necessary, already-compiled wheels for another python/pip to install what you required.
You can then pass those wheel filepaths directly to a pip install
command (e.g on your deployment machine), or use the normal package name(s) with --no-index --find-links=
flags to point to the folder location where those wheels are. This location can also be a simple http folder - for example.