jupyterlab-git icon indicating copy to clipboard operation
jupyterlab-git copied to clipboard

Installation using poetry: frontend is not installed

Open harrybiddle opened this issue 4 years ago • 12 comments

Description

After installing there is no "Git" icon in the left side panel.

image

Reproduce

With python version 3.6 (managed using pyenv), node 13.1.0, npm 6.12.1:

  1. poetry init -n
  2. poetry add jupyter jupyterlab jupyterlab-git
  3. poetry shell
  4. jupyter lab build
  5. jupyter lab
  6. Visit the browser.

Expected behavior

I expect to see the Git icon in the left panel

Context

output of jupyter lab build:

$ jupyter lab build
[LabBuildApp] JupyterLab 1.2.3
[LabBuildApp] Building in /Users/<user>/Library/Caches/pypoetry/virtualenvs/<virtualenv_name>/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)

output of jupyter lab:

$ jupyter lab
[I 14:23:08.833 LabApp] JupyterLab extension loaded from /Users/<user>/Library/Caches/pypoetry/virtualenvs/<virtualenv_name>/lib/python3.6/site-packages/jupyterlab
[I 14:23:08.833 LabApp] JupyterLab application directory is /Users/<user>/Library/Caches/pypoetry/virtualenvs/<virtualenv_name>/share/jupyter/lab
[I 14:23:09.191 LabApp] Serving notebooks from local directory: <cwd>
[I 14:23:09.191 LabApp] The Jupyter Notebook is running at:
[I 14:23:09.191 LabApp] http://localhost:8888/?token=<blahblah>
[I 14:23:09.191 LabApp]  or http://127.0.0.1:8888/?token=<blahblah>
[I 14:23:09.191 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:23:09.195 LabApp]

    To access the notebook, open this file in a browser:
        file:///Users/<user>/Library/Jupyter/runtime/nbserver-2059-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=<blahblah>
     or http://127.0.0.1:8888/?token=<blahblah>
[I 14:23:11.705 LabApp] Build is up to date

poetry.lock: poetry.lock.txt

jupyter serverextension list:

$ jupyter serverextension list
config dir: /Users/<user>/.jupyter
    jupyterlab_git  enabled
    - Validating...
      jupyterlab_git  OK
config dir: /Users/<user>/Library/Caches/pypoetry/virtualenvs/<virtualenv_name>/etc/jupyter
    jupyterlab  enabled
    - Validating...
      jupyterlab 1.2.3 OK
    nbdime  enabled
    - Validating...
      nbdime 1.1.0 OK

jupyter labextension list:

$ jupyter labextension list
JupyterLab v1.2.3
Known labextensions:
   app dir: /Users/<user>Library/Caches/pypoetry/virtualenvs/<virtualenv_name>/share/jupyter/lab
        nbdime-jupyterlab v1.0.0  enabled  OK

browser is Firefox 70.0.1 on Mac 10.15.

browser console:

Starting application in workspace: "/lab/workspaces/auto-v" index.js:34:4
>>>

harrybiddle avatar Nov 19 '19 13:11 harrybiddle

Aha! I've found I can get this to work if I run:

jupyter labextension install @jupyterlab/git

Should this step be part of the README?

harrybiddle avatar Nov 19 '19 13:11 harrybiddle

Hey @harrybiddle the README is up to date with the current master. But simpler deployment has not been published yet.

fcollonval avatar Nov 19 '19 17:11 fcollonval

Oh right, I see.

harrybiddle avatar Nov 20 '19 15:11 harrybiddle

I would be curious to find out if the labextension-install-via-setupy.py in HEAD works with poetry. From the paths you shared above, it seems like it should.

telamonian avatar Nov 21 '19 01:11 telamonian

Unfortunately it doesn't seem like it does work through poetry alone 😞 (assuming that the install-via-setup.py is already in master). If I do this...

$ mkdir /tmp/test && cd /tmp/test

$ cat <<EOF > pyproject.toml
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Nobody <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.6"
jupyter = "^1.0"
jupyterlab = "^1.2"
jupyterlab-git = {git = "https://github.com/jupyterlab/jupyterlab-git.git", rev = "master"}
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
EOF

$ poetry install
Creating virtualenv test-py3.6 in /Users/<user>/Library/Caches/pypoetry/virtualenvs
...
  - Installing jupyterlab-git (0.9.0 master)

$ poetry run jupyter lab build
[LabBuildApp] JupyterLab 1.2.3
[LabBuildApp] Building in /Users/<user>/Library/Caches/pypoetry/virtualenvs/test-py3.6/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)

$ poetry run jupyter lab

...then there is no Git icon in the frontend. If I run the jupyter labextension install then it appears.

However, if I create the Poetry environment without jupyterlab-git, then drop into the virtualenv and install jupyterlab-git using pip then it works fine.

Maybe this is an issue with Poetry not running some pip setup script? If you could describe to me at a high level how this is supposed to work I'd be happy to take it over to the Poetry folks.

harrybiddle avatar Nov 21 '19 09:11 harrybiddle

Thanks @harrybiddle to look it up. I'll rename and reopen the issue.

fcollonval avatar Nov 21 '19 09:11 fcollonval

The steps done by pip when installing from the source are:

  • compile the frontend extension https://github.com/jupyterlab/jupyterlab-git/blob/50952c9c8ba8ba6c4dab3eca217e8cba08655d56/setup.py#L48
  • put the resulting package in labextension folder
  • copy the package file in the default extension folder of Jupyterlab https://github.com/jupyterlab/jupyterlab-git/blob/50952c9c8ba8ba6c4dab3eca217e8cba08655d56/setup.py#L37
  • Jupyterlab then detects it and proposes the user to re build

fcollonval avatar Nov 21 '19 09:11 fcollonval

Awesome, that's perfect. I've created an issue at https://github.com/sdispater/poetry/issues/1615. At the time of writing they had 291 issues, so not sure if they'll ever get to it! 🤞

harrybiddle avatar Nov 21 '19 10:11 harrybiddle

Weird then that nbdime installs correctly, since its labextension gets installed via a very similar protocol in its own setup.py

telamonian avatar Nov 21 '19 18:11 telamonian

I had a quick look. nbdime is not using jlpm to build the js files. Could it be that in our case, as jupyterlab installation is requested at the same time, that the js build fails due to a jlpm not found error?

fcollonval avatar Nov 22 '19 08:11 fcollonval

To investigate your theory I did an experiment:

  1. Install the poetry environment as above, except without the jupyterlab-git line
  2. Add the jupyterlab-git line to pyproject.toml. Run poetry lock && poetry install.
  3. jupyter lab build

However, the frontend element still did not appear. I tried to put Poetry into verbose mode but I still can't find any logs. If I get a chance I'll try another investigation.

harrybiddle avatar Nov 22 '19 15:11 harrybiddle

Thx Harry for investigating more. A new version of the package will soon be available with the lab extension shipped within it. Maybe this will at least solve the "classical" installation (i.e. not via github).

fcollonval avatar Nov 22 '19 15:11 fcollonval