OSGeo / homebrew-osgeo4mac

Mac homebrew tap for maintaining a stable work environment for the OSGeo.org geospatial toolset
https://git.io/fhh3X
BSD 3-Clause "New" or "Revised" License
364 stars 111 forks source link

Grass-70 --with-postgresql #54

Closed fxi closed 9 years ago

fxi commented 9 years ago

Hello !

I'm trying to use the pg driver in grass70, as described in http://grass.osgeo.org/grass70/manuals/grass-pg.html. Everything is fine with this install brew install grass-70. But there is no pg in the output of db.drivers, so I'm trying with brew install grass-70 --with-postgresql. I had an error during compilation and I don't understand what's happening. Here is the gist: https://gist.github.com/fxi/43599ec3754f23175f01

Any idea ? More info ? Other strategy ? Switch to linux ? Take a break ? Read the doc ?

Thanks !

Fred

dakcarto commented 9 years ago

Hi,

Thanks for reporting. Looks like when building with PostgreSQL support that the NumPy Python module is required:

02.make (line 10062)
ImportError: NumPy not found.

I see you are using Homebrew's Python. Try installing the numpy formula from the Homebrew/python tap:

brew install homebrew/python/numpy

Then, retry installing grass-70 --with-postgresql

fxi commented 9 years ago

Hi,

It seems already installed. I've reinstalled it and the same error is returned.

Thanks for your time !

Logs : https://gist.github.com/afd5ec31209d980f0c10 Message :

$ brew install homebrew/python/numpy
==> Installing numpy from homebrew/homebrew-python
Warning: numpy-1.9.0 already installed

$ brew reinstall homebrew/python/numpy
==> Reinstalling numpy
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading https://downloads.sourceforge.net/project/numpy/NumPy/1.9.0/numpy-1.9.0.tar.gz
######################################################################## 100.0%
==> python setup.py build --fcompiler=gnu95 install --prefix=/usr/local/Cellar/numpy/1.9.0
🍺  /usr/local/Cellar/numpy/1.9.0: 584 files, 13M, built in 52 seconds

$ brew reinstall grass-70 --with-postgresql
==> Reinstalling grass-70 with --with-postgresql
==> Downloading http://grass.osgeo.org/grass70/source/grass-7.0.0beta3.tar.gz
Already downloaded: /Library/Caches/Homebrew/grass-70-7.0.0beta3.tar.gz
==> Patching
patching file include/Make/Install.make
==> ./configure --prefix=/usr/local/Cellar/grass-70/7.0.0beta3 --enable-shared --with-cxx --with-python --with-blas --
==> make GDAL_DYNAMIC=
appear in the error log. If you get an error building a library, you will
also get errors from anything which uses the library.
--
Finished compilation: Thu Oct 30 15:05:42 CET 2014
make: *** [default] Error 1
dakcarto commented 9 years ago

Hmm. It's hard to tell if you have Python 3 installed, and whether you have chosen to install numpy --with-python3. Is NumPy installed in the Homebrew Python 2.7 site-packages? Does this work?:

$ /usr/local/bin/python2.7
...
>>> import numpy
>>>

If that does not work, then NumPy is not installed for 2.7.

fxi commented 9 years ago

I don't think python 3 is installed. Where sould I see that ??

$ ls /usr/local/Cellar/python
2.7.8_1 2.7.8_2

And numpy seems to work inside an interactive session :

$ /usr/local/bin/python2.7
Python 2.7.8 (default, Oct 19 2014, 16:03:53)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> exit()
fxi commented 9 years ago

Any clue ? I don't really understand where is the problem with Numpy and how did you find this error. I have missed something ? Any alternative to install grass 7 ?

thanks again.

fxi commented 9 years ago

Removed all grass (and qgis..) formulas with dependencies and reinstalled everything. I can't install Grass 70 with postgresql : https://gist.github.com/9ee5771b95666237eeb2 I will find another way. Thanks !

dakcarto commented 9 years ago

It looks like the grass-70 install error issue stems from wxpython, which currently doesn't support the latest numpy. The associated issue, # 16590, was closed and its patch applied upstream.

I have an updated wxpython formula on my personal repo that you can try, to verify it fixes the issue, prior to me setting up a pull request upstream at Homebrew's main repo.

To test, do the following:

brew install -v --build-from-source https://raw.githubusercontent.com/dakcarto/homebrew/e655ffd90d23dba191cbc3f95195796a4624d53d/Library/Formula/wxpython.rb
# you may need to ensure it gets used, if `wxpython` is installed again
brew switch wxpython 3.0.1.1_1

... if that succeeded...

brew install -v grass-70 --with-postgresql [--with-other-options]

Please let me know if this fixes the grass-70 build error, as I can not reproduce it here on Mac OS X 10.9.5.

EDIT Updated commands, so wxpython isn't used again.

dakcarto commented 9 years ago

Seems the latest gettext bottle is maybe screwed up. If you run into a problem using it (like I did), just brew rm gettext && brew install --build-from-source gettext.

nextstopsun commented 9 years ago

I've rebuilt gettext and wxpython from @dakcarto repo, but still have an error when building grass-70. Full log is here: https://gist.github.com/0ad88515d064f4af954d

I guess the error is in this part:

Error: clang -E -I/usr/local/opt/gettext/include      -I/private/tmp/grass-70-A8ZU91/grass-7.0.0beta3/dist.x86_64-apple-darwin14.0.0/include -I/private/tmp/grass-70-A8ZU91/grass-7.0.0beta3/dist.x86_64-apple-darwin14.0.0/include -D__GLIBC_HAVE_LONG_LONG: /usr/include/sys/cdefs.h:81:2: warning: "Unsupported compiler detected" [-W#warnings]

but I don't really understand what's wrong with clang.

dakcarto commented 9 years ago

Not sure what to make of those errors/warnings, but the fatal error is still the inability of wx/lib/plot.py to find and import numpy:

Traceback (most recent call last):
  File "/private/tmp/grass-70-A8ZU91/grass-7.0.0beta3/dist.x86_64-apple-darwin14.0.0/scripts/g.gui.iclass", line 62, in <module>
    from iclass.frame import IClassMapFrame
  File "/private/tmp/grass-70-A8ZU91/grass-7.0.0beta3/dist.x86_64-apple-darwin14.0.0/gui/wxpython/iclass/frame.py", line 61, in <module>
    from iclass.plots       import PlotPanel
  File "/private/tmp/grass-70-A8ZU91/grass-7.0.0beta3/dist.x86_64-apple-darwin14.0.0/gui/wxpython/iclass/plots.py", line 19, in <module>
    import wx.lib.plot as plot
  File "/usr/local/opt/wxpython/lib/python2.7/site-packages/wx-3.0-osx_cocoa/wx/lib/plot.py", line 126, in <module>
    raise ImportError, "NumPy not found.\n" + msg
ImportError: NumPy not found.

    This module requires the NumPy module, which could not be
    imported.  It probably is not installed (it's not part of the
    standard Python distribution). See the Numeric Python site
    (http://numpy.scipy.org) for information on downloading source or
    binaries.
make[6]: *** [g.gui.iclass.tmp.html] Error 1

Please verify your linked wxpython is 3.0.1.1_1 and not 3.0.1.1, which is Homebrew's.

fxi commented 9 years ago

It worked with the updated wxpython formula. Do you need some logs or something? It's always a magical moment when someone who did not have all informations in hands can understand and fix some issues reported by clueless people. Great spirit. Thanks a lot !

dakcarto commented 9 years ago

@fxi Thanks for the update and reporting.

@nlebedev Can you confirm the fix? Would like to PR this wxpython fix upstream to Homebrew. Thanks.

nextstopsun commented 9 years ago

@dakcarto Thanks a lot, Larry! I've removed wxpython again, reinstalled and brew switched to it. Then grass-70 got built without errors. I'm sorry for being a bit impatient about this, I've just wanted to use grass chaiken generalization algorithm with postgis data.

Of course I would like to help with pushing the wxpython fix. Do I have to just confirm the working build in some issue of Homebrew main repo?

BTW I still can't understand how does brew switch help, if I completely reinstalled the formula beforehand.

Thanks a lot once again @dakcarto. You're doing a great and a very important work on this repo:)

dakcarto commented 9 years ago

@nlebedev wrote:

Of course I would like to help with pushing the wxpython fix. Do I have to just confirm the working build in some issue of Homebrew main repo?

No, I'll take care of it. Just wanted a confirmation from you since I am not done setting up a 10.10 virtual machine to completely verify the fix locally here.

BTW I still can't understand how does brew switch help, if I completely reinstalled the formula beforehand.

Well, you wouldn't need to use the brew switch command if the fix was in your local Homebrew, i.e. you had downloaded my updated wxpython formula and replaced your local copy. When grass-70 is installed, it sees that the version of wpython you have installed is not the same as what it is supposed to be (it is actually higher), so it reinstalls and links the old wxpython again. Once your have two or more versions of a formula installed, you can check which is linked by doing brew info wxpython and the one with the asterisks is the linked install. Doing brew switch wxpython 3.0.1.1_1 ensures the wxpython from my repo is the one that is linked and grass-70 will build against.

Once the updated wxpython is pushed upstream to Homebrew, then everything will work right.

Thanks for testing the fix.

dakcarto commented 9 years ago

Patch for wxpython committed upstream at Homebrew. Reopen if issue remains unresolved.