Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jupyter Lab does not find extensions #14965

Open
Iwo-KX opened this issue Aug 13, 2023 · 16 comments
Open

Jupyter Lab does not find extensions #14965

Iwo-KX opened this issue Aug 13, 2023 · 16 comments
Labels
bug os:macos Issues specific to macOS operating system status:Needs Discussion tag:Extensions
Milestone

Comments

@Iwo-KX
Copy link

Iwo-KX commented Aug 13, 2023

Hi,

First of all I would like to thank you all for building such a fantastic tool!

Recently I've encountered an issue with the Jupyter Lab extensions, that I could some help with with. Jupyter Lab works just fine, but it seems that it does not detect any installed extensions. For instance I've installed jupytext with pip, which can be imported in python, but it does not appear on extensions list (I've also tried other extensions):

iwok@Iwo-mac python@3.11 % jupyter labextension list
JupyterLab v4.0.4

I suspect that I am missing something in my configuration that would point jupyter lab to the extensions.

My setup:

MacOS 12.6.7 on M2 Mac with python3 and node installed via brew. Jupyterlab installed via pip.

Jupyter lab startup:

iwok@Iwo-mac ~ % jupyter lab
[I 2023-08-13 09:53:21.163 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-08-13 09:53:21.165 ServerApp] jupyterlab | extension was successfully linked.
[I 2023-08-13 09:53:21.191 LabApp] JupyterLab extension loaded from /opt/homebrew/lib/python3.11/site-packages/jupyterlab
[I 2023-08-13 09:53:21.191 LabApp] JupyterLab application directory is /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/share/jupyter/lab
[I 2023-08-13 09:53:21.191 LabApp] Extension Manager is 'pypi'.
[I 2023-08-13 09:53:21.192 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-08-13 09:53:21.193 ServerApp] The port 8888 is already in use, trying another port.
[I 2023-08-13 09:53:21.193 ServerApp] Serving notebooks from local directory: /opt/homebrew/Cellar/python@3.11
[I 2023-08-13 09:53:21.193 ServerApp] Jupyter Server 2.7.0 is running at:

Jupyter lab paths:

iwok@Iwo-mac ~ % jupyter lab paths
Application directory:   /opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/share/jupyter/lab
User Settings directory: /Users/iwok/.jupyter/lab/user-settings
Workspaces directory: /Users/iwok/.jupyter/lab/workspaces

Path to the installed package jupytext:

>>> jupytext.__path__
['/opt/homebrew/lib/python3.11/site-packages/jupytext']

Versions:
Python 3.11.4

jupyter_client 8.3.0
jupyter_core 5.3.1
jupyter-events 0.7.0
jupyter-lsp 2.2.0
jupyter_server 2.7.0
jupyter-server-mathjax 0.2.6
jupyter_server_terminals 0.4.4
jupyterlab 4.0.4
jupyterlab_git 0.42.0
jupyterlab-pygments 0.2.2
jupyterlab_server 2.24.0
jupyterlab_vim 4.0.2
jupytext 1.15.0
ipykernel 6.25.1
ipython 8.14.0

Many thanks in advance for your help.

Best wishes,
Iwo

@Iwo-KX Iwo-KX added the bug label Aug 13, 2023
@welcome
Copy link

welcome bot commented Aug 13, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label Aug 13, 2023
@JasonWeill
Copy link
Contributor

@Iwo-KX Thank you for your contribution! Have you tried installing JupyterLab and extensions using conda or mamba, as described in the installation instructions? That's typically how I install extensions, and I've had success this way.

@Iwo-KX
Copy link
Author

Iwo-KX commented Aug 16, 2023

@JasonWeill Thank you for the reply. brew/pip has been my solution to manage python/JupyterLab environment for some time and it worked quite well for me. It would be great to know why JupyterLab is not seeing the extensions but, in the meantime, I will try switching to conda as you suggested. Thanks!

@xk86
Copy link

xk86 commented Aug 25, 2023

Hi! I believe I'm having a similar issue, also on an M2 Mac. I've tried both the pip version of Jupyterlab as well as the Brew build, and neither see extensions installed via pip. Extensions also fail to install via the web interface, but don't give an error message. I have tried clean installs and all of that and still have no luck. I do not have conda, but I can try that in the future. Either way, additional reports might help figure this issue out.

At the moment, I have successfully installed extensions via jupyter labextension install but that's obviously the legacy way and not an actual solution. Please note that, while some of the extensions are installed via pip, they aren't detected in JupyterLab, only the manually installed ones via the deprecated labextension install commands.

MacOS 13.4.1 (c)

Output of jupyter labextension list:

JupyterLab v4.0.5
/opt/homebrew/Cellar/jupyterlab/4.0.5/libexec/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
        bqplot v0.5.41 enabled  X (python, bqplot)
        @jupyter-notebook/lab-extension v7.0.2 enabled OK


   The following extensions are outdated:
        jupyterlab_pygments
        bqplot

   Consider checking if an update is available for these packages.

Other labextensions (built into JupyterLab)
   app dir: /opt/homebrew/Cellar/jupyterlab/4.0.5/libexec/share/jupyter/lab
        @axlair/jupyterlab_vim v4.0.2 enabled OK
        @jupyter-widgets/jupyterlab-manager v5.0.8 enabled OK
        jupyter-matplotlib v0.11.3 enabled OK

Other versions:

Python 3.11.4

ipykernel                 6.25.1
ipympl                    0.9.3
ipython                   8.14.0
...
jupyter_client            8.3.0
jupyter_core              5.3.1
jupyter-events            0.7.0
jupyter-lsp               2.2.0
jupyter_server            2.7.0
jupyter_server_terminals  0.4.4
jupyterlab                4.0.5
jupyterlab-pygments       0.2.2
jupyterlab_server         2.24.0
jupyterlab_vim            4.0.2
jupyterlab-widgets        3.0.8

Paths:

    /opt/homebrew/Cellar/jupyterlab/4.0.5/libexec/etc/jupyter
    /Users/kate/.jupyter
    /Users/kate/Library/Python/3.11/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /opt/homebrew/Cellar/jupyterlab/4.0.5/libexec/share/jupyter
    /Users/kate/Library/Jupyter
    /Users/kate/Library/Python/3.11/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/kate/Library/Jupyter/runtime

pip packages are installed to /opt/homebrew/lib/python3.11/site-packages

Happy to help in any way! Cheers!

@amygdala
Copy link

Please note that, while some of the extensions are installed via pip, they aren't detected in JupyterLab, only the manually installed ones via the deprecated labextension install commands.

I'm seeing the same issue.

@krassowski
Copy link
Member

  1. Did you try to install extensions with the built-in extension manager from JupyterLab UI (a jigsaw puzzle icon on left sidebar)?
  2. When you open extension manager, there is a small question mark icon, what does it say when you hover over it? For me this is:
    Screenshot from 2023-08-27 01-47-45

Is this the same path to which your pip version installs? What is it?

@krassowski krassowski added os:macos Issues specific to macOS operating system tag:Extensions labels Aug 27, 2023
@krassowski
Copy link
Member

You are using JupyterLab 3.x. This issue is about JupyterLab 4.0. There are completely different extension managers between the two. I am afraid the extension manager in JupyterLab 3 will not receive further developement as it is using source install method which is no longer supported for installation of extensions from UI.

@amygdala
Copy link

You are using JupyterLab 3.x. This issue is about JupyterLab 4.0. There are completely different extension managers between the two. I am afraid the extension manager in JupyterLab 3 will not receive further developement as it is using source install method which is no longer supported for installation of extensions from UI.

Ah, sorry-- missed that. Deleted my comment so it doesn't confuse things.

@Iwo-KX
Copy link
Author

Iwo-KX commented Aug 31, 2023

Thanks for the reply @krassowski

  1. If I try installing via the manager (e.g. jupyter-vim extension) I get the prompt to refresh the browser but the extension does not appear in the installed list.
  2. Hovering over the question marks gives the path: /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11, whereas pip install packages to: /opt/homebrew/lib/python3.11/site-packages, so I guess this is the problem.
    Is there a way to config jupyterlab to look in a different location?

@krassowski
Copy link
Member

How exactly are you invoking pip? It appears to be a conflict between how jupyterlab was installed and what pip is pointing to. If you use pip within ipykernel notebook you should use %pip (not !pip). If you use it in command line environment, this is a more general question on configuring your environment (e.g. how you installed jupyterlab).

@Iwo-KX
Copy link
Author

Iwo-KX commented Sep 1, 2023

I've used pip with the command line with the default settings/paths. If I run pip show jupyterlab it is installed in the correct location: Location: /opt/homebrew/lib/python3.11/site-packages, so I'm not sure where the /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11 is coming from.

@Deeperand
Copy link

I met the similar problems, neither from pip nor from Jupyter Lab UI extension manager can't install extensions. (Jupyter Lab is installed by pip3 install jupyterlab). In this case, run jupyter labextension list shows

$ jupyter labextension list
JupyterLab v4.0.5

However, I also tried to use Homebrew to install Jupyter Lab brew install jupyterlab, and found although it still can't install plugin from pip3 install (like pip3 install jupyterlab-vim), but it can actually install extension from Jupyter Lab UI extension manager. And

$ jupyter labextension list
JupyterLab v4.0.5
/opt/homebrew/Cellar/jupyterlab/4.0.5_1/libexec/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
        @jupyter-notebook/lab-extension v7.0.3 enabled OK
        @axlair/jupyterlab_vim v4.0.3 enabled OK (python, jupyterlab_vim)


   The following extensions are outdated:
        jupyterlab_pygments

   Consider checking if an update is available for these packages.

In fact, I noticed with the version installed by homebrew, it will have two extra extensions by default, they are @jupyter-notebook/lab-extension v7.0.3 and jupyterlab_pygments v0.2.2, perhaps if install Jupyter Lab from pip3 install jupyterlab, it needs manually install @jupyter-notebook/lab-extension v7.0.3? (only personal conjecture, not been tested yet).

@verga
Copy link

verga commented Nov 14, 2023

Similar problem here with opensuse tumbleweed:

~ 23:45 $ jupyter labextension list
JupyterLab v4.0.7
/usr/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
        ipyparallel-labextension v8.6.1 enabled  X
        @jupyter-widgets/jupyterlab-manager v5.0.8 enabled OK (python, jupyterlab_widgets)
        @jupyter-notebook/lab-extension v7.0.5 enabled OK


   The following extensions are outdated:
        jupyterlab_pygments
        ipyparallel-labextension
        
   Consider checking if an update is available for these packages.

I verified that no other versions of ipyparallel or pygments are installed.

~ 23:45 $ ls /usr/share/jupyter/labextensions/
ipyparallel-labextension  jupyterlab_pygments  @jupyter-notebook  @jupyter-widgets
~ 23:52 $ ls /usr/share/jupyter/nbextensions/
ipyparallel  jupyter-js-widgets

Note that ipyparallel is shared with the notebook extensions.

@sergiupantiru
Copy link

Hi all,

Made it work with pip by installing on user:

pip3 install --user jupyterlab
pip3 install --user jupyterlab-code-formatter black isort
jupyter labextension list
JupyterLab v4.0.9
/Users/<username>/Library/Python/3.11/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
        jupyterlab_code_formatter v2.2.1 enabled  X (python, jupyterlab_code_formatter)


   The following extensions are outdated:
        jupyterlab_pygments
        jupyterlab_code_formatter

   Consider checking if an update is available for these packages.

for me it installed it in /Users/<username>/Library/Python/3.11/bin so need to add this to your path.

Hope it works for you as well

@lrtfm
Copy link

lrtfm commented Nov 25, 2023

According to the jupyter documentation, both the labextension and nbextension are searched in the data path;
see JUPYTER_PATH for more details. We can view the data path of Jupyter by running the command jupyter --paths.
An example output of jupyter --paths are shown below.

jupyter --paths
config:
    /Users/zzyang/.jupyter
    /Users/zzyang/Library/Python/3.11/etc/jupyter
    /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /Users/zzyang/Library/Jupyter
    /Users/zzyang/Library/Python/3.11/share/jupyter
    /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/zzyang/Library/Jupyter/runtime

For instances where Python is installed using homebrew, it's noteworthy that the pip packages are located in /opt/homebrew/lib. Packages installed by pip will be in /opt/homebrew/lib/python3.11/site-packages, and associated extensions may be placed in /opt/homebrew/share/jupyter. However, this directory may not be in the data path of Jupyter, as indicated by the output of jupyter --paths.

In addition, we can observed that /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages is symbolically linked to /opt/homebrew/lib/python3.11/site-packages.

❯ readlink -f /opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages
/opt/homebrew/lib/python3.11/site-packages

The reason for this symbolic link is unclear to me. I'm wondering if it would be better to make the latter a symbolic link to the former.

To address this issue, we have a few potential solutions:

  1. Install packages to user scope:
    As suggested by @sergiupantiru, you can install the packages to the user scope. This may resolve the issue by placing extensions in a location that's already in the Jupyter data path.

  2. Set the JUPYTER_PATH environment variable:
    Another option is to set the JUPYTER_PATH environment variable to include the directory where the extensions are located. This can be achieved by adding the following to your shell configuration file:

    export JUPYTER_PATH=/opt/homebrew/share/jupyter

    or start jupyter by

    JUPYTER_PATH=/opt/homebrew/share/jupyter jupyter <args> 
    
  3. Configure Jupyter Lab using a config file:
    Create a Jupyter Lab config file if you don't have one already:

    jupyter lab --generate-config

    Open the generated config file (typically located at ~/.jupyter/jupyter_lab_config.py) and add the path to c.LabServerApp.extra_labextensions_path:

    c.LabServerApp.extra_labextensions_path = ['/opt/homebrew/share/jupyter/labextensions']

    This configures Jupyter Lab to include the specified path for additional lab extensions.

@Lord-V15
Copy link

Adding export JUPYTER_PATH=/opt/homebrew/share/jupyter to my .zshrc file seems to be the simplest solution.

@krassowski krassowski added this to the 4.0.x milestone Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug os:macos Issues specific to macOS operating system status:Needs Discussion tag:Extensions
Projects
None yet
Development

No branches or pull requests

10 participants