matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

installation of basemap

sahanaRavinder opened this issue · comments

i have downloaded the basemap package from github,when i m trying to run the setup.py code from the 1st folder named as basemap,i m getting the below error,but the other two folders named basemap_data and basemap_data_hires setup.py programs got successfully installed

Microsoft Windows [Version 10.0.19043.1415]
(c) Microsoft Corporation. All rights reserved.

C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\Lib\site-packages\basemap-1.3.0\packages\basemap>python setup.py install
C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\Lib\site-packages\basemap-1.3.0\packages\basemap\setup.py:52: RuntimeWarning: Cannot find GEOS library and/or headers in standard locations ('C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\Lib\site-packages\geos_init_.py'). Please install the corresponding packages using your software management system or set the environment variable GEOS_DIR to point to the location where GEOS is installed (for example, if 'geos_c.h' is in '/usr/local/include' and 'libgeos_c' is in '/usr/local/lib', then you need to set GEOS_DIR to '/usr/local'
warnings.warn(" ".join([
C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
running install
C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\easy_install.py:156: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running bdist_egg
running egg_info
writing manifest file 'src\basemap.egg-info\SOURCES.txt'
running install_lib
running build_py
running build_ext
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\include -IC:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\include -IC:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcsrc_geoslib.c /Fobuild\temp.win-amd64-3.10\Release\src_geoslib.obj
_geoslib.c
C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
src_geoslib.c(680): fatal error C1083: Cannot open include file: 'geos_c.h': No such file or directory
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX86\x64\cl.exe' failed with exit code 2

C:\Users\sahana.DESKTOP-VB0949B.000\AppData\Local\Programs\Python\Python310\Lib\site-packages\basemap-1.3.0\packages\basemap>

please mention where the basemap-1.3.0 folder and geos folder should be placed.i., wether in the python folder or in the lib /sitepackages
also do mention how to set the path of the GEOS
i have already installed visual studio build compiler,oges and cmake

Hi @sahanaRavinder,

From your logs, it is clear that the problem with building basemap from source is due to GEOS not being found. Did you follow the steps from the README file? In particular, this (assuming you use the command prompt and you want to build GEOS e.g. in a temporary folder called extern):

cd packages\basemap
set GEOS_DIR=extern
python -c "import utils; utils.GeosLibrary('3.5.1').build(installdir='extern')"

After that, you need to build the basemap wheel using bdist_wheel so that the GEOS dll gets bundled:

python setup.py bdist_wheel

After that, you will have built the wheel package from source and it will be available in the dist folder, and you can install the wheel file with pip install.

One last point: it does not matter where you download the basemap source code or the GEOS source code. The source code must be downloaded somewhere so that you can build the wheel package from source. What lives later in site-packages is the content of this wheel package after installing it with pip install.

@sahanaRavinder From what I saw in libgeos/geos#536, be sure of being located at packages\basemap when doing this:

python -c "import utils; utils.GeosLibrary('3.5.1').build(installdir='extern')"

If you run this from packages\basemap\utils, it will not obviously work. I would also recommend you to build the source code somewhere outside the Python system folders.

@sahanaRavinder I recently released basemap version 1.3.1 which ensures support for Python 3.10, and I uploaded precompiled wheels for Windows (and GNU/Linux) to PyPI. This means that now you can install basemap on your Windows system by simply typing:

python -m pip install basemap

Could you check if this works for you? This way you can install basemap without having to compile from source.

@sahanaRavinder Did you have time to try it out and see if you can install basemap 1.3.1 with pip?

I am closing this issue due to lack of feedback. Since we now have wheel files for Windows and Python 3.10, the installation should be straightforward. Feel free to reopen the issue if the problem persists.