SwissDataScienceCenter / renku-python

A Python library for the Renku collaborative data science platform.
https://renku-python.readthedocs.io/
Apache License 2.0
37 stars 29 forks source link

cli: print a nice error message if nodejs is missing instead of 'Ahhhhhhh! you found a bug' #1983

Closed schymans closed 3 years ago

schymans commented 3 years ago

Describe the bug

A clear and concise description.

Details

The error occurred on my local renku installation. Here is the terminal output:

$ renku update --all --with-siblings
Resolved '../../../../../../../tmp/tmp89wsuoq0/7931aa6b-d0e1-4ac2-8dec-76096b2592f9.cwl' to 'file:///tmp/tmp89wsuoq0/7931aa6b-d0e1-4ac2-8dec-76096b2592f9.cwl'
INFO:cwltool:Resolved '../../../../../../../tmp/tmp89wsuoq0/7931aa6b-d0e1-4ac2-8dec-76096b2592f9.cwl' to 'file:///tmp/tmp89wsuoq0/7931aa6b-d0e1-4ac2-8dec-76096b2592f9.cwl'
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.39/images/json?filters=%7B%22reference%22%3A%7B%22node%3Aslim%22%3Atrue%7D%7D: dial unix /var/run/docker.sock: connect: permission denied
Ahhhhhhhh! You have found a bug. 🐞

The related project on renkulab.io: https://renkulab.io/projects/ba_math_gen-16/et-data

Renku version: 0.14.0 OS: Linux (#1 SMP Progress Linux 5.9.9-1~progress5+u1 (2020-11-19)) Python: 3.7.9

Traceback

Traceback (most recent call last):
  File "[...]/site-packages/cwltool/process.py", line 709, in __init__
    validate_js_options,
  File "[...]/site-packages/cwltool/validate_js.py", line 251, in validate_js_expressions
    code_fragment_js, js_globals, jshint_options
  File "[...]/site-packages/cwltool/validate_js.py", line 157, in jshint_js
    context=jshint_functions_text,
  File "[...]/site-packages/cwltool/sandboxjs.py", line 189, in exec_js_process
    new_proc = new_js_proc(js_engine_code, force_docker_pull=force_docker_pull)
  File "[...]/site-packages/cwltool/sandboxjs.py", line 134, in new_js_proc
    "docker run node:slim".format(", ".join(trynodes))
cwltool.sandboxjs.JavascriptException: cwltool requires Node.js engine to evaluate and validate Javascript expressions, but couldn't find it.  Tried nodejs, node, docker run node:slim

Additional context

Add any other context about the problem.

schymans commented 3 years ago

Sorry for the noise, I just re-ran the command in the renkulab.io repo and there it works. I assume that I have a package missing in my local renku installation, but I don't see what. cwltool, nodejs?

Panaetius commented 3 years ago

Yes, you need node or nodejs installed (or node:slim docker available).

I will keep this issue open to handle this error more nicely (I've been confused by it myself on occasion). We should catch the error and write a more meaningful message to the user, instead of an Ahhhhhhhh! You have found a bug. 🐞

schymans commented 3 years ago

Thanks a lot, @Panaetius! Unfortunately pip install node and pip install nodejs did not solve the problem for me. Anything else I could try? Whatever package is missing, it should also be mentioned in the prerequisites in the documentation.

Panaetius commented 3 years ago

node is a system level package, so e.g. on ubuntu it'd be sudo apt-get install nodejs

schymans commented 3 years ago

Thank you, this did the trick. Could this be added in the general requirements for renku?

Panaetius commented 3 years ago

We should document it in the https://renku.readthedocs.io/projects/renku-python/en/latest/introduction.html#prerequisites section of the docs

Panaetius commented 3 years ago

I've just merged a fix that will check for node-js before trying to rerun/update and inform the user a bit more clearly on what needs to be done, along with listing nodejs as a prerequisite in our docs.