kale icon indicating copy to clipboard operation
kale copied to clipboard

ModuleNotFoundError: No module named 'kale'

Open fkoehlin opened this issue 2 years ago • 4 comments

Hi all,

I've followed the kubeflow-kale README to install

pip install kubeflow-kale 
pip install jupyterlab">=2.0.0, <3.0.0"
jupyter labextension install kubeflow-kale-labextension

in its own virtual environment for a local k8s cluster set up using kind.

Trying to run the example pipeline created from the titanic_dataset_ml.ipynb fails at the load data step with the following error message:

Traceback (most recent call last):
  File "/tmp/tmp.VQmuVObk5f", line 66, in <module>
    _outputs = loaddata(**_parsed_args)
  File "/tmp/tmp.VQmuVObk5f", line 2, in loaddata
    from kale.common import mlmdutils as _kale_mlmdutils
ModuleNotFoundError: No module named 'kale'

The same happens with my own example script. Any hints or ideas?

fkoehlin avatar Nov 24 '21 13:11 fkoehlin

Just got into Kale as well, but maybe this helps. Maybe it's worth building your own kale image. In this case based on the open source kubeflownotebooks tf gpu image (but works for every base image for me from https://hub.docker.com/u/kubeflownotebooks):

FROM kubeflownotebooks/jupyter-tensorflow-full-cuda:v0.39.0

USER $NB_UID

RUN python3 -m pip install --upgrade "enum34==1.1.8" && \
    python3 -m pip install --upgrade "jupyterlab>=2.0.0,<3.0.0"

RUN python3 -m pip install --upgrade kfp && \
    python3 -m pip install --upgrade kubeflow-kale && \
    jupyter labextension install kubeflow-kale-labextension --minimize=False

RUN python3 -m pip install --upgrade "jupyter-client==5.3.4"

RUN jupyter lab --generate-config

ENTRYPOINT ["sh", "-c", \
     "jupyter lab --notebook-dir=/home/jovyan --ip=0.0.0.0 --no-browser \
      --allow-root --port=8888 --LabApp.token='' --LabApp.password='' \
      --LabApp.allow_origin='*' --LabApp.base_url=${NB_PREFIX}"]

This at least works for me for running GPU pipelines. If you don't want to build the image... did you tried to restart your notebook kernel and/or restarting the notebook server? I think when installing kale inside a running notebook you have to at least restart the notebook server

basti-j avatar Nov 25 '21 14:11 basti-j

Thanks for your answer and Dockerfile. I've also tried out the official Dockerfile from kale/docker/jupyterlab/ running again into the same error. I guess I'm hitting the top issue mentioned in the FAQs, i.e. my local toy cluster is not set up to run with Rok, hence imports are not passed between individual pipeline steps. I'm just confused about that kale itself isn't found since it is for sure in the pod/virtual env running Jupyter lab...

fkoehlin avatar Nov 25 '21 15:11 fkoehlin

I'm not using Rok as well. But in the 'Advanced Settings` (of the Kale jupyter plugin UI) I have to remount the used volumes manually (to the same mounting points as the notebook has). In this case every pipeline step has access to these volumes.

basti-j avatar Nov 25 '21 15:11 basti-j

Sorry, I don't quite get it yet... Can you give an example on noob level, please?

fkoehlin avatar Nov 25 '21 16:11 fkoehlin