rtree: rtree version 0.9 install error: OSError: libspatialindex_c.so: cannot open shared object file
Hi,
running pip install "rtree>=0.8,<1" fails with this error:
Collecting rtree<1,>=0.8
Downloading https://files.pythonhosted.org/packages/5e/64/a01a6675c39ddfba2467cc6b432ce9af2e71a3a67e9e8ace106ccda10df8/Rtree-0.9.0.tar.gz (52kB)
100% |████████████████████████████████| 61kB 2.7MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-r2lpov2a/rtree/setup.py", line 3, in <module>
import rtree
File "/tmp/pip-build-r2lpov2a/rtree/rtree/__init__.py", line 1, in <module>
from .index import Rtree
File "/tmp/pip-build-r2lpov2a/rtree/rtree/index.py", line 6, in <module>
from . import core
File "/tmp/pip-build-r2lpov2a/rtree/rtree/core.py", line 104, in <module>
rt = ctypes.CDLL(lib_name)
File "/usr/local/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libspatialindex_c.so: cannot open shared object file: No such file or directory
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-r2lpov2a/rtree/
I installed libspatialindex_c.so manually by running the following, but the above error still happens even though /usr/local/lib/libspatialindex_c.so exists now :
LIBSPATIALINDEX_VERSION=spatialindex-src-1.8.5
curl -sLO "http://download.osgeo.org/libspatialindex/$LIBSPATIALINDEX_VERSION.tar.gz" && \
tar xzf "$LIBSPATIALINDEX_VERSION.tar.gz" && \
rm -rf "$LIBSPATIALINDEX_VERSION.tar.gz" && \
cd "$LIBSPATIALINDEX_VERSION" && \
./configure && \
make -j $( getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1 ) && \
make install
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (10 by maintainers)
Commits related to this issue
- use ctypes.utils.find_libary for posix library location #120 — committed to Toblerity/rtree by hobu 5 years ago
worth mentioning that
pip install "rtree>=0.8,<0.9"works. this only happens on version 0.9The package that must be installed on trusty is
libspatialindex-c3andlibspatialindex-c4v5on 16.04 and 18.04Seeing the same issue as of this morning on our CI server.
The system (running Scientific Linux 7) has libspatialindex v1.8.5 installed:
However, I have no shared library named
libspatialindex_c.so, but insteadlibspatialindex_c.so.4:The changes in this diff resulted in
rtreebeing hardcoded to importspatialindex_c.so, rather than callingctypes.util.find_library("spatialindex_c"), which was previously returning the correct name:@hobu - latest master installs without error, unlike 0.9.0. Thanks!
Appears that there was a change in Python 3.6 to cause
find_libraryto searchLD_LIBRARY_PATH: https://hg.python.org/cpython/rev/385181e809bcI wonder if you could make more people happy with a fallback if
find_librarydoesn’t get a result:Of course, that still doesn’t work if you’ve got a
libspatialindex_c.so.4in a non-standard location (luckily, I don’t!).