jupyter-book / jupyterlab-myst

Use MyST Markdown directly in Jupyter Lab
https://jupyter-book.github.io/jupyterlab-myst/
BSD 3-Clause "New" or "Revised" License
141 stars 16 forks source link

Unable to install jupyterlab-myst enhancement in jupyterlab #197

Closed FrankHubeny closed 7 months ago

FrankHubeny commented 8 months ago

Description

I can find the jupyterlab-myst extension after searching for it in Jupyter Lab using extension path C:\Python311. I click the "Install" link. It appears to be doing something and after a few seconds I receive the message "You will need to refresh the web page to apply the changes." I press OK and Jupyter Lab is refreshed. However, I do not see jupyterlab-myst as one of the installed extensions.

I have the following extensions already installed and enabled: jupyter-notebook-lab-extension, jupyter-widgets-jupyterlab-manager, jupyterlab-pygments

I have the following extension installed but disabled: nglview-js-widgets

I am running Windows 10.

To try to fix the problem I upgraded to JupyterLab Version 4.0.10, but this did not help. I installed jupyterlab-myst using pip install. I am not using Anaconda.

C:\Users\huben>python --version Python 3.11.4

Here is the jupyter --version output. I upgraded all of these to try to fix the problem, but it did not help.

C:\Users\huben>jupyter --version Selected Jupyter core packages... IPython : 8.19.0 ipykernel : 6.28.0 ipywidgets : 8.1.1 jupyter_client : 8.6.0 jupyter_core : 5.3.1 jupyter_server : 2.12.1 jupyterlab : 4.0.10 nbclient : 0.7.4 nbconvert : 7.7.3 nbformat : 5.9.2 notebook : 7.0.6 qtconsole : 5.5.1 traitlets : 5.14.0

Running as administrator did not help either.

Proposed solution

Additional notes

welcome[bot] commented 8 months ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

FrankHubeny commented 8 months ago

I tried the following which worked.

I connected as administrator to a command prompt and ran the following:

C:\WINDOWS\system32>jupyter labextension install jupyterlab-myst ←[33m(Deprecated) Installing extensions with the jupyter labextension install command is now deprecated and will be removed in a future major version of JupyterLab.

Users should manage prebuilt extensions with package managers like pip and conda, and extension authors are encouraged to distribute their extensions as prebuilt packages ←[0m Building jupyterlab assets (production, minimized) \

When this finished (in about a minute) I connected through my regular account and started jupyter lab. I can now see the jupyterlab-myst extension, installed and enabled, and the test md file displayed as expected.

This issue could be closed unless you would like more information from me.

agoose77 commented 8 months ago

Hi @FrankHubeny, thanks for opening an issue. The solution that you found is not one that we'd encourage other users to try because it uses the legacy architecture for installing extensions in JupyterLab. However, I am glad that it solved the immediate problem for you!

From the information you've provided, it's not clear whether you actually refreshed your web-browser after installing jupyterlab-myst through the extension manager. If you do not do this, the extension is never loaded.

For ease of updates, I would encourage you to

  1. Revert the old-style installation (with jupyter labextension uninstall jupyterlab-myst)
  2. Remove the pip installation (python -m pip uninstall jupyterlab-myst)
  3. Restart JupyterLab
  4. Confirm that jupyterlab-myst is not visible in the extension panel
  5. Install jupyterlab-myst through the extension panel (or pip if you're comfortable)
  6. Refresh your browser
  7. Confirm that the extension works!

Let me know if you run in to any problems!

FrankHubeny commented 8 months ago

Hello @agoose77, I was not able to complete step 5 using the extension panel. Below is what I did:


I stopped Jupyter Lab.

On my account I ran the following.

D:\Writing\JupyterLab>jupyter labextension uninstall jupyterlab-myst ←[33m(Deprecated) Uninstalling extensions with the jupyter labextension uninstall command is now deprecated and will be removed in a future major version of JupyterLab.

Users should manage prebuilt extensions with package managers like pip and conda, and extension authors are encouraged to distribute their extensions as prebuilt packages ←[0m Uninstalling jupyterlab-myst from C:\Python311\share\jupyter\lab\extensions Building jupyterlab assets (production, minimized) C:\Python311\Lib\site-packages\jupyterlab\debuglog.py:56: UserWarning: An error occurred. warnings.warn("An error occurred.") C:\Python311\Lib\site-packages\jupyterlab\debuglog.py:57: UserWarning: PermissionError: [Errno 13] Permission denied: 'C:\Python311\share\jupyter\lab\staging\index.js' warnings.warn(msg[-1].strip()) C:\Python311\Lib\site-packages\jupyterlab\debuglog.py:58: UserWarning: See the log file for details: C:\Users\huben\AppData\Local\Temp\jupyterlab-debug-b1dipx8o.log warnings.warn(f"See the log file for details: {log_path!s}")

D:\Writing\JupyterLab>python -m pip uninstall jupyterlab-myst Found existing installation: jupyterlab_myst 2.1.0 Uninstalling jupyterlab_myst-2.1.0: Would remove: c:\python311\lib\site-packages\jupyterlab_myst-2.1.0.dist-info* c:\python311\lib\site-packages\jupyterlab_myst* Proceed (Y/n)? Y Successfully uninstalled jupyterlab_myst-2.1.0

I opened a command prompt and restarted Jupyter Lab. I received a message to rebuild it.
I received the following error when trying to rebuild it:

Build failed with 500. If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').

If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.

I ran 'jupyter lab build' in my own account and received an error message:

C:\Python311\Lib\site-packages\jupyterlab\debuglog.py:56: UserWarning: An error occurred. warnings.warn("An error occurred.") C:\Python311\Lib\site-packages\jupyterlab\debuglog.py:57: UserWarning: PermissionError: [Errno 13] Permission denied: 'C:\Python311\share\jupyter\lab\staging\index.js' warnings.warn(msg[-1].strip()) C:\Python311\Lib\site-packages\jupyterlab\debuglog.py:58: UserWarning: See the log file for details: C:\Users\huben\AppData\Local\Temp\jupyterlab-debug-agszwyjl.log warnings.warn(f"See the log file for details: {log_path!s}")

I then connected as administrator and was able to run 'jupyter lab build'

C:\WINDOWS\system32>jupyter lab build [LabBuildApp] JupyterLab 4.0.10 [LabBuildApp] Building in C:\Python311\share\jupyter\lab [LabBuildApp] Building jupyterlab assets (production, minimized)

--- Step 4

I restarted jupyter lab from a new command prompt opened under my own account.
The jupyterlab-myst extension was not in the installed list.

--- Step 5

I searched the PYPI Manager for jupyterlab-myst.
When I tried to install jupyterlab-myst from the PYPI Manager I received the following error:

Error when performing an action.

Reason given:

Error: ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: 'C:\Python311\etc\jupyter\jupyter_notebook_config.d\jupyterlab_myst.json' Consider using the --user option or check the permissions.

So I shut down Jupyter Lab. I started a command prompt as administrator. From that prompt I started jupyter lab. I searched and found the extension. I clicked "Install". I received the following message in a pop up box.

Information You will need to refresh the web page to apply the changes.

I clicked "OK". I reloaded the page, but the jupyterlab-myst extension was not under the installed extension. I shut down jupyter lab and restarted with a new command prompt. The extension was still not under the installed extensions.

I am attaching a screenshot showing I can see the extension when I search for it, but it is not installed.

jupyterlab-extensionNotInstalled

Step 5 failed. These steps are what I originally tried before opening the bug.


What specific pip command should I run under which account (my own or administrator)?

agoose77 commented 8 months ago

@FrankHubeny this fell off my observability horizon, hence the lack of replies! I'll make an explicit note to add it back in.

agoose77 commented 8 months ago

Thanks @FrankHubeny, your troubleshooting efforts make this a lot easier.

It looks like this is now about permissions and how your JupyterLab has been installed. Typically, JupyterLab should be installed as a user, and never require administrator privileges.

The "easy" (from my perspective!) solution at this stage is to completely remove JupyterLab itself, and install it in a dedicated environment. If you're comfortable with the idea of creating a Python virtual environment, then I'd suggest that approach. But, if you're not, have you looked into https://github.com/jupyterlab/jupyterlab-desktop?

FrankHubeny commented 8 months ago

Thank you, @agoose77 . I will try the jupyterlab desktop. It is the first I heard of it.

agoose77 commented 7 months ago

I'm going to close this now, as I think we've found a resolution :)