tengu-team / layer-jupyter-notebook

GNU Affero General Public License v3.0
0 stars 1 forks source link

Fails in install-hook #2

Closed migsk closed 5 years ago

migsk commented 6 years ago

Problem

After deployingjuju deploy cs:~tengu-team/jupyter-notebook-0 the charm fails in the install-hook.

Solution

I manually changed the pip import in /usr/local/lib/python3.5/dist-packages/charmhelpers/contrib/python/packages.py to from pip._internal import main.

xannz commented 6 years ago

This looks like an upstream issue with the charmhelpers library and the pip_install function?

davecore82 commented 5 years ago

I also had an error in the install hook when deploying cs:~tengu-team/jupyter-notebook-0. The error was:

18:50:23 DEBUG unit.jupyter-notebook/0.install Traceback (most recent call last): 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/var/lib/juju/agents/unit-jupyter-notebook-0/charm/hooks/install", line 19, in 18:50:23 DEBUG unit.jupyter-notebook/0.install main() 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/usr/local/lib/python3.5/dist-packages/charms/reactive/init.py", line 78, in main 18:50:23 DEBUG unit.jupyter-notebook/0.install bus.dispatch() 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 423, in dispatch 18:50:23 DEBUG unit.jupyter-notebook/0.install _invoke(other_handlers) 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 406, in _invoke 18:50:23 DEBUG unit.jupyter-notebook/0.install handler.invoke() 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/usr/local/lib/python3.5/dist-packages/charms/reactive/bus.py", line 280, in invoke 18:50:23 DEBUG unit.jupyter-notebook/0.install self._action(*args) 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/var/lib/juju/agents/unit-jupyter-notebook-0/charm/reactive/jupyter_notebook.py", line 38, in install_jupyter_notebook 18:50:23 DEBUG unit.jupyter-notebook/0.install pip_install('pip', upgrade=True) 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/usr/local/lib/python3.5/dist-packages/charmhelpers/contrib/python/packages.py", line 114, in pip_install 18:50:23 DEBUG unit.jupyter-notebook/0.install pip_execute(command) 18:50:23 DEBUG unit.jupyter-notebook/0.install File "/usr/local/lib/python3.5/dist-packages/charmhelpers/contrib/python/packages.py", line 47, in pip_execute 18:50:23 DEBUG unit.jupyter-notebook/0.install from pip import main as _pip_execute 18:50:23 DEBUG unit.jupyter-notebook/0.install ImportError: cannot import name 'main' 18:50:23 ERROR juju.worker.uniter.operation hook "install" failed: exit status 1

I solved it by ssh'ing to the jupyter-notebook/0 unit and running the following command:

sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall

davecore82 commented 5 years ago

I notice the file /usr/bin/pip3 has been removed from the jupyter-notebook/0 unit:

root@juju-dcba8b-0:~# dpkg -l | grep pip
ii  libpipeline1:amd64               1.4.1-2                                    amd64        pipeline manipulation library
ii  python-pip-whl                   8.1.1-2ubuntu0.4                           all          alternative Python package installer
ii  python3-pip                      8.1.1-2ubuntu0.4                           all          alternative Python package installer - Python 3 version of the package

root@juju-dcba8b-0:~# dpkg -L python3-pip 
[...]
/usr/bin/pip3
[...]

root@juju-dcba8b-0:~# ls -l /usr/bin/pip3
ls: cannot access '/usr/bin/pip3': No such file or directory

root@juju-dcba8b-0:~# debsums -a python3-pip
debsums: missing file /usr/bin/pip3 (from python3-pip package)
xannz commented 5 years ago

Should be fixed by using cs:~tengu-team/jupyter-notebook-1.