matplotlib / basemap

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

Errors when installing Basemap in Mac os #447

Closed yansinhuang closed 10 months ago

yansinhuang commented 5 years ago

I'm running these in my Mac' s terminal, with python 3.7.0. It seems to be some problems with numpy or Cython but I pretty sure I have already installed them. numpy 1.15.4 Cython 0.29.2 pyproj 1.9.5.1 geos 0.2.1 Above are some relative module that I already have.

Any idea or suggestions?

Yande-MacBook-Air:basemap-1.1.0 yan$ python3 setup.py install `/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires' warnings.warn(msg) /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'namespace_packages' warnings.warn(msg) 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 running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext building '_geoslib' extension compiling C sources C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g

compile options: '-Iinclude -I['/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include'] -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c' gcc: src/_geoslib.c error: unable to open output file 'build/temp.macosx-10.9-x86_64-3.7/src/_geoslib.o': 'Permission denied' 1 error generated. error: unable to open output file 'build/temp.macosx-10.9-x86_64-3.7/src/_geoslib.o': 'Permission denied' 1 error generated. error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Iinclude -I['/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include'] -I/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/_geoslib.c -o build/temp.macosx-10.9-x86_64-3.7/src/_geoslib.o -MMD -MF build/temp.macosx-10.9-x86_64-3.7/src/_geoslib.o.d" failed with exit status 1`

molinav commented 2 years ago

I know that I am coming super-late here, but there has been significant development on the basemap packaging in the last months. We are still missing precompiled binary wheels for MacOS, but it should be straightforward to install from the source distribution available in PyPI:

  1. First, you need to have an appropriate installation of GEOS (e.g. through HomeBrew) and a C compiler.
  2. Then, set the environment variable GEOS_DIR to the installation folder (i.e. the geos_c.h header should be found in ${GEOS_DIR}/include).
  3. Finally, install basemap with pip normally: python -m pip install basemap
  4. Optionally, if you need the high-resolution datasets: python -m pip install basemap-data-hires

Feel free to try out and report any issues from following the former steps.

molinav commented 10 months ago

I am closing the issue, because with the upcoming release 1.4.0 (in a couple of days) I will be uploading MacOS wheels to PyPI manually, and since release 1.3.9 we already have MacOS arm64 packages in the conda-forge channel, so hopefully these installation issues on MacOS will become less common.

Feel free to reopen the issue if any of the problems persists.