krishnadey30/jupyter_kernel_chapel

Improve error message when jupyter not available

Opened this issue · 2 comments

When jupyter is not already installed, the user gets a pretty confusing error message:

...
    Installing Ansible Kernel kernelspec
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/gl/n_gvpvk56gq21_7_zqbhcgvh000h70/T/pip-install-z3hrfn2m/jupyter-kernel-chapel/setup.py", line 57, in <module>
        , include_package_data=True
      File "~/.pyenv/versions/3.7.0/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "~/.pyenv/versions/3.7.0/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "~/.pyenv/versions/3.7.0/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "~/.pyenv/versions/3.7.0/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/gl/n_gvpvk56gq21_7_zqbhcgvh000h70/T/pip-install-z3hrfn2m/jupyter-kernel-chapel/setup.py", line 15, in run
        from jupyter_client.kernelspec import KernelSpecManager
    ModuleNotFoundError: No module named 'jupyter_client'

    ----------------------------------------
Command "~/.pyenv/versions/3.7.0/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/gl/n_gvpvk56gq21_7_zqbhcgvh000h70/T/pip-install-z3hrfn2m/jupyter-kernel-chapel/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/gl/n_gvpvk56gq21_7_zqbhcgvh000h70/T/pip-record-txvke72h/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/gl/n_gvpvk56gq21_7_zqbhcgvh000h70/T/pip-install-z3hrfn2m/jupyter-kernel-chapel/

I wonder if this can be improved, either through explicitly adding jupyter as a dependency for the package or some carefully placed try/except blocks in the setup.py

I think listing the dependencies would the preferred approach. Here is an example from another kernel:

https://github.com/EugeneLoy/coq_jupyter/blob/master/setup.py#L17-L23

@ben-albrecht I have added dependencies list.
I am thinking to update the next version after some changes.
For now you can use

git clone https://github.com/krishnadey30/jupyter_kernel_chapel.git
cd jupyter_kernel_chapel
pip install --user .