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

pip compile error: error: invalid conversion from ‘PyObject*’ {aka ‘_object*’} to ‘int’ [-fpermissive] #40

Closed
peterbjorgensen opened this issue Jan 21, 2020 · 4 comments

Comments

@peterbjorgensen
Copy link

I am trying to pip install dscribe on Arch linux with python 3.8 and get the following error:

pip install --user dscribe
Collecting dscribe
  Downloading https://files.pythonhosted.org/packages/b8/13/ff23825ac17f99e3a25756a9e2b256dcf278b2dad983f2d4c16206645255/dscribe-0.3.2.tar.gz (185kB)
     |████████████████████████████████| 194kB 412kB/s 
Requirement already satisfied: pybind11>=2.4 in /usr/lib/python3.8/site-packages (from dscribe) (2.4.3)
Requirement already satisfied: numpy in /usr/lib/python3.8/site-packages (from dscribe) (1.18.1)
Requirement already satisfied: scipy in /usr/lib/python3.8/site-packages (from dscribe) (1.4.1)
Requirement already satisfied: ase>=3.19.0 in /usr/lib/python3.8/site-packages (from dscribe) (3.19.0)
Requirement already satisfied: scikit-learn in /usr/lib/python3.8/site-packages (from dscribe) (0.22)
Requirement already satisfied: joblib in /usr/lib/python3.8/site-packages (from dscribe) (0.14.1)
Requirement already satisfied: matplotlib in /usr/lib/python3.8/site-packages (from ase>=3.19.0->dscribe) (3.1.2)
Requirement already satisfied: cycler>=0.10 in /usr/lib/python3.8/site-packages (from matplotlib->ase>=3.19.0->dscribe) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/lib/python3.8/site-packages (from matplotlib->ase>=3.19.0->dscribe) (1.1.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python3.8/site-packages (from matplotlib->ase>=3.19.0->dscribe) (2.4.6)
Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3.8/site-packages (from matplotlib->ase>=3.19.0->dscribe) (2.8.1)
Requirement already satisfied: six in /usr/lib/python3.8/site-packages (from cycler>=0.10->matplotlib->ase>=3.19.0->dscribe) (1.13.0)
Requirement already satisfied: setuptools in /usr/lib/python3.8/site-packages (from kiwisolver>=1.0.1->matplotlib->ase>=3.19.0->dscribe) (43.0.0)
Installing collected packages: dscribe
    Running setup.py install for dscribe ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4iw9lqz5/dscribe/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4iw9lqz5/dscribe/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-a8omy8ap/install-record.txt --single-version-externally-managed --compile --user --prefix=
         cwd: /tmp/pip-install-4iw9lqz5/dscribe/
    Complete output (129 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/dscribe
    copying dscribe/__init__.py -> build/lib.linux-x86_64-3.8/dscribe
    creating build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/descriptor.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/acsf.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/matrixdescriptor.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/soap.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/ewaldsummatrix.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/lmbtr.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/sinematrix.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/__init__.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/coulombmatrix.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/mbtr.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    copying dscribe/descriptors/elementaldistribution.py -> build/lib.linux-x86_64-3.8/dscribe/descriptors
    creating build/lib.linux-x86_64-3.8/dscribe/utils
    copying dscribe/utils/__init__.py -> build/lib.linux-x86_64-3.8/dscribe/utils
    copying dscribe/utils/stats.py -> build/lib.linux-x86_64-3.8/dscribe/utils
    copying dscribe/utils/geometry.py -> build/lib.linux-x86_64-3.8/dscribe/utils
    copying dscribe/utils/species.py -> build/lib.linux-x86_64-3.8/dscribe/utils
    creating build/lib.linux-x86_64-3.8/dscribe/libmbtr
    copying dscribe/libmbtr/__init__.py -> build/lib.linux-x86_64-3.8/dscribe/libmbtr
    creating build/lib.linux-x86_64-3.8/dscribe/kernels
    copying dscribe/kernels/rematchkernel.py -> build/lib.linux-x86_64-3.8/dscribe/kernels
    copying dscribe/kernels/averagekernel.py -> build/lib.linux-x86_64-3.8/dscribe/kernels
    copying dscribe/kernels/localsimilaritykernel.py -> build/lib.linux-x86_64-3.8/dscribe/kernels
    copying dscribe/kernels/__init__.py -> build/lib.linux-x86_64-3.8/dscribe/kernels
    creating build/lib.linux-x86_64-3.8/dscribe/libacsf
    copying dscribe/libacsf/__init__.py -> build/lib.linux-x86_64-3.8/dscribe/libacsf
    creating build/lib.linux-x86_64-3.8/dscribe/core
    copying dscribe/core/lattice.py -> build/lib.linux-x86_64-3.8/dscribe/core
    copying dscribe/core/__init__.py -> build/lib.linux-x86_64-3.8/dscribe/core
    copying dscribe/core/system.py -> build/lib.linux-x86_64-3.8/dscribe/core
    running egg_info
    writing dscribe.egg-info/PKG-INFO
    writing dependency_links to dscribe.egg-info/dependency_links.txt
    writing requirements to dscribe.egg-info/requires.txt
    writing top-level names to dscribe.egg-info/top_level.txt
    reading manifest file 'dscribe.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'dscribe.egg-info/SOURCES.txt'
    creating build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/ext/celllist.cpp -> build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/ext/celllist.h -> build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/ext/ext.cpp -> build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/ext/soapGTO.cpp -> build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/ext/soapGTO.h -> build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/ext/soapGeneral.cpp -> build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/ext/soapGeneral.h -> build/lib.linux-x86_64-3.8/dscribe/ext
    copying dscribe/libmbtr/mbtr.cpp -> build/lib.linux-x86_64-3.8/dscribe/libmbtr
    copying dscribe/libmbtr/mbtr.h -> build/lib.linux-x86_64-3.8/dscribe/libmbtr
    copying dscribe/libmbtr/mbtrwrapper.cpp -> build/lib.linux-x86_64-3.8/dscribe/libmbtr
    copying dscribe/libacsf/acsf.cpp -> build/lib.linux-x86_64-3.8/dscribe/libacsf
    copying dscribe/libacsf/acsf.h -> build/lib.linux-x86_64-3.8/dscribe/libacsf
    copying dscribe/libacsf/acsfwrapper.cpp -> build/lib.linux-x86_64-3.8/dscribe/libacsf
    running build_ext
    building 'dscribe.libacsf.acsfwrapper' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/dscribe
    creating build/temp.linux-x86_64-3.8/dscribe/libacsf
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -Idscribe/libacsf -I/usr/include/python3.8 -c dscribe/libacsf/acsfwrapper.cpp -o build/temp.linux-x86_64-3.8/dscribe/libacsf/acsfwrapper.o -std=c++11 -O3
    dscribe/libacsf/acsfwrapper.cpp: In function ‘int __Pyx_InitCachedConstants()’:
    dscribe/libacsf/acsfwrapper.cpp:3893:74: error: invalid conversion from ‘int’ to ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
     3893 |   __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dscribe_libacsf_acsfwrapper_pyx, __pyx_n_s_rebuild, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 7, __pyx_L1_error)
    dscribe/libacsf/acsfwrapper.cpp:352:37: note: in definition of macro ‘__Pyx_PyCode_New’
      352 |           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |                                     ^
    dscribe/libacsf/acsfwrapper.cpp:3893:242: error: invalid conversion from ‘PyObject*’ {aka ‘_object*’} to ‘int’ [-fpermissive]
     3893 |   __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dscribe_libacsf_acsfwrapper_pyx, __pyx_n_s_rebuild, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 7, __pyx_L1_error)
          |                                                                                                                                                                                                                                                  ^~~~~~~~~~~~~~~~~
          |                                                                                                                                                                                                                                                  |
          |                                                                                                                                                                                                                                                  PyObject* {aka _object*}
    dscribe/libacsf/acsfwrapper.cpp:352:69: note: in definition of macro ‘__Pyx_PyCode_New’
      352 |           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |                                                                     ^~~~
    dscribe/libacsf/acsfwrapper.cpp:3893:261: error: invalid conversion from ‘int’ to ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
     3893 |   __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dscribe_libacsf_acsfwrapper_pyx, __pyx_n_s_rebuild, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 7, __pyx_L1_error)
          |                                                                                                                                                                                                                                                                     ^
          |                                                                                                                                                                                                                                                                     |
          |                                                                                                                                                                                                                                                                     int
    dscribe/libacsf/acsfwrapper.cpp:352:75: note: in definition of macro ‘__Pyx_PyCode_New’
      352 |           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |                                                                           ^~~~~
    dscribe/libacsf/acsfwrapper.cpp:352:86: error: too many arguments to function ‘PyCodeObject* PyCode_New(int, int, int, int, int, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, int, PyObject*)’
      352 |           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |                                                                                      ^
    dscribe/libacsf/acsfwrapper.cpp:3893:33: note: in expansion of macro ‘__Pyx_PyCode_New’
     3893 |   __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(6, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_dscribe_libacsf_acsfwrapper_pyx, __pyx_n_s_rebuild, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 7, __pyx_L1_error)
          |                                 ^~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.8/compile.h:5,
                     from /usr/include/python3.8/Python.h:138,
                     from dscribe/libacsf/acsfwrapper.cpp:24:
    /usr/include/python3.8/code.h:122:28: note: declared here
      122 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
          |                            ^~~~~~~~~~
    dscribe/libacsf/acsfwrapper.cpp: In function ‘PyCodeObject* __Pyx_CreateCodeObjectForTraceback(const char*, int, int, const char*)’:
    dscribe/libacsf/acsfwrapper.cpp:5036:9: error: invalid conversion from ‘PyObject*’ {aka ‘_object*’} to ‘int’ [-fpermissive]
     5036 |         py_funcname,  /*PyObject *name,*/
          |         ^~~~~~~~~~~
          |         |
          |         PyObject* {aka _object*}
    dscribe/libacsf/acsfwrapper.cpp:352:69: note: in definition of macro ‘__Pyx_PyCode_New’
      352 |           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |                                                                     ^~~~
    dscribe/libacsf/acsfwrapper.cpp:5037:9: error: invalid conversion from ‘int’ to ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
     5037 |         py_line,
          |         ^~~~~~~
          |         |
          |         int
    dscribe/libacsf/acsfwrapper.cpp:352:75: note: in definition of macro ‘__Pyx_PyCode_New’
      352 |           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |                                                                           ^~~~~
    dscribe/libacsf/acsfwrapper.cpp:352:86: error: too many arguments to function ‘PyCodeObject* PyCode_New(int, int, int, int, int, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, int, PyObject*)’
      352 |           PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
          |                                                                                      ^
    dscribe/libacsf/acsfwrapper.cpp:5023:15: note: in expansion of macro ‘__Pyx_PyCode_New’
     5023 |     py_code = __Pyx_PyCode_New(
          |               ^~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.8/compile.h:5,
                     from /usr/include/python3.8/Python.h:138,
                     from dscribe/libacsf/acsfwrapper.cpp:24:
    /usr/include/python3.8/code.h:122:28: note: declared here
      122 | PyAPI_FUNC(PyCodeObject *) PyCode_New(
          |                            ^~~~~~~~~~
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4iw9lqz5/dscribe/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4iw9lqz5/dscribe/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-a8omy8ap/install-record.txt --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

@lauri-codes
Copy link
Contributor

Hi @peterbjorgensen,

This issue is isolated to python 3.8. The fastest way to fix it for now is to use an older python version. Changing the python version should be easiest within a virtualenv.

The problem originates somewhere in the cython wrapper that is used. I will investigate further but can't promise a deadline for a python3.8 fix.

@jan-janssen
Copy link
Contributor

@lauri-codes Can you regenerate https://github.com/SINGROUP/dscribe/blob/master/dscribe/libmbtr/mbtrwrapper.cpp ? - It was generated with cython 0.29.10 which is not Python 3.8 compatible, while https://github.com/SINGROUP/dscribe/blob/master/dscribe/libacsf/acsfwrapper.cpp which you already regenerated with cython 0.29.14 is Python 3.8 compatible. The current release of cython is 0.29.15 so it might even make sense to regenerate both with the latest version.

@lauri-codes
Copy link
Contributor

Thanks Jan! I will do this.

@lauri-codes
Copy link
Contributor

This is now fixed in 0.3.5, and python3.8 was added as a new test environment in the DScribe CI.

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

3 participants