Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'pywps.wpsserver' #61

Open
benjimin opened this issue Sep 2, 2021 · 8 comments
Open

ModuleNotFoundError: No module named 'pywps.wpsserver' #61

benjimin opened this issue Sep 2, 2021 · 8 comments

Comments

@benjimin
Copy link

benjimin commented Sep 2, 2021

There seems to be an incompatibility between the latest versions of pywps (4.5.0) and pywps-flask (master branch as of today).

$ git clone https://github.com/geopython/pywps-flask.git .

$ python demo.py
Traceback (most recent call last):
  File "demo.py", line 36, in <module>
    from processes.area import Area
  File "/home/jovyan/wps/pywps-flask/processes/area.py", line 6, in <module>
    from pywps.wpsserver import temp_dir
ModuleNotFoundError: No module named 'pywps.wpsserver'

$ python
Python 3.6.9
>>> import pywps
>>> pywps.__version__
'4.5.0'

For what it's worth, I also tried using an earlier version of pywps, but that led to other dependency version conflicts.

$ pip install pywps flask
Requirement already satisfied: pywps in /env/lib/python3.6/site-packages (4.2.4)
Requirement already satisfied: flask in /env/lib/python3.6/site-packages (2.0.0)
Requirement already satisfied: werkzeug in /env/lib/python3.6/site-packages (from pywps) (2.0.1)

$ python -c "import pywps"
Traceback (most recent call last):
  File "/env/lib/python3.6/site-packages/pywps/exceptions.py", line 17, in <module>
    from werkzeug._compat import text_type
ModuleNotFoundError: No module named 'werkzeug._compat'
@pesekon2
Copy link

pesekon2 commented Oct 2, 2021

I was facing the same issue. Have found a local workaround with the following versions. However, now I am not sure if the tested stuff will work with the newest PyWPS; a general solution would be appreciated.

pip install flask==1.1.4 werkzeug==1.0.1 pywps==4.2.11

@iamtekson
Copy link

I am also facing the same issue!

@rtaib
Copy link

rtaib commented Apr 26, 2022

Same here.

@landam
Copy link

landam commented Aug 29, 2022

Still valid issue. What is the reason of python-flask to be broken for so long time?

@landam
Copy link

landam commented Aug 29, 2022

Update:

pip install flask==1.1.4 werkzeug==1.0.1 pywps==4.2.11 MarkupSafe==2.0.1

@sehHeiden
Copy link

Also got the same problem:

pywps: 4.5.2
flask: 2.2.2
python:3.10.6

I removed Area from the demo project under the import and Processes. Than the demo would start!

@benjimin
Copy link
Author

benjimin commented Dec 7, 2022

FYI, for anyone still encountering the issue:

If you just want to use PyWPS with Flask, you do not need this repo (which is apparently just a demo, and seems defunct and overcomplicated anyway). Instead follow the standard instructions for PyWPS (perhaps in combination with the Flask instructions for WSGI apps).

A fairly minimal example goes roughly like this:

import flask
import pywps

class dummy(pywps.Process):
    def __init__(self):
        super().__init__(handler=self._handler,
                         identifier='dummyproc',
                         title='Dummy Process',
                         inputs=[pywps.LiteralInput('input', "Some input", data_type='string')],
                         outputs=[pywps.LiteralOutput('response', "Some output", data_type='string')])
    def _handler(self, req, resp):
        resp.outputs['response'].data = req.inputs['input'][0].data + " and foo"

service = pywps.Service([dummy()])
app = flask.Flask(__name__)
app.route('/wps', methods=['GET', 'POST'])(lambda: service)
app.run()

Then, in a separate process, you can test it with something like:

import owslib.wps
client = owslib.wps.WebProcessingService('http://127.0.0.1:5000/wps')
client.getcapabilities()
print(client.processes)

For real applications you would use one of the pywps geometry input types.

@aleksandaratanasov
Copy link

FYI, for anyone still encountering the issue:

If you just want to use PyWPS with Flask, you do not need this repo (which is apparently just a demo, and seems defunct and overcomplicated anyway). Instead follow the standard instructions for PyWPS (perhaps in combination with the Flask instructions for WSGI apps).

A fairly minimal example goes roughly like this:

...
For real applications you would use one of the pywps geometry input types.

For testing, if you have QGIS, you can install the WPS Client (enable experimental plugins first).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants