Reputation: 21
I have a simple flask app and I am trying to run in Docker
import mapscript
from flask import Flask
import json
app = Flask(__name__)
port = 5000
@app.route("/hello")
def geocoder():
epsg = mapscript.pointObj(1, 1)
return json.dumps(epsg)
test()
if __name__ == '__main__':
app.run(host="0.0.0.0", port=port)
My Dockerfile is:
FROM python
WORKDIR /opt/demo/
COPY /app .
RUN pip install -r requirements.txt
ENTRYPOINT python test.py
But I get the following error when I run docker run -p 5000:5000 test:latest
:
Traceback (most recent call last):
File "/opt/demo/test.py", line 1, in <module>
import mapscript
File "/usr/local/lib/python3.9/site-packages/mapscript/__init__.py", line 2, in <module>
from .mapscript import *
File "/usr/local/lib/python3.9/site-packages/mapscript/mapscript.py", line 13, in <module>
from . import _mapscript
ImportError: cannot import name '_mapscript' from partially initialized module 'mapscript' (most likely due to a circular import) (/usr/local/lib/python3.9/site-packages/mapscript/__init__.py)
This happens only when I have the Python VENV activated when running outside Docker but I don't know why I am getting this error inside Docker.
Upvotes: 1
Views: 329