pypostal
pypostal copied to clipboard
Ubuntu: libpostal.so.1: cannot open shared object file: No such file or directory
I seemed to have the same problem as issue #8
cannot open shared object file: No such file or directory
I tried the fixes suggested in the issue including adding export LD_LIBRARY_PATH=/usr/local/lib
(lib being where libpostal is installed)
I can import postal, just can't follow the tutorial due to this error:
>>> import postal
>>> postal.__file__
'/home/sean/.local/lib/python2.7/site-packages/postal/__init__.pyc'
>>> from postal.expand import expand_address
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sean/.local/lib/python2.7/site-packages/postal/expand.py", line 5, in <module>
from postal import _expand
ImportError: libpostal.so.1: cannot open shared object file: No such file or directory
sean@sean-Virtual-Machine:~/.local/lib/python2.7/site-packages/postal$ ls
dedupe.py __init__.py normalize.pyc pyutils.h token_types.pyc
dedupe.pyc __init__.pyc _normalize.so tests _token_types.so
_dedupe.so near_dupe.py parser.py tokenize.py utils
expand.py near_dupe.pyc parser.pyc tokenize.pyc
expand.pyc _near_dupe.so _parser.so _tokenize.so
_expand.so normalize.py __pycache__ token_types.py
I had this issue on Ubuntu 19.10 as well -> https://github.com/openvenues/pypostal/issues/8
Ah, that's a linker issue, nothing wrong with install. Just make sure /usr/local/lib (or wherever you installed libpostal) is on LD_LIBRARY_PATH. Add
export LD_LIBRARY_PATH=/usr/local/lib
to your bashrc and open a new ssh terminal to make it persistent across sessions, probably a good idea anyway since many C libraries install there.
You need to do that!
Example:
export LD_LIBRARY_PATH=/usr/local/lib
python main.py
or add it to the .bashrc or .zshrc depends on which terminal interpreter you are using.
@albarrentine maybe it makes sense to add this to readme as troubleshooting point.
It didn't resolve the issue for me.
export LD_LIBRARY_PATH=/usr/local/lib
I faced the same issue, The problem got resolved after adding ld_library_path
in ~/.bashrc
cat ~/.bashrc | tail
export LD_LIBRARY_PATH=/usr/local/lib
$ python
Python 3.8.0 (default, Nov 24 2020, 23:01:17)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import postal
>>> postal.__file__
'/home/xyz/.asdf/installs/python/3.8.0/lib/python3.8/site-packages/postal/__init__.py'
>>> from postal.expand import expand_address
>>> from postal.parser import parse_address
>>> parse_address('The Book Club 100-106 Leonard St, Shoreditch, London, Greater London, EC2A 4RH, United Kingdom')
[('the book club', 'house'), ('100-106', 'house_number'), ('leonard st', 'road'), ('shoreditch', 'suburb'), ('london', 'city'), ('greater london', 'state_district'), ('ec2a 4rh', 'postcode'), ('united kingdom', 'country')]
>>>