Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error with Python 3.7 #414

Closed
sscherfke opened this issue Jul 17, 2018 · 4 comments
Closed

Build error with Python 3.7 #414

sscherfke opened this issue Jul 17, 2018 · 4 comments

Comments

@sscherfke
Copy link

I am trying to build basemap for Python 3.7 with conda-build. The build fails with the following error:

    In file included from src/_geoslib.c:433:0:
    /opt/emsconda/conda-bld/basemap_1531822202353/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_p
lacehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold
_placehold_placehold_pl/include/geos_c.h:149:22: note: expected ‘GEOSMessageHandler’ but argument is of type ‘void (*)
(char *, char *)’
     extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function,
                          ^
    src/_geoslib.c: In function ‘__Pyx__ExceptionSave’:
    src/_geoslib.c:5798:19: error: ‘PyThreadState’ has no member named ‘exc_type’
         *type = tstate->exc_type;
                       ^
    src/_geoslib.c:5799:20: error: ‘PyThreadState’ has no member named ‘exc_value’
         *value = tstate->exc_value;
                        ^
    src/_geoslib.c:5800:17: error: ‘PyThreadState’ has no member named ‘exc_traceback’
         *tb = tstate->exc_traceback;
                     ^
    src/_geoslib.c: In function ‘__Pyx__ExceptionReset’:
    src/_geoslib.c:5807:22: error: ‘PyThreadState’ has no member named ‘exc_type’
         tmp_type = tstate->exc_type;
                          ^
    src/_geoslib.c:5808:23: error: ‘PyThreadState’ has no member named ‘exc_value’
         tmp_value = tstate->exc_value;
                           ^
    src/_geoslib.c:5809:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’
         tmp_tb = tstate->exc_traceback;
                        ^
    src/_geoslib.c:5810:11: error: ‘PyThreadState’ has no member named ‘exc_type’
         tstate->exc_type = type;
               ^
    src/_geoslib.c:5811:11: error: ‘PyThreadState’ has no member named ‘exc_value’
         tstate->exc_value = value;
               ^
    src/_geoslib.c:5812:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’
         tstate->exc_traceback = tb;
               ^
    src/_geoslib.c: In function ‘__Pyx__GetException’:
    src/_geoslib.c:5857:22: error: ‘PyThreadState’ has no member named ‘exc_type’
         tmp_type = tstate->exc_type;
                          ^
    src/_geoslib.c:5858:23: error: ‘PyThreadState’ has no member named ‘exc_value’
         tmp_value = tstate->exc_value;
                           ^
    src/_geoslib.c:5859:20: error: ‘PyThreadState’ has no member named ‘exc_traceback’
         tmp_tb = tstate->exc_traceback;
                        ^
    src/_geoslib.c:5860:11: error: ‘PyThreadState’ has no member named ‘exc_type’
         tstate->exc_type = local_type;
               ^
    src/_geoslib.c:5861:11: error: ‘PyThreadState’ has no member named ‘exc_value’
         tstate->exc_value = local_value;
               ^
    src/_geoslib.c:5862:11: error: ‘PyThreadState’ has no member named ‘exc_traceback’
         tstate->exc_traceback = local_tb;
               ^
    src/_geoslib.c: In function ‘__Pyx_PyCFunction_FastCall’:
    src/_geoslib.c:5912:5: error: too many arguments to function ‘(struct PyObject * (*)(struct PyObject *, struct PyO
bject * const*, Py_ssize_t))meth’
         return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
         ^
    error: Command "gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -flto -fuse-linker-pl
ugin -ffat-lto-objects -flto-partition=none -fPIC -I/opt/emsconda/conda-bld/basemap_1531822202353/_h_env_placehold_pla
cehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p
lacehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/include -I/opt/emsconda/conda-bld/basemap_1531
822202353/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p
lacehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_pl/lib/python3.7/si
te-packages/numpy/core/include -I/opt/emsconda/conda-bld/basemap_1531822202353/_h_env_placehold_placehold_placehold_pl
acehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_
placehold_placehold_placehold_placehold_placehold_pl/lib/python3.7/site-packages/numpy/core/include -I/opt/emsconda/co
nda-bld/basemap_1531822202353/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p
lacehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold
_pl/include/python3.7m -c src/_geoslib.c -o build/temp.linux-x86_64-3.7/src/_geoslib.o -MMD -MF build/temp.linux-x86_6
4-3.7/src/_geoslib.o.d" failed with exit status 1

I have tried the latest release as well as the current master. I tried NumPy 1.14 and the RC for 1.15. I tried using an external libgeos and using the bundled one.

All combinations are working with Python 3.6 but failing with 3.7.

@sscherfke
Copy link
Author

It looks like regenerating the C sources with cythonize helps:

# Ensure our geos will be used.
rm -rf $SRC_DIR/geos-3.3.3
export GEOS_DIR=$PREFIX

# Regenerate C sources for Python 3.7
cythonize --force src/_geoslib.pyx

$PYTHON -m pip install -I --no-deps .

@lugizmo
Copy link

lugizmo commented Jul 19, 2018

Thanks @sscherfke that and installing pyproj from source fixed my problem with python 3.7!

@WeatherGod
Copy link
Member

WeatherGod commented Jul 19, 2018 via email

@milancurcic
Copy link

FWIW, I ran into this issue building my project with Python 3.7.1 and this thread got me on the right track. The only step necessary was to build pyproj from source before installing basemap. If I list pyproj github repo in my requirements.txt, this takes care of itself.

git+https://github.com/jswhit/pyproj
git+https://github.com/matplotlib/basemap

Cythonizing src/_geoslib.pyx was thus not necessary for me.

This is on Fedora 24, basemap-1.2.0, matplotlib-3.0.1, pyproj-1.9.5.1, geos-devel-3.5.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants