matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
779 stars 392 forks source link

Problem installing on FreeBSD #383

Closed crooksey closed 6 years ago

crooksey commented 6 years ago

Hi,

I have installed basemap no problem on my Linux development machine, now I have production ready code, I am setting up basemap on my FreeBSD server. I am trying to install basemap into a virtualenv, I have installed geos:

└─[$]> ls /usr/local/include/geos
algorithm         geomgraph.h       indexBintree.h    inline.h          noding.h          operation.h       opRelate.h        precision         timeval.h         version.h
export.h          geomgraphindex.h  indexChain.h      io                nodingSnapround.h opLinemerge.h     opValid.h         precision.h       triangulate
geom              geomUtil.h        indexQuadtree.h   io.h              opBuffer.h        opOverlay.h       planargraph       profiler.h        unload.h
geom.h            geosAlgorithm.h   indexStrtree.h    linearref         opDistance.h      opPolygonize.h    planargraph.h     simplify          util
geomgraph         index             indexSweepline.h  noding            operation         opPredicate.h     platform.h        spatialIndex.h    util.h

And within my virtualenv I have tried to install basemap and it fails with the below output (note I can install the ports/math/py-basemap, which installs py27-basemap as a system package with no errors, but I am using python3 and also need basemap installed inside my virtualenv), can anyone help debug the below output to try and see what is causing the package to fail installing?

└─[$]> GEOS_DIR="/usr/local/include/geos" pip install https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz

Collecting https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz
  Downloading https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz (132.4MB)
    100% |████████████████████████████████| 132.4MB 7.6kB/s 
Requirement already satisfied: numpy>=1.2.1 in ./virts/delapi/lib/python3.4/site-packages (from basemap==1.1.0)
Requirement already satisfied: matplotlib>=1.0.0 in ./virts/delapi/lib/python3.4/site-packages (from basemap==1.1.0)
Requirement already satisfied: pyproj>=1.9.3 in ./virts/delapi/lib/python3.4/site-packages (from basemap==1.1.0)
Requirement already satisfied: pyshp>=1.2.0 in ./virts/delapi/lib/python3.4/site-packages (from basemap==1.1.0)
Requirement already satisfied: six>=1.10 in ./virts/delapi/lib/python3.4/site-packages (from matplotlib>=1.0.0->basemap==1.1.0)
Requirement already satisfied: python-dateutil>=2.0 in ./virts/delapi/lib/python3.4/site-packages (from matplotlib>=1.0.0->basemap==1.1.0)
Requirement already satisfied: pytz in ./virts/delapi/lib/python3.4/site-packages (from matplotlib>=1.0.0->basemap==1.1.0)
Requirement already satisfied: cycler>=0.10 in ./virts/delapi/lib/python3.4/site-packages (from matplotlib>=1.0.0->basemap==1.1.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./virts/delapi/lib/python3.4/site-packages (from matplotlib>=1.0.0->basemap==1.1.0)
Installing collected packages: basemap
  Running setup.py install for basemap ... error
    Complete output from command /usr/home/luke/virts/delapi/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-2pp4rjc9-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vi6sldcd-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/home/luke/virts/delapi/include/site/python3.4/basemap:
    running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    running build_src
    build_src
    building extension "_geoslib" sources
    build_src: building npy-pkg config files
    running build_py
    creating build
    creating build/lib.freebsd-11.1-RELEASE-amd64-3.4
    creating build/lib.freebsd-11.1-RELEASE-amd64-3.4/mpl_toolkits
    ...
    ...
    ...
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    customize UnixCCompiler
    C compiler: cc -Wno-unused-result -DNDEBUG -fPIC

    creating /tmp/tmpmm2233oo/tmp
    creating /tmp/tmpmm2233oo/tmp/tmpmm2233oo
    compile options: '-MMD -MF /tmp/tmpmm2233oo/file.c.d -c'
    cc: /tmp/tmpmm2233oo/file.c
    customize UnixCCompiler using build_ext
    building '_geoslib' extension
    compiling C sources
    C compiler: cc -Wno-unused-result -DNDEBUG -fPIC

    creating build/temp.freebsd-11.1-RELEASE-amd64-3.4
    creating build/temp.freebsd-11.1-RELEASE-amd64-3.4/src
    compile options: '-I/usr/local/include/geos/include -I['/usr/home/luke/virts/delapi/lib/python3.4/site-packages/numpy/core/include'] -I/usr/home/luke/virts/delapi/lib/python3.4/site-packages/numpy/core/include -I/usr/home/luke/virts/delapi/include -I/usr/local/include/python3.4m -c'
    cc: src/_geoslib.c
    zsh:1: no matches found: -I[/usr/home/luke/virts/delapi/lib/python3.4/site-packages/numpy/core/include]
    zsh:1: no matches found: -I[/usr/home/luke/virts/delapi/lib/python3.4/site-packages/numpy/core/include]
    error: Command "cc -Wno-unused-result -DNDEBUG -fPIC -I/usr/local/include/geos/include -I['/usr/home/luke/virts/delapi/lib/python3.4/site-packages/numpy/core/include'] -I/usr/home/luke/virts/delapi/lib/python3.4/site-packages/numpy/core/include -I/usr/home/luke/virts/delapi/include -I/usr/local/include/python3.4m -c src/_geoslib.c -o build/temp.freebsd-11.1-RELEASE-amd64-3.4/src/_geoslib.o -MMD -MF build/temp.freebsd-11.1-RELEASE-amd64-3.4/src/_geoslib.o.d" failed with exit status 1

    ----------------------------------------
Command "/usr/home/luke/virts/delapi/bin/python3.4 -u -c "import setuptools, tokenize;__file__='/tmp/pip-2pp4rjc9-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vi6sldcd-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/home/luke/virts/delapi/include/site/python3.4/basemap" failed with error code 1 in /tmp/pip-2pp4rjc9-build/
jenshnielsen commented 6 years ago

Looks like this is likely to be the same issue as https://github.com/matplotlib/basemap/issues/362

guziy commented 6 years ago

This is fixed in master according to git log

Author: Russell Jones 
Date:   Tue Jul 25 12:14:43 2017 +0100

    Add rather than nest include arrays for geos

    Shouldn't the contents of inc_dirs be added to geos_include_dirs rather than nested within it?

diff --git a/setup.py b/setup.py
index 3b23b581..433cbf7a 100644
--- a/setup.py
+++ b/setup.py
@@ -77,7 +77,7 @@ set GEOS_DIR to /usr/local), or edit the setup.py script
 manually and set the variable GEOS_dir (right after the line
 that says "set GEOS_dir manually here".""" % "', '".join(geos_search_locations))
 else:
-    geos_include_dirs=[os.path.join(GEOS_dir,'include'),inc_dirs]
+    geos_include_dirs=[os.path.join(GEOS_dir,'include')] + inc_dirs

Try installing the latest master instead of the release.

Cheers

crooksey commented 6 years ago

Thanks guys, that solved it.