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 using Python 3.8, conflicting types for ‘_PyObject_FastCall’ #7001

Closed
mortoray opened this issue Jun 16, 2019 · 5 comments
Closed

Comments

@mortoray
Copy link

I'm trying to install mypy in a 3.8 virtual environment via pip install mypy and getting the below build error:

Collecting mypy
  Using cached https://files.pythonhosted.org/packages/6c/a9/e2ed2e2bb62317b331e85f471c495089140e79a9f92d539c422e44c70536/mypy-0.701-py3-none-any.whl
Collecting typed-ast<1.4.0,>=1.3.1 (from mypy)
  Using cached https://files.pythonhosted.org/packages/d3/b1/959c3ed4a9cc100feba7ad1a7d6336d8888937ee89f4a577f7698e09decd/typed-ast-1.3.5.tar.gz
Requirement already satisfied: mypy-extensions<0.5.0,>=0.4.0 in ./env/lib/python3.8/site-packages (from mypy) (0.4.1)
Installing collected packages: typed-ast, mypy
  Running setup.py install for typed-ast ... error
    ERROR: Complete output from command /src/mdl/env/bin/python3.8 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ho0bgd9w/typed-ast/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-vh68qrk6/install-record.txt --single-version-externally-managed --compile --install-headers /src/mdl/env/include/site/python3.8/typed-ast:                                                                                                          
    ERROR: 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/typed_ast                                                                                                                                                                                                                                                             
    copying typed_ast/__init__.py -> build/lib.linux-x86_64-3.8/typed_ast                                                                                                                                                                                                                                     
    copying typed_ast/ast3.py -> build/lib.linux-x86_64-3.8/typed_ast                                                                                                                                                                                                                                         
    copying typed_ast/ast27.py -> build/lib.linux-x86_64-3.8/typed_ast                                                                                                                                                                                                                                        
    copying typed_ast/conversions.py -> build/lib.linux-x86_64-3.8/typed_ast                                                                                                                                                                                                                                  
    package init file 'ast3/tests/__init__.py' not found (or not a regular file)                                                                                                                                                                                                                              
    creating build/lib.linux-x86_64-3.8/typed_ast/tests                                                                                                                                                                                                                                                       
    copying ast3/tests/test_basics.py -> build/lib.linux-x86_64-3.8/typed_ast/tests                                                                                                                                                                                                                           
    running build_ext                                                                                                                                                                                                                                                                                         
    building '_ast27' extension                                                                                                                                                                                                                                                                               
    creating build/temp.linux-x86_64-3.8                                                                                                                                                                                                                                                                      
    creating build/temp.linux-x86_64-3.8/ast27                                                                                                                                                                                                                                                                
    creating build/temp.linux-x86_64-3.8/ast27/Parser                                                                                                                                                                                                                                                         
    creating build/temp.linux-x86_64-3.8/ast27/Python                                                                                                                                                                                                                                                         
    creating build/temp.linux-x86_64-3.8/ast27/Custom                                                                                                                                                                                                                                                         
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/acceler.c -o build/temp.linux-x86_64-3.8/ast27/Parser/acceler.o                                                                                                                                                                                                           
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/bitset.c -o build/temp.linux-x86_64-3.8/ast27/Parser/bitset.o                                                                                                                                                                                                             
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/grammar.c -o build/temp.linux-x86_64-3.8/ast27/Parser/grammar.o                                                                                                                                                                                                           
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/grammar1.c -o build/temp.linux-x86_64-3.8/ast27/Parser/grammar1.o                                                                                                                                                                                                         
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/node.c -o build/temp.linux-x86_64-3.8/ast27/Parser/node.o                                                                                                                                                                                                                 
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/parser.c -o build/temp.linux-x86_64-3.8/ast27/Parser/parser.o                                                                                                                                                                                                             
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/parsetok.c -o build/temp.linux-x86_64-3.8/ast27/Parser/parsetok.o                                                                                                                                                                                                         
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Parser/tokenizer.c -o build/temp.linux-x86_64-3.8/ast27/Parser/tokenizer.o                                                                                                                                                                                                       
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Python/asdl.c -o build/temp.linux-x86_64-3.8/ast27/Python/asdl.o                                                                                                                                                                                                                 
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Python/ast.c -o build/temp.linux-x86_64-3.8/ast27/Python/ast.o                                                                                                                                                                                                                   
    ast27/Python/ast.c: In function ‘ast_for_print_stmt’:                                                                                                                                                                                                                                                     
    ast27/Python/ast.c:2432:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]                                                                                                                                                                                                         
             if (!dest)                                                                                                                                                                                                                                                                                       
             ^~                                                                                                                                                                                                                                                                                               
    ast27/Python/ast.c:2434:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’                                                                                                                                                                            
                 start = 4;                                                                                                                                                                                                                                                                                   
                 ^~~~~                                                                                                                                                                                                                                                                                        
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Python/graminit.c -o build/temp.linux-x86_64-3.8/ast27/Python/graminit.o                                                                                                                                                                                                         
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Python/mystrtoul.c -o build/temp.linux-x86_64-3.8/ast27/Python/mystrtoul.o                                                                                                                                                                                                       
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Python/Python-ast.c -o build/temp.linux-x86_64-3.8/ast27/Python/Python-ast.o                                                                                                                                                                                                     
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast27/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-3.8/ast27/Custom/typed_ast.o                                                                                                                                                                                                       
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/ast27/Parser/acceler.o build/temp.linux-x86_64-3.8/ast27/Parser/bitset.o build/temp.linux-x86_64-3.8/ast27/Parser/grammar.o build/temp.linux-x86_64-3.8/ast27/Parser/grammar1.o build/temp.linux-x86_64-3.8/ast27/Parser/node.o build/temp.linux-x86_64-3.8/ast27/Parser/parser.o build/temp.linux-x86_64-3.8/ast27/Parser/parsetok.o build/temp.linux-x86_64-3.8/ast27/Parser/tokenizer.o build/temp.linux-x86_64-3.8/ast27/Python/asdl.o build/temp.linux-x86_64-3.8/ast27/Python/ast.o build/temp.linux-x86_64-3.8/ast27/Python/graminit.o build/temp.linux-x86_64-3.8/ast27/Python/mystrtoul.o build/temp.linux-x86_64-3.8/ast27/Python/Python-ast.o build/temp.linux-x86_64-3.8/ast27/Custom/typed_ast.o -o build/lib.linux-x86_64-3.8/typed_ast/_ast27.cpython-38-x86_64-linux-gnu.so                                                                                                                                                                             
    building '_ast3' extension                                                                                                                                                                                                                                                                                
    creating build/temp.linux-x86_64-3.8/ast3                                                                                                                                                                                                                                                                 
    creating build/temp.linux-x86_64-3.8/ast3/Parser                                                                                                                                                                                                                                                          
    creating build/temp.linux-x86_64-3.8/ast3/Python                                                                                                                                                                                                                                                          
    creating build/temp.linux-x86_64-3.8/ast3/Custom                                                                                                                                                                                                                                                          
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/acceler.c -o build/temp.linux-x86_64-3.8/ast3/Parser/acceler.o                                                                                                                                                                                                              
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/bitset.c -o build/temp.linux-x86_64-3.8/ast3/Parser/bitset.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/grammar.c -o build/temp.linux-x86_64-3.8/ast3/Parser/grammar.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/grammar1.c -o build/temp.linux-x86_64-3.8/ast3/Parser/grammar1.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/node.c -o build/temp.linux-x86_64-3.8/ast3/Parser/node.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/parser.c -o build/temp.linux-x86_64-3.8/ast3/Parser/parser.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/parsetok.c -o build/temp.linux-x86_64-3.8/ast3/Parser/parsetok.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Parser/tokenizer.c -o build/temp.linux-x86_64-3.8/ast3/Parser/tokenizer.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Python/asdl.c -o build/temp.linux-x86_64-3.8/ast3/Python/asdl.o
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Iast3/Include -I/src/mdl/env/include -I/usr/include/python3.8 -c ast3/Python/ast.c -o build/temp.linux-x86_64-3.8/ast3/Python/ast.o
    ast3/Python/ast.c:22:1: error: conflicting types for ‘_PyObject_FastCall’
     _PyObject_FastCall(PyObject *func, PyObject *const *args, int nargs)
     ^~~~~~~~~~~~~~~~~~
    In file included from /usr/include/python3.8/abstract.h:837:0,
                     from /usr/include/python3.8/Python.h:147,
                     from ast3/Python/ast.c:6:
    /usr/include/python3.8/cpython/abstract.h:142:1: note: previous definition of ‘_PyObject_FastCall’ was here
     _PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
     ^~~~~~~~~~~~~~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/src/mdl/env/bin/python3.8 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ho0bgd9w/typed-ast/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-vh68qrk6/install-record.txt --single-version-externally-managed --compile --install-headers /src/mdl/env/include/site/python3.8/typed-ast" failed with error code 1 in /tmp/pip-install-ho0bgd9w/typed-ast/

I'm running Ubuntu 18.04 and setup my environment as follows:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8
sudo apt install python3.8-distutils python3.8-dev
sudo apt-get install python3.8-venv
python3.8 -m venv env
@mortoray
Copy link
Author

Installed typed-ast works:

pip install typed-ast

Yet the same build error appears when installed mypy, though it has identified typed-ast is already installed.

@mortoray
Copy link
Author

I see that typed-ast is no longer supported for 3.8+, and also that mypy should be using the standard ast package in this case. So I'm not sure what is going wrong.

@msullivan
Copy link
Collaborator

The issue is that the latest released version of mypy requires (well, says it requires; using the newer version would work fine) a version of typed-ast that doesn't build on 3.8. master should work on 3.8. We'll do a release soonish.

@mortoray
Copy link
Author

Is there anyway to install master via pip ?

@ethanhs
Copy link
Collaborator

ethanhs commented Jun 16, 2019

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