Add a package to Dask workers? #37
-
Is there any way to add a package to the environment used by the Planetary Computer hub Dask workers? I guess one way would be to set up my own hub and create custom environments there, but hoping there is an easier way... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The easiest way, at least for pure-python packages, is to use Dask's >>> 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 |
Beta Was this translation helpful? Give feedback.
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.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-…