jupyterlab / jupyterlab-latex

JupyterLab extension for live editing of LaTeX documents
BSD 3-Clause "New" or "Revised" License
630 stars 69 forks source link

installing the extension in a default jupyter/scipy-notebook container does not work #23

Closed oroszl closed 6 years ago

oroszl commented 6 years ago

I was trying to install this extension in a docker container created from the official jupyter/scipy-notebook image that is hosted on docker hub. Apparently this image has jupyterlab version 0.30.6 installed. I followed the install descriptions as a local user by doing pip install . --user and jupyter labextension install . which ends with the following warnings

warning " > pdfjs-dist@2.0.230" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0".
warning "pdfjs-dist > worker-loader@1.1.0" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 11.66s.
> /opt/conda/bin/npm pack /home/jovyan/jupyterlab-latex
jupyterlab-latex-0.1.1.tgz
"/home/jovyan/jupyterlab-latex" is not a valid extension:
Missing extension module "lib/latex.js"
Missing mimeExtension module "lib/pdf.js"

after this doing jupyter serverextension enable jupyterlab_latex runs without warnings and produces the following normal looking output:

Enabling: jupyterlab_latex
- Writing config: /home/jovyan/.jupyter
    - Validating...
      jupyterlab_latex  OK

launching jupyterlab and right clicking on a .tex file the menu does not have the expected Show LaTeX Preview option.

are there some unmentioned dependencies that I am missing ?

t-makaro commented 6 years ago

I'm experiencing this same issue, but I'm trying to install this in my base anaconda installation also with jupyterlab 30.6.

mpacer commented 6 years ago

We haven't officially released a version with known compatibilities.

The plan is to release it next week where it will be compatible with jupyterlab version 0.31.

ian-r-rose commented 6 years ago

Hi @oroszl and @t-makaro , we have now released the first functional version of this extension, as well as updated the build instructions. If you have any problems, feel free to reopen this or open a new issue.

oroszl commented 6 years ago

@ian-r-rose is the new version on pip already? I tried to simply follow the non development installations and it goes through without any problem but I still do not have any Show LaTeX Preview in my right click menu.

ian-r-rose commented 6 years ago

It should be: https://pypi.python.org/pypi/jupyterlab-latex Have you installed the labextension as well?

t-makaro commented 6 years ago

Similar problem. I installed from pip, and ran the labextension install and serverextension enable, and it appeared to work fine, but Show LaTeX Preview is not available.

ian-r-rose commented 6 years ago

What version of JupyterLab do you have installed? Are there any error messages displayed during the build?

Can you show the result of jupyter labextension list?

oroszl commented 6 years ago

i did the following pip install jupyterlab_latex --upgrade --user jupyter labextension install @jupyterlab/latex I have the following versions:

jupyterlab (0.31.1)
jupyterlab-latex (0.1.0)
t-makaro commented 6 years ago

I got these warnings during labextension install

warning "@jupyterlab/json-extension > react-highlighter@0.4.2" has unmet peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@jupyterlab/json-extension > react-json-tree@0.10.9" has unmet peer dependency "react@^15.0.0".
warning "@jupyterlab/json-extension > react-json-tree@0.10.9" has unmet peer dependency "react-dom@^15.0.0".
warning "@jupyterlab/vdom-extension > @nteract/transform-vdom@1.1.1" has unmet peer dependency "react@^15.6.1".
warning "uglifyjs-webpack-plugin > schema-utils > ajv-keywords@2.1.1" has unmet peer dependency "ajv@^5.0.0".
warning Error running install script for optional dependency: "C:\\Users\\TMOko\\Anaconda3\\share\\jupyter\\lab\\staging\\node_modules\\canvas: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: \nDirectory: C:\\Users\\TMOko\\Anaconda3\\share\\jupyter\\lab\\staging\\node_modules\\canvas\nOutput:\ngyp info it worked if it ends with ok\ngyp info using node-gyp@3.6.2\ngyp info using node@6.10.3 | win32 | x64\ngyp ERR! configure error \ngyp ERR! stack Error: Can't find Python executable \"C:\\Users\\TMOko\\Anaconda3\\python.EXE\", you can set the PYTHON env variable.\ngyp ERR! stack     at Object.failNoPython (C:\\Users\\TMOko\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\lib\\configure.js:483:19)\ngyp ERR! stack     at Object.<anonymous> (C:\\Users\\TMOko\\AppData\\Local\\Yarn\\config\\global\\node_modules\\node-gyp\\lib\\configure.js:508:16)\ngyp ERR! stack     at C:\\Users\\TMOko\\AppData\\Local\\Yarn\\config\\global\\node_modules\\graceful-fs\\polyfills.js:284:29\ngyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)\ngyp ERR! System Windows_NT 10.0.15063\ngyp ERR! command \"c:\\\\users\\\\tmoko\\\\anaconda3\\\\Library\\\\bin\\\\node.exe\" \"Csuccess Saved lockfile.

Versions:

jupyterlab (0.31.1)
jupyterlab-latex (0.1.0)
notebook (5.3.1)
ian-r-rose commented 6 years ago

@t-makaro It seems that the README.md is not completely clear about where to click. Can you verify that you are right-clicking in a .tex document? image

t-makaro commented 6 years ago

Ok, I thought it was on the file browser. I see the command, and now I get the LaTeX Error:

{"message": "Unhandled error", "reason": null, "traceback": "Traceback (most recent call last):\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\web.py\", line 1511, in _execute\n    result = yield result\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\gen.py\", line 1055, in run\n    value = future.result()\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\concurrent.py\", line 238, in result\n    raise_exc_info(self._exc_info)\n  File \"<string>\", line 4, in raise_exc_info\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\gen.py\", line 1063, in run\n    yielded = self.gen.throw(*exc_info)\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\jupyterlab_latex\\__init__.py\", line 205, in get\n    out = yield self.run_latex(cmd_sequence)\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\gen.py\", line 1055, in run\n    value = future.result()\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\concurrent.py\", line 238, in result\n    raise_exc_info(self._exc_info)\n  File \"<string>\", line 4, in raise_exc_info\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\gen.py\", line 307, in wrapper\n    yielded = next(result)\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\jupyterlab_latex\\__init__.py\", line 166, in run_latex\n    stderr=Subprocess.STREAM)\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\process.py\", line 236, in __init__\n    self.stdout = PipeIOStream(out_r, io_loop=self.io_loop)\n  File \"C:\\Users\\TMOko\\Anaconda3\\lib\\site-packages\\tornado\\iostream.py\", line 1521, in __init__\n    _set_nonblocking(fd)\nTypeError: 'NoneType' object is not callable\n"}
oroszl commented 6 years ago

I do not get a popup but a new frame with the title LaTeX Error and content

<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">

    <title>Jupyter Notebook</title>
    <link id="favicon" rel="shortcut icon" type="image/x-icon" href="/static/base/images/favicon.ico?v=97c6417ed01bdc0ae3ef32ae4894fd03">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="stylesheet" href="/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c" type="text/css" />
    <link rel="stylesheet" href="/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56" type="text/css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="/static/style/style.min.css?v=7009f4636b740c85faf61687cd9bdfb8" type="text/css"/>

<style type="text/css">
/* disable initial hide */
div#header, div#site {
    display: block;
}
</style>

    <link rel="stylesheet" href="/custom/custom.css" type="text/css" />
    <script src="/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe" type="text/javascript" charset="utf-8"></script>
    <script src="/static/components/preact/index.js?v=5b98fce8b86ce059de89f9e728e16957" type="text/javascript"></script>
    <script src="/static/components/proptypes/index.js?v=c40890eb04df9811fcc4d47e53a29604" type="text/javascript"></script>
    <script src="/static/components/preact-compat/index.js?v=d376eb109a00b9b2e8c0d30782eb6df7" type="text/javascript"></script>
    <script src="/static/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce" type="text/javascript" charset="utf-8"></script>
    <script>
      require.config({

          urlArgs: "v=20180119210702",

          baseUrl: '/static/',
          paths: {
            'auth/js/main': 'auth/js/main.min',
            custom : '/custom',
            nbextensions : '/nbextensions',
            kernelspecs : '/kernelspecs',
            underscore : 'components/underscore/underscore-min',
            backbone : 'components/backbone/backbone-min',
            jed: 'components/jed/jed',
            jquery: 'components/jquery/jquery.min',
            json: 'components/requirejs-plugins/src/json',
            text: 'components/requirejs-text/text',
            bootstrap: 'components/bootstrap/js/bootstrap.min',
            bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
            'jquery-ui': 'components/jquery-ui/ui/minified/jquery-ui.min',
            moment: 'components/moment/min/moment-with-locales',
            codemirror: 'components/codemirror',
            termjs: 'components/xterm.js/dist/xterm',
            typeahead: 'components/jquery-typeahead/dist/jquery.typeahead.min',
          },
          map: { // for backward compatibility
              "*": {
                  "jqueryui": "jquery-ui",
              }
          },
          shim: {
            typeahead: {
              deps: ["jquery"],
              exports: "typeahead"
            },
            underscore: {
              exports: '_'
            },
            backbone: {
              deps: ["underscore", "jquery"],
              exports: "Backbone"
            },
            bootstrap: {
              deps: ["jquery"],
              exports: "bootstrap"
            },
            bootstraptour: {
              deps: ["bootstrap"],
              exports: "Tour"
            },
            "jquery-ui": {
              deps: ["jquery"],
              exports: "$"
            }
          },
          waitSeconds: 30,
      });

      require.config({
          map: {
              '*':{
                'contents': 'services/contents',
              }
          }
      });

      // error-catching custom.js shim.
      define("custom", function (require, exports, module) {
          try {
              var custom = require('custom/custom');
              console.debug('loaded custom.js');
              return custom;
          } catch (e) {
              console.error("error loading custom.js", e);
              retur
ian-r-rose commented 6 years ago

@oroszl Can you show the result of jupyter serverextension list?

You may need to enable it by running

jupyter serverextension enable --sys-prefix jupyterlab_latex
oroszl commented 6 years ago

That seems to solve the issue! I have notebook version 5.3.1 though.. so it seemed from the instruction that this line is not needed anymore.

ian-r-rose commented 6 years ago

Yes, the intention was that after notebook 5.3 it should no longer be necessary to do the serverextension enable step. This feature is brand new, though, and it seems that something has not gone according to plan. I will look into it further...

mpacer commented 6 years ago

I think if you run into this and run pip install -U jupyterlab-latex that should also run the serverextension enabling step even if you already had a version of this. There is still an issue where this doesn't work in an editable install, but that's technically a different issue, so I'm going to close this issue for now.