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

Restart xlwings Lite after editing the requirments.txt file.

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.

Web locations

If packages are on a public web server, you can reference them with their URL in the requirements.txt file:

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

File menu

You can drop your package under Files > Import/Export, then put it on requirements.txt under the name /data/my-package.whl. Adjust the path accordingly if you use Local Folders instead of Import/Export.