parameterspace-ie / eo4a-service-trials

EO4Atlantic platform service trials
GNU General Public License v3.0
0 stars 0 forks source link

Failing to get install_dependencies.sh working #16

Closed diplonics closed 6 years ago

diplonics commented 6 years ago

Can you expand/explain in a bit more detail how the install_dependencies.sh should work. From the documentation here: https://docs.eo4a.science/service_development/components.html#dependency-installation it suggests that the install_dependencies.sh script is automatically run but we are unable to get the dependencies installed to get CFPixels running properly.

Our install_dependencies.sh file currently looks like this but doesn't seem to be running?

!/bin/sh

apt update apt-get install python-pip pip install geojson pip install pathlib pip install shapely

derekocallaghan commented 6 years ago

In local standalone mode, install_dependencies.sh is only executed each time the EO4Atlantic container (eo4a-standalone) is created, where eo4adev will only create the latter if it doesn't already exist. In the platform itself, install_dependencies.sh is executed every time as a new Docker container is created for each service execution.

Assuming eo4a-standalone exists locally, can you remove it with docker stop, docker rm, rerun eo4adev, and see what happens? See https://docs.eo4a.science/service_development/iterative.html#useful-operations for examples of these docker commands

derekocallaghan commented 6 years ago

Another point to mention is that pip (in the Anaconda bundle) is already available in the container, so it doesn't need to installed via install_dependencies.sh, as the conda version will be used in the subsequent calls to pip install ....

dairejpwalsh commented 6 years ago

Trying to use pip to install python package. Even if I restart the service as you suggest I still get,

owslib.wps.WPSException : {'locator': None, 'code': 'NoApplicableCode', 'text': 'Process error: EO4AProcess.py._run_process Line 384 Process ended with non-zero exitcode:\nTraceback (most recent call last):\n File "/opt/eo4a/services/cfpixels/run.py", line 1, in \n import cfp\n File "/opt/eo4a/services/cfpixels/cfp.py", line 32, in \n import geojson\nImportError: No module named geojson\n'}

Contents of install_dependencies.sh, apt update sudo apt-get install python-pip sudp pip install geojson sudo pip install pathlib sudo pip install shapely

derekocallaghan commented 6 years ago

Looks like this appeared prior to my previous point about not installing python-pip, as the conda versions of pip and python are used with any service code running in the container. I suggesting removing the apt update...apt-get install commands.

derekocallaghan commented 6 years ago

Also, the sudo prefix is not required as everything is run as root in the container.

dairejpwalsh commented 6 years ago

I removed the,

sudo apt-get install python-pip

and have now the contents of install_dependencies.sh are,

# !/bin/sh
pip install geojson
pip install pathlib
pip install shapely

Even after restarting the service I am still getting the same error,

No module named geojson

derekocallaghan commented 6 years ago

Can you remove the container as described above, rerun eo4adev, and attach the output here. Can you also specify the values of the various EO4A_... environment variables, if these have been set.

derekocallaghan commented 6 years ago

In addition to the output from eo4adev, can the container log output from docker logs -f eo4a-standalone also be attached.

derekocallaghan commented 6 years ago

Also, prior to rerunning the above steps, can you change #!/bin/sh to #!/bin/sh -x in install_dependencies.sh, so that any output will show up in the container log.

derekocallaghan commented 6 years ago

I'm merging these suggestions into a single post as it's easier to read:

derekocallaghan commented 6 years ago

Having tried to reproduce the problem here, I suspect that these three dependencies are not fully installed prior to your Python code that tries to import them. It may just be a case of running the reload_services(wps) from the notebook, once they have been fully installed (i.e. after seeing a message like 2018-01-25 14:59:38,930 INFO exited: install_dependencies (exit status 0; expected) in the container log).

dairejpwalsh commented 6 years ago

Log in link,

https://drive.google.com/open?id=1nZRxSN9kboTlI9Cw3Utpj5azdecY1NA7

docker exec -it eo4a-standalone bash,

This work and allows me to install dependencies. No error after installing with this method

derekocallaghan commented 6 years ago

Thanks for the log. Good to hear that the manual installation works.

derekocallaghan commented 6 years ago

Closing as platform deployment has confirmed that install_dependencies.sh is working.