0

I am deploying a python script in a EC2 server running a redhat linux variant. I'm trying to install geopandas dependencies libspatialindex and rtree

I followed the instructions to install libspatialindex:

$cmake -DCMAKE_INSTALL_PREFIX=/home/ec2-user/ 
$make
$make install

and it creates two folders: include and lib. lib contains libspatialindex_c.so.4 but I have no idea how to correctly reference this folder or where it should be located. I read that the LD_LIBRARY_PATH could be set in the bash profile but I had no luck with this. I did this: LD_LIBRARY_PATH=/home/ec2-user/lib, which doesn't seem right but it did not do anything.

My current PATH is set to PATH=$PATH:$HOME/.local/bin:$HOME/bin

When do I get this error?

pip3 install --user rtree
OSError: libspatialindex_c.so.4: cannot open shared object file: No such file or directory

This suggests using an older version of rtree pip install "rtree>=0.8,<0.9". There's no error in installation but then this ends up happening:

>>>import rtree
OSError: libspatialindex_c.so.4: cannot open shared object file: No such file or directory
>>import geopandas
OSError: libspatialindex_c.so.4: cannot open shared object file: No such file or directory

why can't I import geopandas? was a similar problem and got me to this point. I have libspatialindex_c.so.4 but I need to know where to place this file. I have other scripts on this instance, so anaconda is not a solution. I tried to install linuxbrew but there were other problems with that.

Jacky
  • 710
  • 2
  • 8
  • 27
  • Try to do `find $HOME -name libspatialindex_c.so.4` and put the directory found in LD_LIBRARY_PATH – Philippe Apr 18 '20 at 21:14
  • @Philippe I get these directories: `/home/ec2-user/usr/lib/libspatialindex_c.so.4` `/home/ec2-user/lib/libspatialindex_c.so.4` `/home/ec2-user/libspatialindex-1.8.5/bin/libspatialindex_c.so.4` `/home/ec2-user/libspatialindex-1.8.5/.libs/libspatialindex_c.so.4` How should i export my path? I installed it twice, once in my root directory and one in home/ec2-user/usr/ which is a folder that didnt exist before – Jacky Apr 18 '20 at 22:10
  • 1
    try `export LD_LIBRARY_PATH=/home/ec2-user/usr/lib` – Philippe Apr 18 '20 at 22:12
  • It worked! I would have sworn I wrote something like that but thank you so much! – Jacky Apr 18 '20 at 22:30

0 Answers0