{
  "id": 26557,
  "title": "Here's how to install shapely.",
  "url": "/competitions/dstl-satellite-imagery-feature-detection/discussion/26557",
  "author_name": "",
  "post_date": "2016-12-16T00:26:34.827Z",
  "votes": 4,
  "comment_count": 3,
  "views": 521,
  "content": "<p>A simple <code>pip install shapely</code> failed with:</p>\n\n<blockquote>\n  <p><code>Could not find library geos_c [...]</code>.</p>\n</blockquote>\n\n<p>You'll need to make sure to have the geos packages installed first; can't install them through pip because it needs paths outside the python environment.</p>\n\n<p>On Arch, the following was successful:</p>\n\n<blockquote>\n  <p><code>sudo pacman -S python-shapely</code></p>\n</blockquote>\n\n<hr>\n\n<p><a href=\"http://stackoverflow.com/questions/19742406/could-not-find-library-geos-c-or-load-any-of-its-variants\">I imagine with Ubuntu</a>:</p>\n\n<blockquote>\n  <p><code>sudo apt-get install libgeos-dev</code></p>\n</blockquote>\n\n<p>And Fedora:</p>\n\n<blockquote>\n  <p><code>sudo yum install libgeos-dev</code></p>\n</blockquote>\n\n<p>Then this should work fine:</p>\n\n<blockquote>\n  <p><code>pip install shapely</code></p>\n</blockquote>\n\n<hr>\n\n<p>If you've had success with Windows or macOS, go ahead and trace back your steps here.</p>\n\n<p>Cheers, and good competition everyone!</p>\n\n<p>-fl</p>",
  "messages": [
    {
      "id": "150611",
      "postDate": "12/16/2016 00:26:34",
      "content": "<p>A simple <code>pip install shapely</code> failed with:</p>\n\n<blockquote>\n  <p><code>Could not find library geos_c [...]</code>.</p>\n</blockquote>\n\n<p>You'll need to make sure to have the geos packages installed first; can't install them through pip because it needs paths outside the python environment.</p>\n\n<p>On Arch, the following was successful:</p>\n\n<blockquote>\n  <p><code>sudo pacman -S python-shapely</code></p>\n</blockquote>\n\n<hr>\n\n<p><a href=\"http://stackoverflow.com/questions/19742406/could-not-find-library-geos-c-or-load-any-of-its-variants\">I imagine with Ubuntu</a>:</p>\n\n<blockquote>\n  <p><code>sudo apt-get install libgeos-dev</code></p>\n</blockquote>\n\n<p>And Fedora:</p>\n\n<blockquote>\n  <p><code>sudo yum install libgeos-dev</code></p>\n</blockquote>\n\n<p>Then this should work fine:</p>\n\n<blockquote>\n  <p><code>pip install shapely</code></p>\n</blockquote>\n\n<hr>\n\n<p>If you've had success with Windows or macOS, go ahead and trace back your steps here.</p>\n\n<p>Cheers, and good competition everyone!</p>\n\n<p>-fl</p>",
      "rawMarkdown": "A simple `pip install shapely` failed with:\r\n\r\n >`Could not find library geos_c [...]`.\r\n\r\nYou'll need to make sure to have the geos packages installed first; can't install them through pip because it needs paths outside the python environment.\r\n\r\nOn Arch, the following was successful:\r\n\r\n> `sudo pacman -S python-shapely`\r\n\r\n-----\r\n\r\n[I imagine with Ubuntu][1]:\r\n\r\n>`sudo apt-get install libgeos-dev`\r\n\r\nAnd Fedora:\r\n\r\n>`sudo yum install libgeos-dev`\r\n\r\nThen this should work fine:\r\n\r\n>`pip install shapely`\r\n\r\n-----\r\nIf you've had success with Windows or macOS, go ahead and trace back your steps here.\r\n\r\nCheers, and good competition everyone!\r\n\r\n-fl\r\n\r\n\r\n  [1]: http://stackoverflow.com/questions/19742406/could-not-find-library-geos-c-or-load-any-of-its-variants",
      "votes": null
    },
    {
      "id": "150613",
      "postDate": "12/16/2016 00:51:14",
      "content": "<p>For windows users (using anaconda):</p>\n\n<p>Download wheel file for your processor/python build from:     <a href=\"http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely\">http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely</a></p>\n\n<p>At your shell: pip install path-of-saved-file/your-wheel-file.whl</p>\n\n<p>Ex: pip install ~/Shapely-1.5.17-cp27-cp27m-win_amd64.whl</p>\n\n<p>Done!</p>",
      "rawMarkdown": "For windows users (using anaconda):\r\n\r\nDownload wheel file for your processor/python build from:     [http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely][1]\r\n\r\nAt your shell: pip install path-of-saved-file/your-wheel-file.whl\r\n\r\nEx: pip install ~/Shapely-1.5.17-cp27-cp27m-win_amd64.whl\r\n\r\nDone!\r\n\r\n  [1]: http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely",
      "votes": null
    },
    {
      "id": "150642",
      "postDate": "12/16/2016 05:30:30",
      "content": "<p>I use Enterprise Linux 7. Here is how I installed shapely:</p>\n\n<p>1) First you need to install GEOS package (can be found here: <a href=\"https://trac.osgeo.org/geos/\">https://trac.osgeo.org/geos/</a>)\nDownload the package geos-3.6.0, unpack and build it with:</p>\n\n<p>$ ./configure</p>\n\n<p>$ make</p>\n\n<p>$ sudo make install</p>\n\n<p>After that libgeos_c.so library should be in /usr/local/lib directory. Add that path to LD_LIBRARY_PATH variable.</p>\n\n<p>2) Try to install shapely with \"pip install shapely\". If python still cannot find libgeos_c library, you need to add the config file to /etc/ld.so.conf.d. In my system, I have /etc/ld.so.conf file with the following line:</p>\n\n<p>include  ld.so.conf.d/*.conf</p>\n\n<p>It means that system scans /etc/ld.so.conf.d directory, reads all *.conf files, and loads the libraries that indicated in these files. So, you need to create a file in /etc/ld.so.conf.d directory with arbitrary name (I  created geos_c.conf) and write a full path to the library in it. In my case it is:</p>\n\n<p>/usr/local/lib</p>\n\n<p>After that run \"$ sudo ldconfig\" command in order to save changes in your system. \nIn order to check that everything works fine, execute \"$ ldconfig -p | grep libgeos\" command. You should see something like this:</p>\n\n<p>libgeos_c.so.1 (libc6,x86-64) =&gt; /usr/local/lib/libgeos_c.so.1</p>\n\n<p>libgeos_c.so (libc6,x86-64) =&gt; /usr/local/lib/libgeos_c.so</p>\n\n<p>libgeos-3.6.0.so (libc6,x86-64) =&gt; /usr/local/lib/libgeos-3.6.0.so</p>\n\n<p>libgeocode-glib.so.0 (libc6,x86-64) =&gt; /lib64/libgeocode-glib.so.0</p>\n\n<p>Now pip have to see libgeos_c library, and shapely can be installed without any problems!</p>",
      "rawMarkdown": "I use Enterprise Linux 7. Here is how I installed shapely:\r\n\r\n1) First you need to install GEOS package (can be found here: https://trac.osgeo.org/geos/)\r\nDownload the package geos-3.6.0, unpack and build it with:\r\n\r\n$ ./configure\r\n\r\n$ make\r\n\r\n$ sudo make install\r\n\r\nAfter that libgeos_c.so library should be in /usr/local/lib directory. Add that path to LD_LIBRARY_PATH variable.\r\n\r\n2) Try to install shapely with \"pip install shapely\". If python still cannot find libgeos_c library, you need to add the config file to /etc/ld.so.conf.d. In my system, I have /etc/ld.so.conf file with the following line:\r\n\r\ninclude  ld.so.conf.d/*.conf\r\n\r\nIt means that system scans /etc/ld.so.conf.d directory, reads all *.conf files, and loads the libraries that indicated in these files. So, you need to create a file in /etc/ld.so.conf.d directory with arbitrary name (I  created geos_c.conf) and write a full path to the library in it. In my case it is:\r\n\r\n/usr/local/lib\r\n\r\nAfter that run \"$ sudo ldconfig\" command in order to save changes in your system. \r\nIn order to check that everything works fine, execute \"$ ldconfig -p | grep libgeos\" command. You should see something like this:\r\n\r\nlibgeos_c.so.1 (libc6,x86-64) => /usr/local/lib/libgeos_c.so.1\r\n\t\r\nlibgeos_c.so (libc6,x86-64) => /usr/local/lib/libgeos_c.so\r\n\t\r\nlibgeos-3.6.0.so (libc6,x86-64) => /usr/local/lib/libgeos-3.6.0.so\r\n\t\r\nlibgeocode-glib.so.0 (libc6,x86-64) => /lib64/libgeocode-glib.so.0\r\n\r\nNow pip have to see libgeos_c library, and shapely can be installed without any problems!",
      "votes": null
    },
    {
      "id": "150674",
      "postDate": "12/16/2016 09:39:23",
      "content": "<p>For OSX</p>\n\n<p>brew install geos</p>\n\n<p>Then</p>\n\n<p>pip install shapely</p>\n\n<p>You can also do</p>\n\n<p>pip install shapely[vectorized]==1.6b2</p>",
      "rawMarkdown": "For OSX\r\n\r\nbrew install geos\r\n\r\nThen\r\n\r\npip install shapely\r\n\r\nYou can also do\r\n\r\npip install shapely[vectorized]==1.6b2",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 150613,
      "author_name": "fredtony",
      "author_url": "",
      "post_date": "12/16/2016 00:51:14",
      "content": "<p>For windows users (using anaconda):</p>\n\n<p>Download wheel file for your processor/python build from:     <a href=\"http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely\">http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely</a></p>\n\n<p>At your shell: pip install path-of-saved-file/your-wheel-file.whl</p>\n\n<p>Ex: pip install ~/Shapely-1.5.17-cp27-cp27m-win_amd64.whl</p>\n\n<p>Done!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 150642,
      "author_name": "alexlu",
      "author_url": "",
      "post_date": "12/16/2016 05:30:30",
      "content": "<p>I use Enterprise Linux 7. Here is how I installed shapely:</p>\n\n<p>1) First you need to install GEOS package (can be found here: <a href=\"https://trac.osgeo.org/geos/\">https://trac.osgeo.org/geos/</a>)\nDownload the package geos-3.6.0, unpack and build it with:</p>\n\n<p>$ ./configure</p>\n\n<p>$ make</p>\n\n<p>$ sudo make install</p>\n\n<p>After that libgeos_c.so library should be in /usr/local/lib directory. Add that path to LD_LIBRARY_PATH variable.</p>\n\n<p>2) Try to install shapely with \"pip install shapely\". If python still cannot find libgeos_c library, you need to add the config file to /etc/ld.so.conf.d. In my system, I have /etc/ld.so.conf file with the following line:</p>\n\n<p>include  ld.so.conf.d/*.conf</p>\n\n<p>It means that system scans /etc/ld.so.conf.d directory, reads all *.conf files, and loads the libraries that indicated in these files. So, you need to create a file in /etc/ld.so.conf.d directory with arbitrary name (I  created geos_c.conf) and write a full path to the library in it. In my case it is:</p>\n\n<p>/usr/local/lib</p>\n\n<p>After that run \"$ sudo ldconfig\" command in order to save changes in your system. \nIn order to check that everything works fine, execute \"$ ldconfig -p | grep libgeos\" command. You should see something like this:</p>\n\n<p>libgeos_c.so.1 (libc6,x86-64) =&gt; /usr/local/lib/libgeos_c.so.1</p>\n\n<p>libgeos_c.so (libc6,x86-64) =&gt; /usr/local/lib/libgeos_c.so</p>\n\n<p>libgeos-3.6.0.so (libc6,x86-64) =&gt; /usr/local/lib/libgeos-3.6.0.so</p>\n\n<p>libgeocode-glib.so.0 (libc6,x86-64) =&gt; /lib64/libgeocode-glib.so.0</p>\n\n<p>Now pip have to see libgeos_c library, and shapely can be installed without any problems!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 150674,
      "author_name": "aymankh",
      "author_url": "",
      "post_date": "12/16/2016 09:39:23",
      "content": "<p>For OSX</p>\n\n<p>brew install geos</p>\n\n<p>Then</p>\n\n<p>pip install shapely</p>\n\n<p>You can also do</p>\n\n<p>pip install shapely[vectorized]==1.6b2</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "150611": "A simple `pip install shapely` failed with:\r\n\r\n >`Could not find library geos_c [...]`.\r\n\r\nYou'll need to make sure to have the geos packages installed first; can't install them through pip because it needs paths outside the python environment.\r\n\r\nOn Arch, the following was successful:\r\n\r\n> `sudo pacman -S python-shapely`\r\n\r\n-----\r\n\r\n[I imagine with Ubuntu][1]:\r\n\r\n>`sudo apt-get install libgeos-dev`\r\n\r\nAnd Fedora:\r\n\r\n>`sudo yum install libgeos-dev`\r\n\r\nThen this should work fine:\r\n\r\n>`pip install shapely`\r\n\r\n-----\r\nIf you've had success with Windows or macOS, go ahead and trace back your steps here.\r\n\r\nCheers, and good competition everyone!\r\n\r\n-fl\r\n\r\n\r\n  [1]: http://stackoverflow.com/questions/19742406/could-not-find-library-geos-c-or-load-any-of-its-variants",
    "150613": "For windows users (using anaconda):\r\n\r\nDownload wheel file for your processor/python build from:     [http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely][1]\r\n\r\nAt your shell: pip install path-of-saved-file/your-wheel-file.whl\r\n\r\nEx: pip install ~/Shapely-1.5.17-cp27-cp27m-win_amd64.whl\r\n\r\nDone!\r\n\r\n  [1]: http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely",
    "150642": "I use Enterprise Linux 7. Here is how I installed shapely:\r\n\r\n1) First you need to install GEOS package (can be found here: https://trac.osgeo.org/geos/)\r\nDownload the package geos-3.6.0, unpack and build it with:\r\n\r\n$ ./configure\r\n\r\n$ make\r\n\r\n$ sudo make install\r\n\r\nAfter that libgeos_c.so library should be in /usr/local/lib directory. Add that path to LD_LIBRARY_PATH variable.\r\n\r\n2) Try to install shapely with \"pip install shapely\". If python still cannot find libgeos_c library, you need to add the config file to /etc/ld.so.conf.d. In my system, I have /etc/ld.so.conf file with the following line:\r\n\r\ninclude  ld.so.conf.d/*.conf\r\n\r\nIt means that system scans /etc/ld.so.conf.d directory, reads all *.conf files, and loads the libraries that indicated in these files. So, you need to create a file in /etc/ld.so.conf.d directory with arbitrary name (I  created geos_c.conf) and write a full path to the library in it. In my case it is:\r\n\r\n/usr/local/lib\r\n\r\nAfter that run \"$ sudo ldconfig\" command in order to save changes in your system. \r\nIn order to check that everything works fine, execute \"$ ldconfig -p | grep libgeos\" command. You should see something like this:\r\n\r\nlibgeos_c.so.1 (libc6,x86-64) => /usr/local/lib/libgeos_c.so.1\r\n\t\r\nlibgeos_c.so (libc6,x86-64) => /usr/local/lib/libgeos_c.so\r\n\t\r\nlibgeos-3.6.0.so (libc6,x86-64) => /usr/local/lib/libgeos-3.6.0.so\r\n\t\r\nlibgeocode-glib.so.0 (libc6,x86-64) => /lib64/libgeocode-glib.so.0\r\n\r\nNow pip have to see libgeos_c library, and shapely can be installed without any problems!",
    "150674": "For OSX\r\n\r\nbrew install geos\r\n\r\nThen\r\n\r\npip install shapely\r\n\r\nYou can also do\r\n\r\npip install shapely[vectorized]==1.6b2"
  },
  "source": "meta"
}