-
Notifications
You must be signed in to change notification settings - Fork 90
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
Segmentation fault when importing mapnik #231
Comments
I tried analysing what is happening when importing mapnik using gdb giving me this backtrace:
It looks like and issue with boost_python but I am not able to analyse this further. |
I found out that the Segmentation Fault only appears when installing into the python virtual environment. When installing with Any ideas why it's not working in venvs? |
I cannot get this to work even outside of venv. I've also tried to compile boost from scratch, both using version 1.67 and 1.71 but still receive segfault with the exact same backtrace as soon as I try to import mapnik. I see that you're using a Dockerfile, would you mind sharing it? |
The example above is pretty much everything you need to install python, except for not using the venv. Imho the rest of the Dockerfile is irrelevant and I don't wan't to share it since its corporate intern. Does that not work for you? |
Thanks for replying again after such a long time. No worries, I got it working eventually. For the record, in addition to the setup smomapz described I also attempted to compile mapnik+boost+proj+geos from scratch, as I assumed that I needed to recompile mapnik as well in order to create bindings for Python 3.9. I can only assume that something went wrong during that process and that my segfault occured due to a faulty mapnik or dependency installation. If I were to guess, something down the compile chain probably picked up system Python2.7 headers instead, causing a mismatch. Turns out I only really had to recompile boost-python against the Python3.9 headers to change the python version, after that it simply worked to install and link against libmapnik3.0/-dev from the ubuntu package repo (focal). |
Hi,
I am trying to install Mapnik and the Mapnik Python bindings with Python3 support in Docker but I am failing at multiple points. Best result I could get was successful compilation of mapnik and the bindings but when I import mapnik I get a
Segmentation fault
and Python crashes.This is my setup:
I am compiling like this:
WORKDIR /src
RUN git clone https://github.com/mapnik/mapnik.git
WORKDIR /src/mapnik
RUN git checkout v3.0.x
RUN git submodule update --init
RUN ./configure CUSTOM_DEFINES="-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H=1"
RUN make
RUN make install
RUN python3 -m venv /venv
RUN /venv/bin/pip install --upgrade 'setuptools<45.0.0'
RUN /venv/bin/pip install -r requirements.txt
WORKDIR /src
RUN git clone https://github.com/mapnik/python-mapnik.git
WORKDIR /src/python-mapnik
RUN git checkout --force v3.0.x
ENV BOOST_PYTHON_LIB='boost_python38'
RUN sed -i 's/sys.exec_prefix/sys.base_exec_prefix/g' setup.py # Fix wrong pathing when using Python virtual environment
ENV PYCAIRO='true'
RUN setup.py install
Note: I need to compile the libraries from source because I need to apply custom patches to both mapnik and python-mapnik. The tests I ran so far are without the patches though to exclude them from the list of possible causes for these issues.
The text was updated successfully, but these errors were encountered: