Skip to content

Cannot install pandas correctly due to unreachable code #32882

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

Closed
cleconte987 opened this issue Mar 21, 2020 · 14 comments
Closed

Cannot install pandas correctly due to unreachable code #32882

cleconte987 opened this issue Mar 21, 2020 · 14 comments
Labels
Build Library building on various platforms

Comments

@cleconte987
Copy link
Contributor

After running python setup.py build_ext --inplace -j 0:

Screenshot 2020-03-21 at 12 26 39

MacOS 10.14
python 3.6.6

I tried to install pandas from source in a setup virtual environment using pip.
I cloned the repository, created the virtual environment with python -m venv.
I ran pip install -r requirements-dev.txt
Had a few problems with versions of dependencies being too recent and not satisfying requirements, but I manually downgraded them.
And when I ran the above "python setup.py build_ext --inplace -j 0" I got the issue mentioned.

Thanks for your help

@ShaharNaveh
Copy link
Member

@cleconte987 Thank you for the report!


As a quick-fix I would have remove the -Werror" flag from setup.py, meaning turning this line:

pandas/setup.py

Line 436 in aee8e11

extra_compile_args = ["-Werror"]

from:

extra_compile_args = ["-Werror"]

to:

extra_compile_args = []

@ShaharNaveh ShaharNaveh added the Build Library building on various platforms label Mar 21, 2020
@ShaharNaveh
Copy link
Member

@WillAyd Is it a good idea to have something like:

if is_platform_windows():
    extra_compile_args = []
    ...
elif is_platform_macos():
    extra_compile_args = []
    ...
else:
    extra_compile_args = ["-Werror"]
    ...

in setup.py?

@WillAyd
Copy link
Member

WillAyd commented Mar 21, 2020 via email

@cleconte987
Copy link
Contributor Author

I don’t think we need to do that. clang / gcc mostly have the same flags, and if anything checking in clang is a little looser Can you post the full traceback (not a screenshot)?
On Mar 21, 2020, at 11:23 AM, MomIsBestFriend @.***> wrote: @WillAyd https://github.com/WillAyd Is it a good idea to have something like: if is_platform_windows(): extra_compile_args = [] ... elif is_platform_macos(): extra_compile_args = [] ... else: extra_compile_args = ["-Werror"] ... in setup.py? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#32882 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEU4UMFPAWPFKYTLCJR6JDRIUA2NANCNFSM4LQ4J44Q.
William Ayd [email protected]

Here are the whole logs:

running build_ext
building 'pandas._libs.algos' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/algos.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/algos.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/algos.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/algos.cpython-36m-darwin.so
building 'pandas._libs.groupby' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/groupby.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/groupby.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/groupby.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/groupby.cpython-36m-darwin.so
building 'pandas._libs.hashing' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/hashing.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashing.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashing.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/hashing.cpython-36m-darwin.so
building 'pandas._libs.hashtable' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/hashtable.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashtable.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashtable.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/hashtable.cpython-36m-darwin.so
building 'pandas._libs.index' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/index.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/index.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/index.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/index.cpython-36m-darwin.so
building 'pandas._libs.indexing' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/indexing.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/indexing.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/indexing.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/indexing.cpython-36m-darwin.so
building 'pandas._libs.internals' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/internals.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/internals.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/internals.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/internals.cpython-36m-darwin.so
building 'pandas._libs.interval' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/interval.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/interval.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/interval.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/interval.cpython-36m-darwin.so
building 'pandas._libs.join' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/join.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/join.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/join.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/join.cpython-36m-darwin.so
building 'pandas._libs.lib' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs -I./pandas/_libs -I./pandas/_libs/tslibs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/lib.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/lib.o -Werror
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs -I./pandas/_libs -I./pandas/_libs/tslibs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/src/parser/tokenizer.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/src/parser/tokenizer.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/lib.o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/src/parser/tokenizer.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/lib.cpython-36m-darwin.so
building 'pandas._libs.missing' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -I./pandas/_libs/tslibs -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/missing.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/missing.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/missing.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/missing.cpython-36m-darwin.so
building 'pandas._libs.parsers' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/parsers.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/parsers.o -Werror
pandas/_libs/parsers.c:50827:52: error: code will never be executed
[-Werror,-Wunreachable-code]
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCAL...
^~~~
pandas/_libs/parsers.c:50827:38: note: silence by adding parentheses to mark
code as explicitly dead
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCAL...
^
/* DISABLES CODE */ ( )
1 error generated.
error: command 'gcc' failed with exit status 1

@cleconte987
Copy link
Contributor Author

@cleconte987 Thank you for the report!

As a quick-fix I would have remove the -Werror" flag from setup.py, meaning turning this line:

pandas/setup.py

Line 436 in aee8e11

extra_compile_args = ["-Werror"]

from:

extra_compile_args = ["-Werror"]

to:

extra_compile_args = []

Ok I will try!

@WillAyd
Copy link
Member

WillAyd commented Mar 21, 2020

@cleconte987 can you post the output of pd.show_versions()?

@cleconte987
Copy link
Contributor Author

cleconte987 commented Mar 21, 2020

Actually the full full logs the first time I did it are these ones:

Compiling pandas/_libs/algos.pyx because it changed.
Compiling pandas/_libs/groupby.pyx because it changed.
Compiling pandas/_libs/hashing.pyx because it changed.
Compiling pandas/_libs/hashtable.pyx because it changed.
Compiling pandas/_libs/index.pyx because it changed.
Compiling pandas/_libs/indexing.pyx because it changed.
Compiling pandas/_libs/internals.pyx because it changed.
Compiling pandas/_libs/interval.pyx because it changed.
Compiling pandas/_libs/join.pyx because it changed.
Compiling pandas/_libs/lib.pyx because it changed.
Compiling pandas/_libs/missing.pyx because it changed.
Compiling pandas/_libs/parsers.pyx because it changed.
Compiling pandas/_libs/reduction.pyx because it changed.
Compiling pandas/_libs/ops.pyx because it changed.
Compiling pandas/_libs/ops_dispatch.pyx because it changed.
Compiling pandas/_libs/properties.pyx because it changed.
Compiling pandas/_libs/reshape.pyx because it changed.
Compiling pandas/_libs/sparse.pyx because it changed.
Compiling pandas/_libs/tslib.pyx because it changed.
Compiling pandas/_libs/tslibs/c_timestamp.pyx because it changed.
Compiling pandas/_libs/tslibs/ccalendar.pyx because it changed.
Compiling pandas/_libs/tslibs/conversion.pyx because it changed.
Compiling pandas/_libs/tslibs/fields.pyx because it changed.
Compiling pandas/_libs/tslibs/frequencies.pyx because it changed.
Compiling pandas/_libs/tslibs/nattype.pyx because it changed.
Compiling pandas/_libs/tslibs/np_datetime.pyx because it changed.
Compiling pandas/_libs/tslibs/offsets.pyx because it changed.
Compiling pandas/_libs/tslibs/parsing.pyx because it changed.
Compiling pandas/_libs/tslibs/period.pyx because it changed.
Compiling pandas/_libs/tslibs/resolution.pyx because it changed.
Compiling pandas/_libs/tslibs/strptime.pyx because it changed.
Compiling pandas/_libs/tslibs/timedeltas.pyx because it changed.
Compiling pandas/_libs/tslibs/timestamps.pyx because it changed.
Compiling pandas/_libs/tslibs/timezones.pyx because it changed.
Compiling pandas/_libs/tslibs/tzconversion.pyx because it changed.
Compiling pandas/_libs/testing.pyx because it changed.
Compiling pandas/_libs/window/aggregations.pyx because it changed.
Compiling pandas/_libs/window/indexers.pyx because it changed.
Compiling pandas/_libs/writers.pyx because it changed.
Compiling pandas/io/sas/sas.pyx because it changed.
[ 1/40] Cythonizing pandas/_libs/algos.pyx
[ 2/40] Cythonizing pandas/_libs/groupby.pyx
warning: pandas/_libs/groupby.pyx:1097:26: Unreachable code
[ 3/40] Cythonizing pandas/_libs/hashing.pyx
[ 4/40] Cythonizing pandas/_libs/hashtable.pyx
[ 5/40] Cythonizing pandas/_libs/index.pyx
[ 6/40] Cythonizing pandas/_libs/indexing.pyx
[ 7/40] Cythonizing pandas/_libs/internals.pyx
[ 8/40] Cythonizing pandas/_libs/interval.pyx
[ 9/40] Cythonizing pandas/_libs/join.pyx
[10/40] Cythonizing pandas/_libs/lib.pyx
[11/40] Cythonizing pandas/_libs/missing.pyx
[12/40] Cythonizing pandas/_libs/ops.pyx
[13/40] Cythonizing pandas/_libs/ops_dispatch.pyx
[14/40] Cythonizing pandas/_libs/parsers.pyx
[15/40] Cythonizing pandas/_libs/properties.pyx
[16/40] Cythonizing pandas/_libs/reduction.pyx
[17/40] Cythonizing pandas/_libs/reshape.pyx
[18/40] Cythonizing pandas/_libs/sparse.pyx
[19/40] Cythonizing pandas/_libs/testing.pyx
[20/40] Cythonizing pandas/_libs/tslib.pyx
[21/40] Cythonizing pandas/_libs/tslibs/c_timestamp.pyx
[22/40] Cythonizing pandas/_libs/tslibs/ccalendar.pyx
[23/40] Cythonizing pandas/_libs/tslibs/conversion.pyx
warning: pandas/_libs/tslibs/conversion.pyx:598:53: Buffer unpacking not optimized away.
warning: pandas/_libs/tslibs/conversion.pyx:598:53: Buffer unpacking not optimized away.
[24/40] Cythonizing pandas/_libs/tslibs/fields.pyx
[25/40] Cythonizing pandas/_libs/tslibs/frequencies.pyx
[26/40] Cythonizing pandas/_libs/tslibs/nattype.pyx
[27/40] Cythonizing pandas/_libs/tslibs/np_datetime.pyx
[28/40] Cythonizing pandas/_libs/tslibs/offsets.pyx
[29/40] Cythonizing pandas/_libs/tslibs/parsing.pyx
[30/40] Cythonizing pandas/_libs/tslibs/period.pyx
[31/40] Cythonizing pandas/_libs/tslibs/resolution.pyx
[32/40] Cythonizing pandas/_libs/tslibs/strptime.pyx
[33/40] Cythonizing pandas/_libs/tslibs/timedeltas.pyx
[34/40] Cythonizing pandas/_libs/tslibs/timestamps.pyx
[35/40] Cythonizing pandas/_libs/tslibs/timezones.pyx
[36/40] Cythonizing pandas/_libs/tslibs/tzconversion.pyx
[37/40] Cythonizing pandas/_libs/window/aggregations.pyx
[38/40] Cythonizing pandas/_libs/window/indexers.pyx
[39/40] Cythonizing pandas/_libs/writers.pyx
[40/40] Cythonizing pandas/io/sas/sas.pyx
running build_ext
building 'pandas._libs.algos' extension
creating build
creating build/temp.macosx-10.9-x86_64-3.6
creating build/temp.macosx-10.9-x86_64-3.6/pandas
creating build/temp.macosx-10.9-x86_64-3.6/pandas/_libs
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/algos.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/algos.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/algos.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/algos.cpython-36m-darwin.so
building 'pandas._libs.groupby' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/groupby.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/groupby.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/groupby.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/groupby.cpython-36m-darwin.so
building 'pandas._libs.hashing' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/hashing.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashing.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashing.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/hashing.cpython-36m-darwin.so
building 'pandas._libs.hashtable' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/hashtable.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashtable.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/hashtable.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/hashtable.cpython-36m-darwin.so
building 'pandas._libs.index' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/index.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/index.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/index.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/index.cpython-36m-darwin.so
building 'pandas._libs.indexing' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/indexing.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/indexing.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/indexing.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/indexing.cpython-36m-darwin.so
building 'pandas._libs.internals' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/internals.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/internals.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/internals.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/internals.cpython-36m-darwin.so
building 'pandas._libs.interval' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/interval.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/interval.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/interval.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/interval.cpython-36m-darwin.so
building 'pandas._libs.join' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/join.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/join.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/join.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/join.cpython-36m-darwin.so
building 'pandas._libs.lib' extension
creating build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/src
creating build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/src/parser
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs -I./pandas/_libs/tslibs -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/lib.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/lib.o -Werror
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs -I./pandas/_libs/tslibs -I./pandas/_libs -Ipandas/_libs/src/klib -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/src/parser/tokenizer.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/src/parser/tokenizer.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/lib.o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/src/parser/tokenizer.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/lib.cpython-36m-darwin.so
building 'pandas._libs.missing' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs/tslibs -I./pandas/_libs -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/missing.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/missing.o -Werror
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/missing.o -o /Users/clement/Desktop/Contributing_to_pandas/pandas/_libs/missing.cpython-36m-darwin.so
building 'pandas._libs.parsers' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DNPY_NO_DEPRECATED_API=0 -I./pandas/_libs -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/Users/clement/Desktop/Contributing_to_pandas/lib/python3.6/site-packages/numpy/core/include -I/Users/clement/Desktop/Contributing_to_pandas/include -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pandas/_libs/parsers.c -o build/temp.macosx-10.9-x86_64-3.6/pandas/_libs/parsers.o -Werror
pandas/_libs/parsers.c:50827:52: error: code will never be executed [-Werror,-Wunreachable-code]
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
^~~~
pandas/_libs/parsers.c:50827:38: note: silence by adding parentheses to mark code as explicitly dead
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
^
/* DISABLES CODE */ ( )
1 error generated.
error: command 'gcc' failed with exit status 1

Notice the warning: Unreachable code for pandas/_libs/groupby.pyx

pandas is not installed yet so I cannot do pd.show_versions(). Or pandas is installed but I cannot import it from source as C extensions are not built:

ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.

@WillAyd
Copy link
Member

WillAyd commented Mar 21, 2020 via email

@cleconte987
Copy link
Contributor Author

Yes the Cython version is 0.29.15
C Compiler (not sure which part is important so I put everything): [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
How can I attach the parsers.c file?

Here is a snippet containing line 50827:

#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { if (likely(cfunc->func)) { int flag = cfunc->flag; if (flag == METH_O) { return (*(cfunc->func))(self, arg); } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { if (PY_VERSION_HEX >= 0x030700A0) { return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1); } else { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL); } } return __Pyx__CallUnboundCMethod1(cfunc, self, arg); } #endif

@joooeey
Copy link
Contributor

joooeey commented May 26, 2020

ImportError: C extension: No module named 'pandas._libs.tslibs.conversion' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.

In #34280 I solved a similar error by re-installing the C-compiler and then running

python setup.py build_ext --inplace --force

Maybe that works here too?

@cleconte987
Copy link
Contributor Author

I used the turn-around proposed by @MomIsBestFriend to build pandas.

@Chaz6
Copy link

Chaz6 commented Sep 23, 2020

I just ran into this with Clang 10 on CentOS 7.

 build/temp.linux-x86_64-3.9/pandas/_libs/algos.o -Werror
  pandas/_libs/algos.c:81785:3: error: code will never be executed [-Werror,-Wunreachable-code]
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    ^~~~~~~~~~~~~~~~~~~~~~~
  pandas/_libs/algos.c:83402:3: error: code will never be executed [-Werror,-Wunreachable-code]
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    ^~~~~~~~~~~~~~~~~~~~~~~
  pandas/_libs/algos.c:84302:3: error: code will never be executed [-Werror,-Wunreachable-code]
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    ^~~~~~~~~~~~~~~~~~~~~~~
  pandas/_libs/algos.c:85202:3: error: code will never be executed [-Werror,-Wunreachable-code]
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    ^~~~~~~~~~~~~~~~~~~~~~~
  pandas/_libs/algos.c:85385:3: error: code will never be executed [-Werror,-Wunreachable-code]
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    ^~~~~~~~~~~~~~~~~~~~~~~
  pandas/_libs/algos.c:86285:3: error: code will never be executed [-Werror,-Wunreachable-code]
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_arr.rcbuffer->pybuffer);
    ^~~~~~~~~~~~~~~~~~~~~~~
  6 errors generated.
  error: command '/home/chaz/.local/bin/clang' failed with exit code 1

@anzhi0708
Copy link

Same error on Termux (Android Linux simulator).
'''
[ 2/40] Cythonizing pandas/_libs/groupby.pyx
warning: pandas/_libs/groupby.pyx: 1135: 26: Unreachable code
'''
and lots of 'code will never be executed' error. Fails with exit code 1.

@mroeschke mroeschke changed the title Cannot install pandas correctly in a particular environment using pip Cannot install pandas correctly due to unreachable code Jul 30, 2021
@mroeschke
Copy link
Member

Since this is an older version being built that we no longer support, closing. But can reopen if something similar is found in the future

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

No branches or pull requests

7 participants