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

[bug] Error Python9 TypeObject has no member named 'tp_print' #17937

Closed
noelmcloughlin opened this issue Dec 5, 2020 · 7 comments
Closed

[bug] Error Python9 TypeObject has no member named 'tp_print' #17937

noelmcloughlin opened this issue Dec 5, 2020 · 7 comments
Labels
33 - Question Question about NumPy usage or development 57 - Close? Issues which may be closable unless discussion continued

Comments

@noelmcloughlin
Copy link

noelmcloughlin commented Dec 5, 2020

While installing Apache Airflow on Archlinux I see what looks like a Numby error. Python is version 3.9. I have not seen this error on Ubuntu 18, Centos7, Suse15.2 but they have older python versions (probably).

While searching, I found two CI jobs reporting the same error - see:
https://www.travis-ci.com/github/Unidata/MetPy/jobs/317424801
https://gitlab.sauerburger.com/frank/sortednp/-/jobs/53004

Error message:

Here is my error from "archlinux/archlinux" Vagrant box.

 building 'numpy.random.mtrand' extension
                      compiling C sources
                      C compiler: gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt
 -fno-semantic-interposition -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC

                      compile options: '-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Inumpy/core/include -Ibuild/src.linux-x86_64-3.9
/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -I
numpy/core/src/npysort -I/home/airflow/airflow/include -I/usr/include/python3.9 -Ibuild/src.linux-x86_64-3.9/numpy/core/src/common -Ibuild/src.linux-x86_64-3.
9/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.9/numpy/core/src/common -Ibuild/src.linux-x86_64-3.9/numpy/core/src/npymath -c'
                      gcc: numpy/random/mtrand/mtrand.c
                      numpy/random/mtrand/mtrand.c: In function '__Pyx_modinit_type_init_code':
                      numpy/random/mtrand/mtrand.c:40400:33: error: 'PyTypeObject' {aka 'struct _typeobject'} has no member named 'tp_print'
                      40400 |   __pyx_type_6mtrand_RandomState.tp_print = 0;
                            |                                 ^
                      numpy/random/mtrand/mtrand.c: In function '__Pyx_ParseOptionalKeywords':
                      numpy/random/mtrand/mtrand.c:42673:21: warning: '_PyUnicode_get_wstr_length' is deprecated [-Wdeprecated-declarations]
                      42673 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :

NumPy/Python version information:

I can install the pip package.

[root@archlinux vagrant]# pip install numpy
Collecting numpy
  Downloading numpy-1.19.4-cp39-cp39-manylinux2010_x86_64.whl (14.5 MB)
   14.5 MB 953 kB/s
Installing collected packages: numpy
Successfully installed numpy-1.19.4

Here is some version information

          cffi: 1.14.4
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.2
       libgit2: Not Installed
      M2Crypto: 0.36.0
          Mako: 1.1.3
       msgpack: 1.0.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.9.0 (default, Oct  7 2020, 23:09:01)
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 19.0.1
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.3

System Versions:
          dist: arch rolling n/a
        locale: utf-8
       machine: x86_64
       release: 5.9.11-arch2-1
        system: Linux
       version: Arch Linux rolling n/a
@seberg
Copy link
Member

seberg commented Dec 5, 2020

@noelmcloughlin this does not look like a NumPy issue. Instead it appears that your cython version is incompatible with Python 3.9, you probably should update cython and all is fine. It is possible that NumPy could check cython for a new enough version, but not sure.

@charris
Copy link
Member

charris commented Dec 5, 2020

Looks like it is gone in 3.9 and the slot reused for tp_vectorcall_offset (optional), was tp_print 3.0-3.6, but unused 3.0-3.7. See https://docs.python.org/3/c-api/typeobj.html.

@seberg seberg added the 33 - Question Question about NumPy usage or development label Dec 5, 2020
@noelmcloughlin
Copy link
Author

My error reports the latest Cython is cached. My work around is to remove"snowflake-connector-python>=2.3.6" from my project requirements so I can continue with what I'm doing.

@cserpell
Copy link

It is happening for me, using python 3.9 in a completely clean new virtualenv. It seems, as mentioned, it is because the change from tp_print to tp_vectorcall_offset. I cannot install numpy. I am using cython version 0.29.21.

@seberg
Copy link
Member

seberg commented Jan 11, 2021

I am still confused by this. Are you installing from source? In that case, maybe try a git clean -xdf (make sure to have no code changes applied or custom site.cfg). Also just to be sure python3.9 -mcython -V (assuming the python executable you are using is python3.9) is the right version and the pip you are using is right, by using python3.9 -mpip instead of pip directly, just in case.
Maybe @noelmcloughlin you had a solution? (I am not quite sure why removing "snoflake-connector" would make a difference)

@seberg seberg added the 57 - Close? Issues which may be closable unless discussion continued label Jan 11, 2021
@cserpell
Copy link

I am sorry, I was trying to install a previous version of numpy. Current version installs ok with python 3.9. It is ok now.

@seberg
Copy link
Member

seberg commented Jan 11, 2021

Thanks for the followup, will close the issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
33 - Question Question about NumPy usage or development 57 - Close? Issues which may be closable unless discussion continued
Projects
None yet
Development

No branches or pull requests

4 participants