bgschiller / postgres_kernel

A simple Jupyter kernel for PostgreSQL
MIT License
64 stars 19 forks source link

pip install doesn't install kernelk. #21

Open esegal opened 5 years ago

esegal commented 5 years ago

I tried both pip install postgres-kernel and pip3 install postgres-kernel yet the kernel isn't availabe in jupyter.

!pip freeze from within jupyter shows postgres-kernel==0.2.2 - so I guess it's something with the installation?

bgschiller commented 5 years ago

A few things to try:

  1. See what shows up when you run jupyter kernelspec list.
  2. Does it look like the pip version you're using (run which pip to see the path) is associated with the same copy of python as jupyter (run which jupyter). If not, it could be an issue with your PATH. You can also try which pip3.
  3. I believe !pip freeze from inside jupyter still relies on your PATH variable to decide which pip to use. You can run help('modules') to have python gather a list of all modules it can see.

Hope this helps!

dannyb2018 commented 5 years ago

Hi, I have also tried to install postgres_sql and have similar problems.

I have python via conda, the rest of the kernels were installed using conda install and postgres_sql was installed using pip but jupyter doesnt find it. I only have one enviroment and I am using python3.

jupyter kernelspec list doesnt show postgres as installed.

running jupyter console --kernel postgres throws:

Traceback (most recent call last): File "d:\Users\PC\Anaconda3\Scripts\jupyter-console-script.py", line 10, in sys.exit(main()) File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_core\application.py", line 266, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, *kwargs) File "d:\Users\PC\Anaconda3\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance app.initialize(argv) File "<d:\Users\PC\Anaconda3\lib\site-packages\decorator.py:decorator-gen-118>", line 2, in initialize File "d:\Users\PC\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error return method(app, args, kwargs) File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_console\app.py", line 142, in initialize self.init_shell() File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_console\app.py", line 109, in init_shell JupyterConsoleApp.initialize(self) File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_client\consoleapp.py", line 334, in initialize self.init_kernel_manager() File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_client\consoleapp.py", line 288, in init_kernel_manager self.kernel_manager.start_kernel(kwargs) File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 246, in start_kernel kernel_cmd = self.format_kernel_cmd(extra_arguments=extra_arguments) File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 170, in format_kernel_cmd cmd = self.kernel_spec.argv + extra_arguments File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 82, in kernel_spec self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name) File "d:\Users\PC\Anaconda3\lib\site-packages\jupyter_client\kernelspec.py", line 236, in get_kernel_spec raise NoSuchKernel(kernel_name) jupyter_client.kernelspec.NoSuchKernel: No such kernel named postgres

Please let me know if there are any other details you need.

Thx in advance

stuaxo commented 3 years ago

The issue is that you have a WHL on pypi and WHLs have limitations around what setup.py can do - so your code to install the kernel does not run.

After install via pip3 install postgres_kernel

root@5e7e0ae3e856:/app# jupyter kernelspec list
Available kernels:
  django_extensions    /usr/local/share/jupyter/kernels/django_extensions
  python3              /usr/local/share/jupyter/kernels/python3

Force reinstall with binary disabled:

root@5e7e0ae3e856:/app#  pip3 install --force-reinstall postgres_kernel --no-binary postgres_kernel
root@5e7e0ae3e856:/app#  jupyter kernelspec list
Available kernels:
  django_extensions    /usr/local/share/jupyter/kernels/django_extensions
  postgres             /usr/local/share/jupyter/kernels/postgres
  python3              /usr/local/share/jupyter/kernels/python3
bgschiller commented 3 years ago

ah, that does make sense. I removed the WHL from pypi, so hopefully it will work from here on out.

stuaxo commented 3 years ago

Hi That works, except if someone already has downloaded the existing version and it is cached, in which case the cached WHL is prefered.

I think the easiest thing to do would be to make a new release with slightly higher version number to fix it for anyone in this particular trap.