You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 49 Next »

The PyWPS software was originally developed to use under Linux (Debian). However, it is also possible to use the software in a Windows environment for example for testing purposes. To do so, Apache server has to be installed on the system.

Step 0: 
Make sure Python is pre-installed on your machine, we recommend PythonXY.

Step 1: 
Download PyWPS

Step 2:
Unpack the contents of PyWPS folder and save the entire folder as c:\pywps (such that you have c:\pywps\wps.py)

Step 3:
Create a folder called c:\pywps\pywps_processes and add the file default.cfg (from c:\pywps\pywps) into it, if you like you can insert your own information in the file. However, do not forget to set the correct path for tempPath and outputPath under [server] section. Set processesPath to c:/pywps/python_processes and set the logFile to somewhere (the path slashes should conform to python conventions, which happen to be the linux slah convention, and not the windows convention. Note that python paths should never and with a slash!).

Step 4:
Navigate to the Apache folder. If the Apache web server is not installed in your machine, download the newest stable release of Apache (https://httpd.apache.org/download.cgi). After installation, in the Apache folder c:\Program Files (x86)\Apache Software Foundation\Apache2.2 you find a sub folder called cgi-bin. Create an empty file called pywps.cgi in this folder and insert the following code in it, after checking the python path (and correcting it, so, for example if you have Python2.7 installed, the first line should be #!c:\python27\python.exe):

pywps.cgi
#!C:\python\python.exe
import sys
sys.path.insert(0, r"C:\pywps")
import os
os.environ['PYWPS_CFG']='C:/pywps/pywps_processes/default.cfg'
import wps

Step 5:
Install the PyWPS Python package: on the command line in the pywps folder c:\pywps> type python c:\pywps\setup.py install, or open the Windows command line tool (start > run), drag and drop setup.py from your c:\pywps folder, type install after the location of the setup file and click ok. The PyWPS Python package will now be installed.

Step 6:
Test your WPS by starting Apache server and navigate to http://localhost/cgi-bin/pywps.cgi  The result should be something similar to this, meaning that the pywps process runs correctly inside the apache web server.

<ExceptionReport xmlns="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd">
	<Exception exceptionCode="NoApplicableCode">
		<ExceptionText>'No query string found.'</ExceptionText>
	</Exception>
</ExceptionReport>

Step 7:
Now pywps runs, test for correct WPS behaviour in browser using the syntax in WPS primer. In c:\pywps\tests\processes some example processes are included, copy its entire contents to the c:\pywps\python_processes folder (that you configured as processesPath=c:/pywps/pywps_processes in c:\pywps\pywps_processes\default.cfg) and find out whether you can get them to run. First test the GetCapabilities request:

<wps:Capabilities service="WPS" version="1.0.0" xml:lang="en-CA" xsi:schemaLocation="http:/opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsGetCapabilities_response.xsd" updateSequence="1">
...
</wps:Capabilities>

and then executing any of the available processes
e.g. http://localhost/cgi-bin/pywps.cgi?service=wps&request=Execute&Identifier=dummyprocess&DataInputs=[input1=42]&version=1.0.0.

Step 8:
Now add your own Python processes as WPS by copying your processes to the c:\pywps\python_processes folder too. Use the WPS syntax (Setting up a WPS process using PyWPS) for your python functions as in the copied examples. Change 3 things when adding a new WPS process based on these examples:

  1. add new file XYZ.py
  2. change identifier inside XYZ.py
  3. add "XYZ.py" to init{_}{}_.py

Known installation issues:

  • If the GetCapabilities request gives you get this error in your html browser, please check your apache error.log in c:\Program Files (x86)\Apache Software Foundation\Apache2.2\logs. In some cases it might contain this error message ImportError: No module named magic\r. In this case please manually install the libmagic package from https://github.com/heynemann/libmagic. For your convenience we included a windows distributable win32 or win64 Python2.7 version until the official binary is available at github. Restart apache afterwards (type services in your windows start menu or click small apache icon in icon tray). If you still get errors (failed to find libmagic in the aforementioned Apache error.log) install cygwin http://cygwin.com/install.html which contains the magic dll. Set the path where the cygmagic-1.dll resides c:\Program Files (x86)\Cygwin\bin in the windows $PATH environment variable so magic.py can find it.
  • If you run this in a Virtual windows machine (e.g. via VMWare), regular disk mappings might not work in WPS because WPS runs as another users (apache), please try references like //vmware-host/Shared%20Folders/D/ instead of simply D.

Notes:

  • Official documentation on PyWPS (v3.2.0) can be found here

Acknowlegdements The first version of this documentation was made by MSc student Joost Boerboom for his thesis, financed by Deltares under the Next Generation Hydro Software program executed for Rijkswaterstaat. Subsequently, this documentation was improved by Deltares in projects EMODnet chemistry and ECOSTRESS.

  • No labels