1

I downloaded Shapely to do some polygon work (on a Ubuntu AWS instance). Everything installed just fine, I used wget. I also did pip when I first encountered the error I'm about to explain, but it just said everything was there, so I don't think the download is the issue.

Anyway, when I try to import anything from shapely, I get this error:

OSError: libgeos_c.so: cannot open shared object file: No such file or directory

When I just say "import shapely", it all goes fine. However, when I need to import anything from deeper in the library, it crashes. I first tried it with from shapely.geometry import polygon but it's the same for anything from within the package. Has anyone had this problem before/know the solution?

1 Answers1

1

On Ubuntu, apparently you're always supposed to use sudo apt-get install to get libraries and such. When I did wget or pip install, I was just sticking the files in a random spot, not in my actual path.

So, I guess always use sudo apt-get install...

  • 2
    Just FYI: The actual reason isn't related to your $PATH, or that you shouldn't ever use `pip` on Ubuntu. It's because `pip` doesn't handle requirements that aren't python libraries. `shapely` depends on `libgeos`, and you didn't have it installed. Package managers (such as `apt`) handle system dependencies. `pip` (and `easy_install`, etc) just handle dependencies on other python libraries. They don't know how to get and install system libraries such as `libgeos`. Therefore, `apt` worked because`libgeos` was specified as a dependency for `shapely` and `apt` knew to install it as well. – Joe Kington Oct 09 '13 at 20:35
  • Thanks for the clarification! I'd be more than glad to accept this as an answer –  Oct 10 '13 at 20:05