cyberdelia / heroku-geo-buildpack

Geo libraries for Heroku
https://github.com/heroku/heroku-geo-buildpack
114 stars 135 forks source link

GEOS not found after install #12

Closed joelmahoney closed 10 years ago

joelmahoney commented 10 years ago

Hi @cyberdelia. I'm having trouble installing postgis + RGeo on Heroku. @deafbybeheading recommended this buildpack. It seems to install correctly but after install RGeo can't find GEOS. Any suggestions?

-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/cyberdelia/heroku-geo-buildpack.git
=====> Detected Framework: geos/gdal/proj
       Using geos version: 3.4.1
       Using gdal version: 1.10.0
       Using proj version: 4.8.0
-----> Vendoring geo libraries done
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby.git

irb(main):001:0> shapes = RGeo::Shapefile::Reader.open("#{Rails.root}/path/to/shapefile.shp")
irb(main):002:0> shapes[0]
RGeo::Error::RGeoError: GEOS is not available, but is required for correct interpretation of polygons in shapefiles.
    from /app/vendor/bundle/ruby/2.0.0/gems/rgeo-shapefile-0.2.3/lib/rgeo/shapefile/reader.rb:623:in `_read_polygon'
    from /app/vendor/bundle/ruby/2.0.0/gems/rgeo-shapefile-0.2.3/lib/rgeo/shapefile/reader.rb:453:in `_read_next_record'
    from /app/vendor/bundle/ruby/2.0.0/gems/rgeo-shapefile-0.2.3/lib/rgeo/shapefile/reader.rb:397:in `next'
    from /app/vendor/bundle/ruby/2.0.0/gems/rgeo-shapefile-0.2.3/lib/rgeo/shapefile/reader.rb:440:in `get'
    from (irb):2
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.17/lib/rails/commands/console.rb:47:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.17/lib/rails/commands/console.rb:8:in `start'
    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.17/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
joelmahoney commented 10 years ago

This was an order of operations problem: I transferred an old database to the app before installing heroku-geo-buildpack. If I create the postgis extension in the database, then deploy to install heroku-geo-buildpack, and then import the pg_dump, it works fine. Thanks!

rurabe commented 10 years ago

Hi, I'm not sure if this is the right place for this and I'm happy to take it elsewhere, but I've tried everything to get this working and can't make it work.

Like @joelmahoney it seems to install okay, but RGeo can't see Geos from a console. I've even tried reimporting my database after the buildpack was intsalled and no dice.

± git push heroku master
...
-----> Fetching custom git buildpack... done
-----> Multipack app detected
=====> Downloading Buildpack: https://github.com/cyberdelia/heroku-geo-buildpack.git
=====> Detected Framework: geos/gdal/proj
       Using geos version: 3.4.1
       Using gdal version: 1.10.0
       Using proj version: 4.8.0
-----> Vendoring geo libraries done
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-ruby.git
=====> Detected Framework: Ruby
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.0
-----> Installing dependencies using 1.5.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
...
       Installing rgeo (0.3.20)
       Installing rgeo-activerecord (1.0.0)
       Installing activerecord-postgis-adapter (1.1.0)
       Your bundle is complete!
± heroku run console
Loading production environment (Rails 4.1.0)
irb(main):001:0> RGeo::Geos.supported?
=> false

It does seem like Geos and Proj4 are getting installed, but that bundler is not compiling Rgeo with the correct paths to them.

± heroku run bash
~ $ ls vendor/
assets  bundle  gdal  geos  heroku  proj  ruby-2.1.0

And I can manually recompile the gem from the heroku bash prompt and get it working, but this change doesn't stick.

~ $ gem uninstall -i /app/vendor/bundle/ruby/2.1.0 rgeo

You have requested to uninstall the gem:
    rgeo-0.3.20

rgeo-activerecord-1.0.0 depends on rgeo (~> 0.3.20)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled rgeo-0.3.20
~ $ gem install rgeo -- --with-geos-dir=/app/vendor/geos/3.4.1/
Fetching: rgeo-0.3.20.gem (100%)
Building native extensions with: '--with-geos-dir=/app/vendor/geos/3.4.1/'
This could take a while...
Successfully installed rgeo-0.3.20
Parsing documentation for rgeo-0.3.20
Installing ri documentation for rgeo-0.3.20
Done installing documentation for rgeo after 5 seconds
1 gem installed
~ $ irb
irb(main):001:0> require 'rgeo'
=> true
irb(main):002:0> RGeo::Geos.supported?
=> true
irb(main):003:0> 
~ $ rails c
Could not find rgeo-0.3.20 in any of the sources
Run `bundle install` to install missing gems.
~ $ bundle
...
Installing rgeo (0.3.20)
Using rgeo-activerecord (1.0.0)
Using activerecord-postgis-adapter (1.1.0)
...
It was installed into ./vendor/bundle
~ $ rails c
Loading production environment (Rails 4.1.0)
irb(main):001:0> RGeo::Geos.supported?
=> true
~ $ exit
± heroku run console
Loading production environment (Rails 4.1.0)
irb(main):002:0> RGeo::Geos.supported?
=> false

I must be doing something wrong since it seems to work for everyone else... can anyone help me out? Thanks in advance.

Gemfile:

gem 'rgeo', '~> 0.3.20' # GEOS
gem 'activerecord-postgis-adapter', '~> 1.1.0'
jmiller1 commented 10 years ago

rurabe, I ran into this problem and found that this fork fixed the problem in one of it's commits

https://github.com/Tekco/heroku-geo-buildpack

solenema commented 10 years ago

I have the same issue as @rurabe and tried to use this forked version but I have still the same problem. RGeos is not supported.

harmdewit commented 10 years ago

Did anyone else manage to fix this one way or another?

davidrleonard commented 10 years ago

I know this isn't super valuable, but wanted to ping this thread and see if anyone watching has had some luck fixing the issue? Above recommendations did not work for us.

cyberdelia commented 10 years ago

After a long investigation, I believe this is due to a bug with rgeo ext compilation and libgeos 3.4.2, see: rgeo/rgeo#75

mgiraldo commented 10 years ago

pinging to see if any fixes have been found

anyone?

harmdewit commented 10 years ago

Nope, couldn't fix it yet

On 30 jul. 2014, at 22:34, Mauricio Giraldo notifications@github.com wrote:

pinging to see if any fixes have been found

anyone?

— Reply to this email directly or view it on GitHub.

mgiraldo commented 10 years ago

btw: finally worked for me. see: https://github.com/cyberdelia/heroku-geo-buildpack/issues/20#issuecomment-50666187

charlesdg commented 9 years ago

Still have this issue. Anyone found a solution?

cyberdelia commented 9 years ago

I move some files, so that cedar-14 packages are chosen by default, this should provides a workaround (and eventually break for people stolen cedar-14). A better fix coming up after the holidays.