HiromuHota / webspoon-docker

Dockerfile for webSpoon
https://hub.docker.com/r/hiromuhota/webspoon/
Apache License 2.0
103 stars 61 forks source link

Cannot run program python No such file or directory #8

Closed PovilasKud closed 6 years ago

PovilasKud commented 6 years ago

Hello,

I'm trying to use CPython script executor plugin, but i'm getting this error CPython Script Executor.0 - java.io.IOException: Cannot run program "python": error=2, No such file or directory

Docker image deployed on AWS Beanstalk.

Full error stacktrace:

2018/07/26 17:51:59 - python_test - Dispatching started for transformation [python_test] 2018/07/26 17:51:59 - CPython Script Executor.0 - ERROR (version 8.1.0.0-365-16, build 8.1.0.0-365-16 from 2018-06-29 08.32.14 by jenkins) : 2018/07/26 17:51:59 - CPython Script Executor.0 - java.io.IOException: Cannot run program "python": error=2, No such file or directory 2018/07/26 17:51:59 - CPython Script Executor.0 - Cannot run program "python": error=2, No such file or directory 2018/07/26 17:51:59 - CPython Script Executor.0 - ERROR (version 8.1.0.0-365-16, build 8.1.0.0-365-16 from 2018-06-29 08.32.14 by jenkins) : org.pentaho.di.core.exception.KettleException: 2018/07/26 17:51:59 - CPython Script Executor.0 - java.io.IOException: Cannot run program "python": error=2, No such file or directory 2018/07/26 17:51:59 - CPython Script Executor.0 - Cannot run program "python": error=2, No such file or directory 2018/07/26 17:51:59 - CPython Script Executor.0 - 2018/07/26 17:51:59 - CPython Script Executor.0 - at org.pentaho.python.PythonSession.initSession(PythonSession.java:418) 2018/07/26 17:51:59 - CPython Script Executor.0 - at org.pentaho.di.trans.steps.cpythonscriptexecutor.CPythonScriptExecutorData.initPython(CPythonScriptExecutorData.java:559) 2018/07/26 17:51:59 - CPython Script Executor.0 - at org.pentaho.di.trans.steps.cpythonscriptexecutor.CPythonScriptExecutor.init(CPythonScriptExecutor.java:112) 2018/07/26 17:51:59 - CPython Script Executor.0 - at org.pentaho.di.trans.step.StepInitThread.run(StepInitThread.java:69) 2018/07/26 17:51:59 - CPython Script Executor.0 - at java.lang.Thread.run(Thread.java:748) 2018/07/26 17:51:59 - CPython Script Executor.0 - Caused by: java.io.IOException: Cannot run program "python": error=2, No such file or directory 2018/07/26 17:51:59 - CPython Script Executor.0 - at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) 2018/07/26 17:51:59 - CPython Script Executor.0 - at org.pentaho.python.PythonSession.<init>(PythonSession.java:255) 2018/07/26 17:51:59 - CPython Script Executor.0 - at org.pentaho.python.PythonSession.initSession(PythonSession.java:416) 2018/07/26 17:51:59 - CPython Script Executor.0 - ... 4 more 2018/07/26 17:51:59 - CPython Script Executor.0 - Caused by: java.io.IOException: error=2, No such file or directory 2018/07/26 17:51:59 - CPython Script Executor.0 - at java.lang.UNIXProcess.forkAndExec(Native Method) 2018/07/26 17:51:59 - CPython Script Executor.0 - at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) 2018/07/26 17:51:59 - CPython Script Executor.0 - at java.lang.ProcessImpl.start(ProcessImpl.java:134) 2018/07/26 17:51:59 - CPython Script Executor.0 - at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) 2018/07/26 17:51:59 - CPython Script Executor.0 - ... 6 more 2018/07/26 17:51:59 - CPython Script Executor.0 - ERROR (version 8.1.0.0-365-16, build 8.1.0.0-365-16 from 2018-06-29 08.32.14 by jenkins) : Error initializing step [CPython Script Executor] 2018/07/26 17:51:59 - python_test - ERROR (version 8.1.0.0-365-16, build 8.1.0.0-365-16 from 2018-06-29 08.32.14 by jenkins) : Step [CPython Script Executor.0] failed to initialize! 2018/07/26 17:51:59 - python_test - ERROR (version 8.1.0.0-365-16, build 8.1.0.0-365-16 from 2018-06-29 08.32.14 by jenkins) : Errors detected! 2018/07/26 17:51:59 - python_test - ERROR (version 8.1.0.0-365-16, build 8.1.0.0-365-16 from 2018-06-29 08.32.14 by jenkins) : Errors detected!

PovilasKud commented 6 years ago

The problem is clearly because Python is not in the PATH

CPython Script Executor.0 - PATH: /usr/local/tomcat/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

PovilasKud commented 6 years ago

For anyone else having same problem: After adding Path I had several other problems and ended up with this Dockerfile-full that works:

` FROM hiromuhota/webspoon:0.8.1-base MAINTAINER Hiromu Hota hiromu.hota@hal.hitachi.com ENV JAVA_OPTS="-Xms1024m -Xmx2048m" ARG base=8.1 ARG patch=16 ARG version=0.$base.$patch ARG dist=8.1.0.0-365

RUN apt-get update && apt-get install -y python python-dev python-pip RUN apt-get install -y aptitude RUN apt-get install -y libxft-dev RUN apt-get install -y libfreetype6 RUN apt-get install -y libfreetype6-dev RUN pip install "pandas" RUN pip install "numpy" RUN pip install "scipy" RUN pip install "matplotlib" RUN pip install "sklearn" RUN apt-get install python-tk ENV PATH="$PATH:/usr/bin/python2.7/" ENV PYTHONPATH="$PYTHONPATH:/usr/bin/python2.7/"

COPY install.sh /tmp/install.sh RUN sh /tmp/install.sh

ADD https://github.com/HiromuHota/pentaho-kettle/releases/download/webspoon%2F$version/webspoon-security-$dist-$patch.jar ${CATALINA_HOME}/lib/ RUN echo "CLASSPATH="$CATALINA_HOME"/lib/webspoon-security-$dist-$patch.jar" | tee ${CATALINA_HOME}/bin/setenv.sh COPY catalina.policy ${CATALINA_HOME}/conf/ RUN mkdir -p $HOME/.kettle/users && mkdir -p $HOME/.pentaho/users `

HiromuHota commented 6 years ago

Sorry for replying late. Yes, the problem is that python is not in the PATH as it is not even installed.

Your Dockerfile-full is fine as long as it serves your need, but I installed python and some packages as below:

apt-get update
apt-get install -y python python-numpy python-pandas python-sklearn

It is just a different way of installing python packages, but requires fewer commands than using pip.

Also you may have to execute matplotlib.use('Agg') when making a graph (see here for details).

PovilasKud commented 6 years ago

Also you may have to execute matplotlib.use('Agg') when making a graph (see here for details).

Thanks, I will note that!

HiromuHota commented 6 years ago

Close assuming it's been solved.