Python Dependencies

Python packages are handled in the requirements.txt tab. Since xlwings Lite runs Python via Pyodide a Python distribution for WebAssembly (Wasm), there are a few special things to consider, which are explained here.

Installing packages

To define your dependencies, activate the requirements.txt tab and add your Python packages there. Whenever you edit the file, installation will automatically be triggered and the logs will be shown in the Output window:

_images/requirements.png

Caution

If you want to change the version of an already installed package, you will need to restart xlwings Lite after editing requirements.txt by going to > Restart.

Compatible packages

Pyodide first checks PyPI for a compatible wheel (.whl). If it doesn’t find a compatible version (it needs to be a pure Python package), Pyodide checks their own repository where they host compatible wheels for many popular packages that aren’t pure-Python packages.

If there’s no compatible version of the package, you could build it yourself, see Creating a Pyodide package. Note, however, that there are a few packages that are hard to build and therefore currently aren’t available for Pyodide, e.g., PyTorch.

Version pinning

  • For pure Python packages including xlwings, you can pin the version as usual.

  • If the package is provided by Pyodide (see Packages built in Pyodide), the package version is tied to the version of Pyodide, so don’t pin it.

Own packages

To install your own packages that are not on PyPI, you can upload them to any web server that is reachable from xlwings Lite and reference it with its URL in the requirements.txt file:

https://myserver.com/mypackage-x.x.x-py3-none-any.whl