kale icon indicating copy to clipboard operation
kale copied to clipboard

ModuleNotFoundError: No module named 'kale.rpc'; 'kale' is not a package

Open scottieliu opened this issue 3 years ago • 8 comments

Setup: MacOS 10.15.6 JupyterLab: 1.02, 1.1.3, 1.1.4 Python: 3.7.7 Node.js: 10.13.0, npm: 6.4.1 Kubeflow-Kale-labextension installed

This is my first time to try Kale and have googled for solutions with no progress. The following error kept poping up with a button "Refresh" when opening a notebook in the lab. Is this a bug or am I missing anything? Thanks!

A Kernel Error has occurred Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36

Type: Kernel

Method: log.setup_logging()

Message: ModuleNotFoundError: No module named 'kale.rpc'; 'kale' is not a package

Details: [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mkale\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrpc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mrun\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0m__kale_rpc_run\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0m__kale_rpc_result\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m__kale_rpc_run\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m"log.setup_logging"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'e30='\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'e30='\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'kale.rpc'; 'kale' is not a package" ]

scottieliu avatar Sep 01 '20 04:09 scottieliu

Hi @scottieliu,

It looks like the Kale Python package is not installed. Take into consideration that the extension cannot work without the backend part of Kale.

How did you install it? Can you verify you have installed both parts (lab extension and python package)?

elikatsis avatar Sep 02 '20 16:09 elikatsis

I have a local project using Jupyter notebook and it works fine. My goal was to package it with Kale and JupyterLab. I did the following:

pip install jupyterlab==1.2.6 # tried other 1.* versions, too. pip install kubeflow-kale jupyter labextension install kubeflow-kale-labextension pip3 install kubeflow-kale kfp kfp-server-api urllib3

What is the second part of python package (is it Python)?

I was able to enable the Kale Deployment Panel and run "Compile and Run/Compile and Save/Compile Upload" with green check marks on the tasks in the panel. But I did not see any new UI changes on the project related to the pipeline.

I see the following errors in the shell window:

[E 21:58:10.184 LabApp] Notebook JSON is invalid: 'execution_count' is a required property

Failed validating 'required' in execute_result:

On instance['cells'][74]['outputs'][0]:
{'data': {'text/html': '<div>\n'
                       '<style scoped>\n'
                       '    .dataframe tbody tr th:only-of-type {\n'
                       ' ...'},
 'metadata': {},
 'output_type': 'execute_result'}

scottieliu avatar Sep 02 '20 18:09 scottieliu

The installation seems good. I suggest you either use pip or pip3, mixing the two (even if they point to the same python installation) may lead to frustration and bugs that are hard to be traced.

But I did not see any new UI changes on the project related to the pipeline

Could you explain this a bit? What new UI changes were you expecting to see? Also note that with the commands you provided you are installing the latest releases, so changes on master branch merged after the release won't be there.

I see the following errors in the shell window: [E 21:58:10.184 LabApp] Notebook JSON is invalid: 'execution_count' is a required property

Could you provide some more information on how you constructed the notebook? What tools did you use? Did you by any chance manually edit it? Kale most probably doesn't touch this property (it does when you recover a pipeline step's state from a Rok snapshot, but it doesn't remove it making the notebook JSON invalid).

elikatsis avatar Sep 08 '20 09:09 elikatsis

I'm having the same issue; including the lack of UI changes.

I was expecting to find a "Kale" icon in the left-hand menu. Different online tutorials indicate that should be present and its from there that you initiate the pipeline conversion.

I used the following for my Dockerfile to run the instance:

FROM gcr.io/kubeflow-images-public/tensorflow-1.15.2-notebook-gpu:1.0.0

USER root

RUN pip3 install --upgrade pip
RUN pip3 install kubeflow-kale
RUN jupyter labextension install kubeflow-kale-launcher
RUN jupyter labextension list

RUN chown jovyan -R /home/jovyan

USER 1000

LRSutton avatar Sep 13 '20 16:09 LRSutton

I found some other install instructions and modified my Dockerfile to the following and it now works:

FROM gcr.io/kubeflow-images-public/tensorflow-1.15.2-notebook-gpu:1.0.0

USER root

RUN cd /tmp && git clone https://github.com/kubeflow-kale/kale
RUN cd /tmp/kale/backend && python3 ./setup.py install

RUN pip3 install --upgrade pip
RUN pip3 install kubeflow-kale
RUN jupyter labextension install kubeflow-kale-launcher
RUN jupyter labextension list

RUN chown jovyan -R /home/jovyan

USER 1000

LRSutton avatar Sep 13 '20 21:09 LRSutton

@LRSutton according to https://github.com/kubeflow-kale/kale/issues/187#issuecomment-688742762 kubeflow-kale-launcher is deprecated and you should use kubeflow-kale-labextension

davidspek avatar Sep 18 '20 10:09 davidspek

Same issue!

abdalazizrashid avatar Apr 18 '22 17:04 abdalazizrashid

same issue

wpalex2023 avatar Feb 09 '23 06:02 wpalex2023