mathworks / jupyter-matlab-proxy

MATLAB Integration for Jupyter enables you to run MATLAB code in Jupyter Notebooks and other Jupyter environments. You can also open MATLAB in a browser directly from your Jupyter environment to use more MATLAB features.
Other
280 stars 36 forks source link

Compatibility with Notebook 7 #58

Closed casparvl closed 10 months ago

casparvl commented 1 year ago

I was trying to install jupyter-matlab-proxy, and saw that it lists a dependency on jupyter-contrib-nbextensions. It turns out that jupyter-contrib-nbextensions is incompatible with Notebook 7 (see here). Furthermore, jupyter-contrib-nbextensions hasn't been updated in 8 months.

I was wondering: does jupyter-matlab-proxy really need jupyter-contrib-nbextensions? I couldn't find any reference to e.g. imports, but I guess it could be used in different ways. In any case, considering the limited maintenance that seems to be happening on jupyter-contrib-nbextensions, it might be good to consider if jupyter-matlab-proxy could somehow be altered to avoid needing that dependency.

prabhakk-mw commented 1 year ago

Hi @casparvl Thank you for reporting this issue.

You are right, jupyter-matlab-proxy does not technically depend on jupyter-contrib-nbextensions.

Installing this package seemed to fix issues that some users were facing where the icons related to our integration would not be displayed on their JupyterLab interface.

So we decided to place a dependency on this package to reduce the incidence of this issue.

Given this failure with Notebook 7, I'm convinced that this package has outlived its intended purpose, and will remove it from the dependency list shortly.

casparvl commented 1 year ago

Thanks @prabhakk-mw for that response. Until there is a new release: I guess I can just remove this line before installing, and that should be sufficient, right? Or do you know of more places where changes would be needed?

prabhakk-mw commented 1 year ago

That's probably all you need to change. Let us know if that didn't resolve it, or if there are new issues that come up after you've installed for use with Notebook 7.

I haven't explicitly tested against Notebook 7 yet.

Thanks @casparvl

casparvl commented 1 year ago

Ok, thanks again! It might be a while before I get back on this (I have a few other priorities right now), but if I do, I'll definitely let you know here.

casparvl commented 1 year ago

Hm, I actually found a minute to try this out, but got a ton of errors:

      INFO:hatch_jupyter_builder.utils:> /scratch-nvme/1/casparl/generic/software/JupyterLab/4.0.5-GCCcore-12.3.0/bin/jlpm run build:prod
      node_modules/@jupyterlab/apputils/node_modules/@types/react/ts5.0/index.d.ts(3208,14): error TS2300: Duplicate identifier 'LibraryManagedAttributes'.
      node_modules/@jupyterlab/apputils/node_modules/@types/react/ts5.0/index.d.ts(3219,13): error TS2717: Subsequent property declarations must have the same type.  Property 'a' must be of type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>', but here has type 'DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>'.
...
      node_modules/vscode-languageserver-types/lib/umd/main.d.ts(893,10): error TS1336: An index signature parameter type cannot be a type alias. Consider writing '[uri: string]: TextEdit[]' instead.
      node_modules/vscode-languageserver-types/lib/umd/main.d.ts(917,10): error TS1336: An index signature parameter type cannot be a type alias. Consider writing '[id: string]: ChangeAnnotation' ins
tead.
      src/matlab_browser_button.ts(53,56): error TS2345: Argument of type 'MatlabToolbarButtonExtension' is not assignable to parameter of type 'WidgetExtension'.
        Types of property 'createNew' are incompatible.
          Type '(panel: NotebookPanel, context: IContext<INotebookModel>) => IDisposable' is not assignable to type '(widget: Widget, context: IContext<IModel>) => void | IDisposable'.
            Types of parameters 'panel' and 'widget' are incompatible.
              Type 'Widget' is missing the following properties from type 'NotebookPanel': _onSave, sessionContext, model, setConfig, and 31 more.
      src/matlab_files.ts(74,9): error TS2322: Type 'import("/gpfs/nvme1/1/casparl/ebbuildpath/jupytermatlabproxy/0.7.1/GCCcore-12.3.0/jupyter-matlab-proxy-0.7.1/src/jupyter_matlab_labextension/node_
modules/@jupyterlab/ui-components/lib/icon/labicon").LabIcon' is not assignable to type 'import("/gpfs/nvme1/1/casparl/ebbuildpath/jupytermatlabproxy/0.7.1/GCCcore-12.3.0/jupyter-matlab-proxy-0.7.1/s
rc/jupyter_matlab_labextension/node_modules/@jupyterlab/application/node_modules/@jupyterlab/ui-components/lib/icon/labicon").LabIcon'.
        Property 'svgElement' is protected but type 'LabIcon' is not a class derived from 'LabIcon'.
      src/matlab_files.ts(81,16): error TS2322: Type 'Token<ILauncher>' is not assignable to type 'Token<any>'.
        Types have separate declarations of a private property '_tokenStructuralPropertyT'.
      src/matlab_files.ts(81,27): error TS2322: Type 'Token<ICommandPalette>' is not assignable to type 'Token<any>'.
        Types have separate declarations of a private property '_tokenStructuralPropertyT'.
      Traceback (most recent call last):
        File "/scratch-nvme/1/casparl/generic/software/Python/3.11.3-GCCcore-12.3.0/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/scratch-nvme/1/casparl/generic/software/Python/3.11.3-GCCcore-12.3.0/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/scratch-nvme/1/casparl/generic/software/Python/3.11.3-GCCcore-12.3.0/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata
_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/scratch-nvme/1/casparl/generic/software/hatchling/1.18.0-GCCcore-12.3.0/lib/python3.11/site-packages/hatchling/build.py", line 56, in build_wheel
          return os.path.basename(next(builder.build(wheel_directory, ['standard'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/scratch-nvme/1/casparl/generic/software/hatchling/1.18.0-GCCcore-12.3.0/lib/python3.11/site-packages/hatchling/builders/plugin/interface.py", line 150, in build
          build_hook.initialize(version, build_data)
        File "/scratch-nvme/1/casparl/generic/software/jupyter-server/2.7.2-GCCcore-12.3.0/lib/python3.11/site-packages/hatch_jupyter_builder/plugin.py", line 87, in initialize
          raise e
        File "/scratch-nvme/1/casparl/generic/software/jupyter-server/2.7.2-GCCcore-12.3.0/lib/python3.11/site-packages/hatch_jupyter_builder/plugin.py", line 82, in initialize
          build_func(self.target_name, version, **build_kwargs)
        File "/scratch-nvme/1/casparl/generic/software/jupyter-server/2.7.2-GCCcore-12.3.0/lib/python3.11/site-packages/hatch_jupyter_builder/utils.py", line 115, in npm_builder
          run([*npm_cmd, "run", build_cmd], cwd=str(abs_path))
        File "/scratch-nvme/1/casparl/generic/software/jupyter-server/2.7.2-GCCcore-12.3.0/lib/python3.11/site-packages/hatch_jupyter_builder/utils.py", line 229, in run
          return subprocess.check_call(cmd, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/scratch-nvme/1/casparl/generic/software/Python/3.11.3-GCCcore-12.3.0/lib/python3.11/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/scratch-nvme/1/casparl/generic/software/JupyterLab/4.0.5-GCCcore-12.3.0/bin/jlpm', 'run', 'build:prod']' returned non-zero exit status 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

 Encountered error while generating package metadata.

Then, I checked your pyproject.toml again and saw jupyterhub<4.0.0 ... I'm guessing that is my problem here, I have 4.0.5, right?

I have a different software environment with a JupyterHub 3.X where I could give it a try, but I'll need to look into what dependencies I have available there, so it's a bit more work.

rashedmyt commented 11 months ago

Hi @casparvl

We haven't been able to reproduce the issue at our end. Can you confirm if you are still able to reproduce the issue in a fresh environment and with latest versions of packages?

Here is what I've tried:

  1. Created a new python environment using conda create -n jmp-gh-58 python=3.11.
  2. Installed Jupyter Notebook and jupyter-matlab-proxy using python -m pip install --no-cache notebook jupyter-matlab-proxy. (using --no-cache flag to force python to download latest packages)
  3. Installation of both packages work fine and I was able to launch Jupyter Notebook 7 and use MATLAB from Jupyter.
prabhakk-mw commented 10 months ago

@casparvl , We are closing this issue until we hear from you with responses to @rashedmyt 's questions. Thank you for using the MATLAB Integration for Jupyter!

casparvl commented 10 months ago

@prabhakk-mw yeah, sorry for not being able to follow up on this. I was looking into this in September, when we got a request from a teacher to facilitate a MATLAB based course in our Jupyter environment. Since then, my priorities have shifted to other things. Sorry I wasn't able to test your suggestion, but in all honesty, it is unlikely that I can do so in the foreseable future. So closing the ticket is fine by me.

If, in the future, I do find the time, I'll report back. Thanks for the help in any case!