Skip to content

Add a package to Dask workers? #37

Discussion options

You must be logged in to vote

The easiest way, at least for pure-python packages, is to use Dask's PipInstall plugin to install additional packages at runtime. See https://planetarycomputer.microsoft.com/docs/overview/environment/#installing-packages-on-dask-clusters-at-runtime and the linked docs.

>>> from dask.distributed import PipInstall
>>> plugin = PipInstall(packages=["scikit-learn"], pip_options=["--upgrade"])
>>> client.register_worker_plugin(plugin)

A few more complicated options are to use worker plugins to execute shell commands like mamba install ..., or specifying a custom docker image to use when you create the cluster (https://planetarycomputer.microsoft.com/docs/quickstarts/scale-with-dask/#Customize-…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rsignell-usgs
Comment options

Answer selected by rsignell-usgs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants