jupyterlab-monaco
jupyterlab-monaco copied to clipboard
Comprehensive install script
As I'm experiencing troubles setting up the right dev environment on WSL, I thought it useful to solve it in an issue here. I'm on WSL x64 (Ubuntu 16.04) using Miniconda3.
I went through the jupyterlab contributing guide and the instructions on this repo and did the following in a folder /mnt/d/jlab/:
conda create -n monaco
source activate monaco
conda install -c conda-forge nodejs notebook nb_conda_kernels
git clone https://github.com/<your-github-username>/jupyterlab.git
cd jupyterlab
pip install -e .
jlpm install
jlpm run build # Build the dev mode assets (optional)
jlpm run build:core # Build the core mode assets (optional)
jupyter lab build # Build the app dir assets (optional)
cd ..
git clone https://github.com/jupyterlab/jupyterlab-monaco.git
cd jupyterlab-monaco
yarn install
yarn run build
jupyter labextension link .
That final command sometimes ends up in an infinite loop, supplying dev mode argument helps it to pass. I tried experimenting with rebuilding after I made the changes in that config.json you mentioned somewhere, but I can't get it to work.
I can start JupyterLab with the default command, but the text editor is still codemirror.
Would you mind helping out with a comprehensive bash file that should work in principle? Did I forget anything or got something wrong?
I guess it's just "first-timer" issues.
You don't need to have a dev install of jupyterlab, and you don't need the nb_conda_kernels. This should work:
conda create -c conda-forge -n monaco jupyterlab nodejs
conda activate monaco
git clone https://github.com/jupyterlab/jupyterlab-monaco.git
cd jupyterlab-monaco
npm install
npm run build
jupyter labextension link .
(In fact, if you're just using the extension instead of developing it, you could do jupyter labextension install .
instead of linking it)
Thanks a lot! I thought I'd get a dev install of JupyterLab in case something needed changing over there as well. I'll try it right away and let you know how it goes.
I passed the install and build with some minor warnings, but the jupyter labextension link .
hangs indefinitely.
Here's my terminal log:
(monaco) tiemen@LAPTOP:/mnt/d/jupyterlab/jupyterlab-monaco$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 84 packages in 16.002s
(monaco) tiemen@LAPTOP:/mnt/d/jupyterlab/jupyterlab-monaco$ npm run build
> [email protected] build /mnt/d/jupyterlab/jupyterlab-monaco
> webpack && tsc
Hash: 7ed530f81ebe883f2526
Version: webpack 4.6.0
Time: 8089ms
Built at: 2018-04-21 15:35:05
Asset Size Chunks Chunk Names
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-css.worker.bundle.js.map 1.52 MiB css.worker [emitted] css.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-css.worker.bundle.js 1.43 MiB css.worker [emitted] css.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-html.worker.bundle.js 832 KiB html.worker [emitted] html.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-json.worker.bundle.js 749 KiB json.worker [emitted] json.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-ts.worker.bundle.js 7.85 MiB ts.worker [emitted] ts.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-0.bundle.js 918 bytes 0 [emitted]
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-editor.worker.bundle.js 453 KiB editor.worker [emitted] editor.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-editor.worker.bundle.js.map 468 KiB editor.worker [emitted] editor.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-html.worker.bundle.js.map 887 KiB html.worker [emitted] html.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-json.worker.bundle.js.map 769 KiB json.worker [emitted] json.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-ts.worker.bundle.js.map 8.78 MiB ts.worker [emitted] ts.worker
JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-0.bundle.js.map 690 bytes 0 [emitted]
Entrypoint editor.worker = JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-editor.worker.bundle.js JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-editor.worker.bundle.js.map
Entrypoint json.worker = JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-json.worker.bundle.js JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-json.worker.bundle.js.map
Entrypoint css.worker = JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-css.worker.bundle.js JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-css.worker.bundle.js.map
Entrypoint html.worker = JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-html.worker.bundle.js JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-html.worker.bundle.js.map
Entrypoint ts.worker = JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-ts.worker.bundle.js JUPYTERLAB_FILE_LOADER_jupyterlab-monaco-ts.worker.bundle.js.map
[./node_modules/monaco-editor/esm/vs/editor/common/services sync recursive] ./node_modules/monaco-editor/esm/vs/editor/common/services sync 160 bytes {0} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 489 bytes {ts.worker} {html.worker} {css.worker} {json.worker} {editor.worker} [built]
[./node_modules/webpack/buildin/harmony-module.js] (webpack)/buildin/harmony-module.js 573 bytes {ts.worker} [built]
+ 111 hidden modules
WARNING in ./node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js
378:12-387:17 Critical dependency: the request of a dependency is an expression
@ ./node_modules/monaco-editor/esm/vs/editor/common/services/editorSimpleWorker.js
@ ./node_modules/monaco-editor/esm/vs/editor/editor.worker.js
(monaco) tiemen@LAPTOP:/mnt/d/jupyterlab/jupyterlab-monaco$ jupyter labextension link .
> /mnt/c/miniconda3/envs/monaco/bin/npm pack /mnt/d/jupyterlab/jupyterlab-monaco
jupyterlab-monaco-0.1.0.tgz
> /mnt/c/miniconda3/envs/monaco/bin/npm pack /mnt/d/jupyterlab/jupyterlab-monaco
jupyterlab-monaco-0.1.0.tgz
> /mnt/c/miniconda3/envs/monaco/bin/npm pack /mnt/d/jupyterlab/jupyterlab-monaco
jupyterlab-monaco-0.1.0.tgz
> node /mnt/c/miniconda3/envs/monaco/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install
yarn install v1.5.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@jupyterlab/json-extension > [email protected]" has incorrect peer dependency "react@^15.0.0".
warning "@jupyterlab/json-extension > [email protected]" has incorrect peer dependency "react-dom@^15.0.0".
warning "@jupyterlab/vdom-extension > @nteract/[email protected]" has incorrect peer dependency "react@^15.6.1".
error An unexpected error occurred: "ENOENT: no such file or directory, copyfile '/home/tiemen/.cache/yarn/v1/npm-monaco-editor-0.12.0-cd8621017526b57746245104d764bbf52ad42283/esm/vs/basic-languages/yaml/yaml.contribution.js' -> '/mnt/c/miniconda3/envs/monaco/share/jupyter/lab/staging/node_modules/monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution.js'".
info If you think this is a bug, please open a bug report with the information provided in "/mnt/c/miniconda3/envs/monaco/share/jupyter/lab/staging/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
> node /mnt/c/miniconda3/envs/monaco/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build:prod
yarn run v1.5.1
$ webpack --config webpack.prod.config.js
So, just for clarity: the current workaround is to run the final command with the --dev
flag until the webpack issue is resolved.
conda create -c conda-forge -n monaco jupyterlab nodejs
conda activate monaco
git clone https://github.com/jupyterlab/jupyterlab-monaco.git
cd jupyterlab-monaco
npm install
npm run build
jupyter labextension link . --dev
I have tried to follow the same steps in Vagrant environment to create a JL environment with the editor. JupyterLab seems to load the app:
[I 18:58:49.320 LabApp] > /usr/bin/npm pack /home/vagrant/jupyterlab-monaco
jupyterlab-monaco-0.1.0.tgz
Within the JupyterLab itself, I can see Monaco Editor but am not able to open it (i.e. search bar displays it but clicking on it does nothing). I also tried re-building all the extensions from the scratch but with no effect.
Here is the full provisioning script I am using on Ubuntu 16.04 platform (Vagrant)
# Update system and install additional required packages
sudo apt-get update
# Install new Python
sudo apt-get install build-essential checkinstall -y
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
# Install node
sudo curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs -y
# Install git
sudo apt-get install git -y
# Install new Python
sudo apt-get install build-essential checkinstall -y
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev -y
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
tar xvf Python-3.6.5.tar.xz
cd Python-3.6.5
./configure
sudo make altinstall
# Install node
sudo curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs -y
# Install basic packages
sudo pip3.6 install numpy scipy matplotlib ipython jupyter sklearn
sudo pip3.6 install jupyterlab
# Install jupyter-monaco
sudo git clone https://github.com/jupyterlab/jupyterlab-monaco.git
cd jupyterlab-monaco/
sudo npm install
sudo npm run build
sudo jupyter labextension link .
You should get a Monaco editor when you open a non-notebook file. At least the first time you open it it should work. The current implementation is a very blunt one. You can recognize it by the minimap on the right hand side.
Any luck?
Yes this works. There is no launcher access but when I open the non-notebook file it uses the Monaco editor. Thank you very much!
Hi,
@jasongrout I tried to install using the instruction you gave in the comment in this issue, but I got an error when running: npm run build
I am on windows 10 and I am attaching the log. 2018-07-12T11_54_43_256Z-debug.log
I've also failed to install the extension using the instructions above, failing on npm run build
too.
Here is my traceback:
(monaco) krassowski@localhost:~/jupyterlab-monaco$ npm run build
> [email protected] build /home/krassowski/jupyterlab-monaco
> webpack && tsc
/home/krassowski/jupyterlab-monaco/node_modules/webpack-cli/bin/config-yargs.js:89
describe: optionsSchema.definitions.output.properties.path.description,
^
TypeError: Cannot read property 'properties' of undefined
at module.exports (/home/krassowski/jupyterlab-monaco/node_modules/webpack-cli/bin/config-yargs.js:8
at /home/krassowski/jupyterlab-monaco/node_modules/webpack-cli/bin/webpack.js:60:27
at Object.<anonymous> (/home/krassowski/jupyterlab-monaco/node_modules/webpack-cli/bin/webpack.js:51
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
EDIT: Updating webpack-cli
dependency to 3.1.1 - as suggested by https://github.com/webpack/webpack-cli/issues/607#issuecomment-424389911 - solved the problem.
EDIT: Updating
webpack-cli
dependency to 3.1.1 - as suggested by webpack/webpack-cli#607 (comment) - so
Hi @krassowski , I have the same error as yours at the npm run build
stage. But I am not familiar with npm.
So I tried
npm update [email protected]
npm install
npm run build
but still got the same error, i,e,
TypeError: Cannot read property 'properties' of undefined
at module.exports (/root/jupyterlab-monaco/node_modules/webpack-cli/bin/config-yargs.js:89:48)
at /root/jupyterlab-monaco/node_modules/webpack-cli/bin/webpack.js:60:27
at Object.<anonymous> (/root/jupyterlab-monaco/node_modules/webpack-cli/bin/webpack.js:515:3)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
Could you provide some help?
Edit: The error is gone by using npm install [email protected]
.
But I do not know how to select the editor in jupyter lab.