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

Google AI Notebook Jupyterlab won't build with jupytext installed #686

Closed
abalter opened this issue Dec 8, 2020 · 12 comments
Closed

Google AI Notebook Jupyterlab won't build with jupytext installed #686

abalter opened this issue Dec 8, 2020 · 12 comments

Comments

@abalter
Copy link

abalter commented Dec 8, 2020

This is actually more of a support request than bug report.

When I install jupytext via the extension manager in a google ai notebook I get a popup saying that I need to run build. I click on the UI link. Then I get a message that the build failed.

Is this a known problem? Any suggestions?

Screenshot_2020-12-08 JupyterLab

Actually, when build at the terminal it seems to work:

(base) jupyter@balter-ai-clinvar:~/clinvar-ab$ jupyter lab build
[LabBuildApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `LabBuildApp`.
[LabBuildApp] JupyterLab 1.2.16
[LabBuildApp] Building in /opt/conda/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)

But still no jupytext manu.

@mwouts
Copy link
Owner

mwouts commented Dec 9, 2020

Hi @abalter , thank you for reporting this.

Well, I have no idea why the build fails, but... anyway you should install Jupytext using pip or conda, not an extension manager, because the extension manager would only install the extension, not the server part of Jupytext (while pip and conda would install both). Does that solve the issue?

Note that in JupyterLab there should now be a warning that the extension requires the pip or conda package to be installed as well, cf. #654. Maybe that is the part that does not work in Google AI notebook? Do you get a similar problem if you try to install, say, jupyterlab/git ?

@abalter
Copy link
Author

abalter commented Dec 10, 2020

Sooooo, I created a fresh ai notebook instance, and installed r-essentials, jupyterlab, jupytext, jupyter_contrib_nbextensions. How I have the notebook icon for RMD files, and I can open them as notebooks. Yay! But I still don't have the jupytext submenu under file. So I can't link notebooks except at the command line.

When I did jupyter lab build I got this message

"[email protected]" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab              Extension      Package
>=1.2.8 <1.3.0          >=2.0.0 <3.0.0 @jupyterlab/application
>=1.2.8 <1.3.0          >=2.0.0 <3.0.0 @jupyterlab/apputils
>=1.2.9 <1.3.0          >=2.0.0 <3.0.0 @jupyterlab/notebook

But the build did complete.

@mwouts
Copy link
Owner

mwouts commented Dec 10, 2020

Great! You're very close to it. Now the last two issues are

  • You are using JupyterLab 1.x, and the lab extension shipped with latest Jupytext is for JupyterLab 2.x. You should install a previous version of the extension with
jupyter labextension install [email protected]

See also https://jupytext.readthedocs.io/en/latest/install.html#jupytext-commands-in-jupyterlab

  • You're expecting a Jupytext submenu (and actually many people are 😄 , I should see at some point if we can get one), but in JupyterLab you won't get a menu, only additional commands in the command window (see the link above for a screenshot).

@abalter
Copy link
Author

abalter commented Dec 10, 2020

Thanks! Yes, guilty as charged--was looking for the submenu :)

As I have no control over the jupyter version in the ai notebooks, I'll have to downgrade my jupytext version.

Should I just use conda install jupytext=1.1.1 for consistency?

@abalter
Copy link
Author

abalter commented Dec 10, 2020

I installed with conda, and now I have the commands! However, I can't figure out what magic configuration will give me the option to pair with ipynb. As you can see, I only have the option to pair with Rmd, and the current open file is a Rmd.

image

@mwouts
Copy link
Owner

mwouts commented Dec 10, 2020

Should I just use conda install jupytext=1.1.1 for consistency?

No, don't please! That is a very old version of Jupytext.
You should install Jupytext latest from pip or conda, and just downgrade the extension with the command above.

In recent versions of the extension you will have a command "pair with ipynb notebook", like here on Binder:lab

image

@abalter
Copy link
Author

abalter commented Dec 11, 2020

So, I created a fresh ai notebook. and installed jupytext with jupyter labextension install [email protected].

I have the jupytext commands now, but it is not recognizing Rmd files. When I right-click the only option I get is to open with Editor.

Do I need to run a command to enable it? The formats I want to pair are ipynb an Rmd.

image

@abalter
Copy link
Author

abalter commented Dec 11, 2020

I just tried something else. I created a blank ipynb notebook. In the jupytext commands I clicked Pair Notebook with R Markdown. However, even after saving, closing, and reopening, no Rmd is created.

image

image

@mwouts
Copy link
Owner

mwouts commented Dec 11, 2020

Sorry @abalter , I should have been more explicit.

On the command line you should

  • install jupytext using conda first
  • and then, downgrade the lab extension

That is:

# Install the latest Jupytext (Python package + contents manager + notebook extension  + lab extension for JLab 2.x)
conda install jupytext 

# Downgrade the lab extension to the last version compatible with JupyterLab 1.x
jupyter labextension install [email protected]

@abalter
Copy link
Author

abalter commented Dec 11, 2020

Is this warning important:

Config option kernel_spec_manager_class not recognized by InstallLabExtensionApp.

@abalter
Copy link
Author

abalter commented Dec 11, 2020

I created another fresh install and it worked! I might write up my steps and put it in a blog post or something. I did need to do things in a very particular order:

  1. Create the AI Notebook
  2. conda install jupytext -y
  3. conda update --all -y
  4. jupyter labextension install [email protected]
  5. jupyter lab build
  6. Restart the AI Notebook

I was worried that if I ran conda update --all again it would move jupytext back up to the latest and require downgrading to 1.1.1 again. I tried it and this did not happen. But I'll report back if I do run into any problems.

Thanks for your help @mwouts!

@mwouts
Copy link
Owner

mwouts commented Dec 11, 2020

Excellent! Thanks for letting us know. Yes you're right, it is better to explicitely run jupyter lab build. Looking forward to reading your post 👍

@abalter abalter closed this as completed Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants