Skip to content

Extension installing but not working through pip install on JupyterLab 3.5.0 #237

New issue

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

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

Already on GitHub? # to your account

Closed
johnnybarrels opened this issue Dec 1, 2022 · 11 comments

Comments

@johnnybarrels
Copy link

Describe the bug
After installing this package through pip, then starting Jupyter Lab (3.5.0), the package is not working. When clicking on the Code Snippet Explorer icon in left sidebar, the sidebar window is completely blank (see screenshots below). Also, when right-clicking a cell and selecting Save As Code Snippet, nothing happens.

Upon opening the developer console, I notice a jupyterlab-code-snippets:snippets validation error of "should have required property 'id'" (see screenshot below).

To Reproduce

  1. Install JupyterLab >= 3.5.0
  2. pip install jupyterlab-code-snippets
  3. Click on Code Snippet Explorer icon in left sidebar
  4. (Observe that the sidebar window is completely blank)

Expected behavior
Normal use of extension: snippets sidebar window not blank, able to save code in cells as new snippet.

Screenshots
Blank Code Snippet Explorer window

image

Developer console

image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Edge
jupyter_client           7.4.4
jupyter_core             4.11.2
jupyter-server           1.23.0
jupyterlab               3.5.0
jupyterlab-code-snippets 2.1.0
jupyterlab-pygments      0.2.2
jupyterlab_server        2.16.2
jupyterlab-widgets       1.1.1
ipykernel                6.17.0
ipython                  8.6.0
ipython-genutils         0.2.0
ipywidgets               7.7.2
@johnnybarrels
Copy link
Author

Issue resolved by using solution listed here: #228 (comment)

I would submit a PR to resolve this issue but not sure which copy of the plotting_sine snippet to add "id": 0, as it is already present in:

{"name":"plotting_sine","description":"Plotting code for sine graph using matplotlib.","language":"Python","code":["import matplotlib.pyplot as plt","import numpy as np","","x = np.linspace(0, 10, 100)","","plt.plot(x, np.sin(x))","plt.plot(x, np.cos(x))","","plt.show()"],"id":0,"tags":["math"]}

and:

@jahn96
Copy link
Collaborator

jahn96 commented Dec 2, 2022

Hi @johnnybarrels,

I have started looking into this issue. I think the id needs to start from 1. With the recent jupyterlab, id of 0 means undefined. But, we have some bigger build issues. Will create a PR if it's done!

@jahn96
Copy link
Collaborator

jahn96 commented Dec 26, 2022

Should work now with a new version!

@jahn96 jahn96 closed this as completed Dec 26, 2022
@668168
Copy link

668168 commented Jan 10, 2023

I has the same issue. but resolve with another simple method, @jahn96 do you has any idea?

image

work well with :

image

@ekungurov
Copy link

Current version is 2.2.0 but conda-forge hasn't been updated yet. Is it on their side?

@668168
Copy link

668168 commented Jan 14, 2023

I install the extention 4 days ago actually , by the follow command .
I can not get the version number , because pip freeze do not show this extention name.

jupyter labextension install jupyterlab-code-snippets
jupyter  lab clean 
jupyter lab build

@ekungurov
Copy link

@shuivin this command will print something:

jupyter labextension list

As you didn't installed with pip, it didn't added pip package.

@668168
Copy link

668168 commented Jan 14, 2023

Thanks!

the code-snippets has the right version, and pip has installed.

pip 21.1.1
jupyterlab-code-snippets v2.2.0 enabled ok

PS D:\temp> jupyter labextension list
JupyterLab v3.5.2
C:\Users\zh0ngx1ngzhe-su\AppData\Roaming\Python\share\jupyter\labextensions
        @jupyterlab/fasta-extension v3.2.0 enabled ok (python, jupyterlab-fasta)
        @jupyterlab/geojson-extension v3.3.1 enabled ok (python, jupyterlab-geojson)
        @jupyterlab/katex-extension v3.3.0 enabled ok (python, jupyterlab-katex)
        @jupyterlab/mathjax3-extension v4.3.0 enabled ok (python, jupyterlab-mathjax3)
        @jupyterlab/vega2-extension v3.2.0 enabled ok (python, jupyterlab-vega2)
        @jupyterlab/vega3-extension v3.2.0 enabled ok (python, jupyterlab-vega3)

c:\python\share\jupyter\labextensions
        jupyter-matplotlib v0.11.2 enabled ok
        jupyterlab_pygments v0.2.2 enabled ok (python, jupyterlab_pygments)
        @jupyter-widgets/jupyterlab-manager v5.0.5 enabled ok (python, jupyterlab_widgets)

Other labextensions (built into JupyterLab)
   app dir: C:\Python\share\jupyter\lab
        jupyterlab-code-snippets v2.2.0 enabled ok


Disabled extensions:
    @jupyterlab/mathjax2-extension:plugin
PS D:\temp>
PS D:\temp> pip --version
pip 21.1.1 from c:\python\lib\site-packages\pip (python 3.8)

@ekungurov
Copy link

@shuivin you have pip installed, but you didn't install plugin with pip. That's why pip doesn't show it. That's pretty expected result for your case.

it didn't added pip package.

Yeah, I should have said pypi package, not "pip" package.

@asteppke
Copy link

@jahn96: Is this really fixed in the 2.2.0/2.2.1 version? After installing the current version from pypi (pip says that this is 2.2.1, jupyter says it is 2.2.0) the issue remains and the workaround of adding an empty snippets is still required.

@richlysakowski
Copy link

I found a related error that caused the extra junk to persist.

jupyterlab/jupyterlab#4126

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants