holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.77k stars 519 forks source link

Cannot panel build panel #1993

Closed MarcSkovMadsen closed 3 years ago

MarcSkovMadsen commented 3 years ago

I have just followed the develop instructions https://panel.holoviz.org/developer_guide/index.html.

I had to change the bokeh channel to bokeh/label/dev and add conda install nodejs. The bokeh version installed is 2.3.0.dev14.

When I panel serve '/workspaces/panel/panel/tests/template/test_manual.py' --dev --show I get

image

A hard refresh of the browser does not help me. So I try to panel build panel. But it also errors.

(panel_dev) root@8f1b897dffc4:/workspaces/panel# panel build panel
/opt/conda/envs/panel_dev/lib/python3.7/site-packages/bokeh/server/static/js/compiler.js:184
                lang: yargs_1.argv.lang ?? "typescript",
                                         ^

SyntaxError: Unexpected token ?
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:656:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
philippjfr commented 3 years ago

@mattpap any ideas?

mattpap commented 3 years ago

nodejs 14+ is needed. I will add a check to the compiler, to make this clear.

MarcSkovMadsen commented 3 years ago

Thanks @mattpap

Please note that for me "conda install nodejs" installed node 10.x. So I believe the comment below should be changed to refer to conda-forge channel and maybe even pin a version. And maybe even with a --no-deps. One of the many troubles I have is that everytime I conda install something it installs a lot of other things including changing versions of things installed prior when following the dev instructions.

image

image

image

MarcSkovMadsen commented 3 years ago

@philippjfr . Maybe a clean up of versions is needed to make this work also ??

image

image

image

MarcSkovMadsen commented 3 years ago

Ok. In the end I can now get the developer instructions working on linux/ inside docker container.

The things that finally got it working was

  1. use continuumio/miniconda3 and not continuumio/miniconda base image. The latter is based on Python 2. Argghhh.
  2. Run conda install -c conda-forge nodejs==15.3.0 in the base environment. NOT the panel_dev environment. For some unknown reason I end up with node 10 if installed to panel_dev environment.

The below docker container works as of today.

FROM continuumio/miniconda3

RUN conda update -n base -c defaults conda
RUN conda install -c pyviz "pyctdev>0.5.0"
RUN conda install -c conda-forge nodejs==15.3.0
WORKDIR /app
RUN git clone https://github.com/holoviz/panel.git
WORKDIR /app/panel
RUN doit ecosystem_setup

RUN doit env_create -c pyviz/label/dev -c conda-forge --name=panel_dev --python=3.7
# Make RUN commands use the new environment: See https://pythonspeed.com/articles/activate-conda-dockerfile/
SHELL ["conda", "run", "-n", "panel_dev", "/bin/bash", "-c"]
RUN doit develop_install -c pyviz/label/dev -c conda-forge -c bokeh/label/dev -o build -o tests -o recommended
MarcSkovMadsen commented 3 years ago

For the record you can develop inside this container with VS Code using the extension

image

if you create the subfolder .devcontainer in the root of the panel project

image

with the Dockerfile in the post above and the devcontainer.json as shown below

{
    "name": "panel-dev",
    "build": {
        "dockerfile": "Dockerfile",
    },
    "settings": {
        "terminal.integrated.shell.linux": "/bin/bash"
    },
    "forwardPorts": [80, 5096, 5097, ],
}

The first time you use the container in VS Code you will need to rerun

 doit develop_install -c pyviz/label/dev -c conda-forge -c bokeh/label/dev -o build -o tests -o recommended

so that it installs the mounted repository instead of the one git cloned inside the docker container during the image build.

It looks like

image

mattpap commented 3 years ago

"conda install nodejs" installed node 10.x.

Sadly the latest version on main channel is obsolete 10.13. I presume it shouldn't take much effort to push 14.x from conda-forge to main. @philippjfr, do you know who would be the best person to reach out to, to get this done? Otherwise we will have to update installation instructions.

MarcSkovMadsen commented 3 years ago

I close this one as the initial problem was solved.