Repository navigation
installation fails on ubuntu 21.04 with Python 3.9.5 #518
Copy link
Copy link
Closed
Description
I have succesfully install geos, but running sudo python3 setup.py install fails with the following error:
checking for GEOS lib in /root ....
checking for GEOS lib in /root/local ....
checking for GEOS lib in /usr ....
GEOS lib (version 3.9.0) found in /usr
running install
running bdist_egg
running egg_info
running build_src
build_src
building extension "_geoslib" sources
build_src: building npy-pkg config files
creating basemap.egg-info
writing basemap.egg-info/PKG-INFO
writing dependency_links to basemap.egg-info/dependency_links.txt
writing namespace_packages to basemap.egg-info/namespace_packages.txt
writing requirements to basemap.egg-info/requires.txt
writing top-level names to basemap.egg-info/top_level.txt
writing manifest file 'basemap.egg-info/SOURCES.txt'
reading manifest file 'basemap.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'basemap.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/mpl_toolkits
creating build/lib.linux-x86_64-3.9/mpl_toolkits/basemap
.
.
.
.
A bunch of compiler notes and warnings. Then the error:
| ~~~~~~~~~~~~~~~~~~~~~~~~~^
src/_geoslib.c: In function ‘__Pyx_modinit_type_init_code’:
src/_geoslib.c:5678:36: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
5678 | __pyx_type_8_geoslib_BaseGeometry.tp_print = 0;
| ^
src/_geoslib.c:5686:31: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
5686 | __pyx_type_8_geoslib_Polygon.tp_print = 0;
| ^
src/_geoslib.c:5694:34: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
5694 | __pyx_type_8_geoslib_LineString.tp_print = 0;
| ^
src/_geoslib.c:5702:29: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
5702 | __pyx_type_8_geoslib_Point.tp_print = 0;
| ^
error: Command "x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-1n6GrT/python3.9-3.9.5=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include -I/usr/local/lib/python3.9/dist-packages/numpy/core/include -I/usr/local/lib/python3.9/dist-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.9/numpy/distutils/include -I/usr/include/python3.9 -c src/_geoslib.c -o build/temp.linux-x86_64-3.9/src/_geoslib.o -MMD -MF build/temp.linux-x86_64-3.9/src/_geoslib.o.d -msse -msse2 -msse3" failed with exit status 1
########### EXT COMPILER OPTIMIZATION ###########
Platform :
Architecture: x64
Compiler : gcc
CPU baseline :
Requested : 'min'
Enabled : SSE SSE2 SSE3
Flags : -msse -msse2 -msse3
Extra checks: none
CPU dispatch :
Requested : 'max -xop -fma4'
Enabled : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL
Generated : none
CCompilerOpt._cache_write[796] : write cache to path -> /home/theodor/Downloads/basemap/build/temp.linux-x86_64-3.9/ccompiler_opt_cache_ext.py
Installing using pip results in the same error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
molinav commentedon Jun 24, 2021
It seems that
tp_printwas removed in CPython 3.9 (see https://bugs.python.org/issue39361), so this error is probably occurring in the conversion of_geoslib.pyxto_geoslib.c.Are you using the
_geoslib.cfile from the repo? It might work if you remove the C file to force the generation of this file again by Cython. This_geoslib.cfile in the repo is probably super-old and ideally it should be deleted and add Cython as build dependency.thdb-theo commentedon Jun 24, 2021
Thanks, that made me able to install, but led to another (possibly related) issue. When importing Basemap i get this error:
I have libgeos-dev 3.9.0-1installed
molinav commentedon Jun 24, 2021
That looks strange to me, in the original message the output says:
so I would expect
basemapto requestlibgeos-3.9.0.so, which is available in Ubuntu 21.04 under/usr/lib/x86_64-linux-gnu/libgeos-3.9.0.sowhen you installlibgeos-3.9.0(this package gets installed automatically withlibgeos-dev). Do you have several GEOS versions installed?thdb-theo commentedon Jun 24, 2021
Thank for your help! I fixed it by removing 3.9.1 and installing 3.9.0.
GeoFelpave commentedon Jul 24, 2021
Just to add here. The following worked for me without having to altered the version of Python.
sudo apt -y install libgeos-dev
pip3 install git+https://github.com/matplotlib/basemap/
molinav commentedon Dec 5, 2021
@thdb-theo @GeoFelpave I just uploaded preliminary wheel binaries of the future
basemapversion 1.3.0 (with bundledlibgeos_c). In case you are still interested you can try out with (for Python 2.7 and 3.5 to 3.9):