microsoft / lida

Automatic Generation of Visualizations and Infographics using Large Language Models
https://microsoft.github.io/lida/
MIT License
2.66k stars 282 forks source link

Failed to build basemap #25

Closed linux-devil closed 11 months ago

linux-devil commented 12 months ago

ERROR: Could not build wheels for basemap which use PEP 517 and cannot be installed directly


> `Requirement already satisfied: regex>=2022.1.18 in /usr/local/lib/python3.9/site-packages (from tiktoken->llmx->lida) (2023.3.23)
> Requirement already satisfied: h11>=0.8 in /usr/local/lib/python3.9/site-packages (from uvicorn->lida) (0.14.0)
> Building wheels for collected packages: basemap, matplotlib-venn
>   Building wheel for basemap (PEP 517) ... error
>   ERROR: Command errored out with exit status 1:
>    command: /usr/local/opt/python@3.9/bin/python3.9 /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmpveqgi13n
>        cwd: /private/tmp/pip-install-cjcckjp5/basemap_8efa836acd5543ea8d32db9d6b08ae0e
>   Complete output (35 lines):
>   <string>:58: RuntimeWarning: Cannot find GEOS library and/or headers in standard locations ('/Users/harshit/local', '/Users/harshit', '/usr/local', '/usr', '/opt/local', '/opt', '/sw'). 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'
>   /usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/dist.py:287: SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated, consider using implicit namespaces instead (PEP 420). See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
>     warnings.warn(msg, SetuptoolsDeprecationWarning)
>   running bdist_wheel
>   running build
>   running build_py
>   creating build
>   creating build/lib.macosx-11-x86_64-cpython-39
>   creating build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits
>   copying src/mpl_toolkits/__init__.py -> build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits
>   creating build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits/basemap
>   copying src/mpl_toolkits/basemap/cm.py -> build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits/basemap
>   copying src/mpl_toolkits/basemap/__init__.py -> build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits/basemap
>   copying src/mpl_toolkits/basemap/test.py -> build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits/basemap
>   copying src/mpl_toolkits/basemap/diagnostic.py -> build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits/basemap
>   copying src/mpl_toolkits/basemap/proj.py -> build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits/basemap
>   copying src/mpl_toolkits/basemap/solar.py -> build/lib.macosx-11-x86_64-cpython-39/mpl_toolkits/basemap
>   running build_ext
>   cythoning src/_geoslib.pyx to src/_geoslib.c
>   building '_geoslib' extension
>   creating build/temp.macosx-11-x86_64-cpython-39
>   creating build/temp.macosx-11-x86_64-cpython-39/src
>   clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include -I/usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c src/_geoslib.c -o build/temp.macosx-11-x86_64-cpython-39/src/_geoslib.o
>   In file included from src/_geoslib.c:744:
>   In file included from /usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
>   In file included from /usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
>   In file included from /usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1929:
>   /usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
>   #warning "Using deprecated NumPy API, disable it with " \
>    ^
>   src/_geoslib.c:745:10: fatal error: 'geos_c.h' file not found
>   #include "geos_c.h"
>            ^~~~~~~~~~
>   1 warning and 1 error generated.
>   error: command '/usr/bin/clang' failed with exit code 1
>   ----------------------------------------
>   ERROR: Failed building wheel for basemap`
klauern commented 12 months ago

Same issue. I think I fixed it by installing geos with brew and then setting the GEOS_DIR to /opt/homebrew/Cellar/geos/3.12.0 (the version that I installed) before re-trying pip install lida.

victordibia commented 12 months ago

Hi @klauern ,

Thanks for noting this. I just updated the library to optionally install basemap e.g.pip install lida[tools].
So going forward, basemap should not be required. (basemap is only needed when lida suggests visualization code that includes maps).

pip install lida==0.0.8
konradk commented 12 months ago

I installed geos using brew, but it didn't help. I had to set GEOS_DIR, like @klauern wrote above. To make it work on every configuration type export GEOS_DIR=$(brew --prefix geos), then pip install lida.