The package "python-devel" is not available in the latest CentOS version. It might be outdated. So I read online that for now I should use "sudo yum install python38-devel.x86_64" instead (in my case because I use python3.8). I tried to do this but it does not work either. So what I did to make it work is, I installed the following packages:
RUN yum groupinstall -y 'development tools'
RUN yum install file
RUN yum install diffutils
With this, the "make" process does finish and also "pip3.8 install postal" works without any error.
So now... and this is my problem where I need help... I want to import the library and face the following error:
_Traceback (most recent call last):
File "app.py", line 6, in
from postal.parser import parse_address
File "/usr/local/lib64/python3.8/site-packages/postal/parser.py", line 2, in
from postal import parser
ImportError: libpostal.so.1: cannot open shared object file: No such file or directory
I found a similar problem, where the solution was to add an environment variable, but this seems to not work for me.
So this is how my Dockerfile looks:
FROM centos:latest
RUN yum update -y
RUN yum install git python3.8 python3-pip -y
WORKDIR /app/libpostal
RUN ./bootstrap.sh
RUN mkdir datadir
RUN ./configure --datadir=/app/libpostal/datadir
RUN yum install make -y
RUN make
RUN make install
RUN ldconfig
WORKDIR /app
RUN pip3.8 install flask pandas nltk phonenumbers
RUN pip3.8 install postal
ENV LD_LIBRARY_PATH=/usr/local/lib64
RUN ldconfig
COPY . /app
ENTRYPOINT [ "python3.8" ]
CMD [ "app.py" ]
And the application I'm running is nothing special... simple flask application but it does not matter anyway because it fails to import the library right at the beginning. For the sake of completeness it looks like this:
from flask import Flask
from postal.parser import parse_address
app = Flask(name)
@app.route('/')
def hello_world():
return 'Hey, we have Flask in a Docker container!'
if name == 'main':
app.run(debug=True, host='0.0.0.0', use_reloader=False)
Thanks in advance and I would really appreciate your help with that.
Hello there.
I have the following problem:
I want to build an CentOS applications that uses the pypostal python module. However, I faced some problems during the build process...
First of all: This advice in your README does not work anymore...
On CentOS/RHEL sudo yum install curl autoconf automake libtool python-devel pkgconfig
The package "python-devel" is not available in the latest CentOS version. It might be outdated. So I read online that for now I should use "sudo yum install python38-devel.x86_64" instead (in my case because I use python3.8). I tried to do this but it does not work either. So what I did to make it work is, I installed the following packages:
RUN yum groupinstall -y 'development tools' RUN yum install file RUN yum install diffutils
With this, the "make" process does finish and also "pip3.8 install postal" works without any error.
So now... and this is my problem where I need help... I want to import the library and face the following error:
_Traceback (most recent call last): File "app.py", line 6, in
from postal.parser import parse_address
File "/usr/local/lib64/python3.8/site-packages/postal/parser.py", line 2, in
from postal import parser
ImportError: libpostal.so.1: cannot open shared object file: No such file or directory
I found a similar problem, where the solution was to add an environment variable, but this seems to not work for me.
So this is how my Dockerfile looks:
FROM centos:latest
RUN yum update -y RUN yum install git python3.8 python3-pip -y
WORKDIR /app
RUN git clone https://github.com/openvenues/libpostal
RUN yum install file diffutils curl autoconf automake libtool python38-devel.x86_64 pkgconfig -y
RUN yum groupinstall -y 'development tools'
WORKDIR /app/libpostal RUN ./bootstrap.sh RUN mkdir datadir RUN ./configure --datadir=/app/libpostal/datadir
RUN yum install make -y RUN make RUN make install RUN ldconfig
WORKDIR /app
RUN pip3.8 install flask pandas nltk phonenumbers RUN pip3.8 install postal
ENV LD_LIBRARY_PATH=/usr/local/lib64
RUN ldconfig
COPY . /app
ENTRYPOINT [ "python3.8" ] CMD [ "app.py" ]
And the application I'm running is nothing special... simple flask application but it does not matter anyway because it fails to import the library right at the beginning. For the sake of completeness it looks like this:
from flask import Flask from postal.parser import parse_address
app = Flask(name)
@app.route('/') def hello_world(): return 'Hey, we have Flask in a Docker container!'
if name == 'main': app.run(debug=True, host='0.0.0.0', use_reloader=False)
Thanks in advance and I would really appreciate your help with that.
Cheers Dennis