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

[Python3] FutureWarning: Cython directive 'language_level' not set #164

Open
rapgro opened this issue May 12, 2019 · 3 comments
Open

[Python3] FutureWarning: Cython directive 'language_level' not set #164

rapgro opened this issue May 12, 2019 · 3 comments

Comments

@rapgro
Copy link

rapgro commented May 12, 2019

Fedora Rawhide with those package versions:

java-1.8.0-openjdk-devel 1.8.0.212.b04-0.fc31
python3-Cython 0.29.6-1.fc31
python3-devel 3.7.3-3.fc31
python3-nose 1.3.7-22.fc30
python3-numpy 1.16.3-1.fc31
python3-setuptools 41.0.1-1.fc31
python3-sphinx 2.0.1-1.fc31

jar cf build/lib.linux-x86_64-3.7/javabridge/jars/cpython.jar -C java org/cellprofiler/javabridge/CPython$StackFrame.class -C java org/cellprofiler/javabridge/CPython$WrappedException.class -C java org/cellprofiler/javabridge/CPython.class -C java org/cellprofiler/javabridge/CPythonInvocationHandler.class -C java org/cellprofiler/javabridge/CPythonInvocationHandler.class
/usr/lib64/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /builddir/build/BUILD/python-javabridge-1.0.18/_javabridge.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
warning: _javabridge_osspecific.pxd:12:4: 'JavaVMOption' redeclared 
warning: _javabridge_osspecific.pxd:19:4: 'JavaVMInitArgs' redeclared 
warning: _javabridge.pyx:93:4: 'jvalue' redeclared 
warning: _javabridge.pyx:111:4: 'JavaVMOption' redeclared 
warning: _javabridge.pyx:118:4: 'JavaVMInitArgs' redeclared 
/usr/lib64/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /builddir/build/BUILD/python-javabridge-1.0.18/_javabridge_mac.pxd
  tree = Parsing.p_module(s, pxd, full_module_name)
warning: _javabridge_osspecific.pxd:12:4: 'JavaVMOption' redeclared 
warning: _javabridge_osspecific.pxd:19:4: 'JavaVMInitArgs' redeclared 
warning: _javabridge_mac.pyx:4:4: 'jint' redeclared 
warning: _javabridge_mac.pyx:5:4: 'jboolean' redeclared 
warning: _javabridge_mac.pyx:9:4: 'JavaVM' redeclared 
warning: _javabridge_mac.pyx:14:4: 'JavaVMOption' redeclared 
warning: _javabridge_mac.pyx:21:4: 'JavaVMInitArgs' redeclared 
/usr/lib64/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /builddir/build/BUILD/python-javabridge-1.0.18/_javabridge_nomac.pxd
  tree = Parsing.p_module(s, pxd, full_module_name)
warning: _javabridge_nomac.pxd:15:4: 'JavaVMInitArgs' redeclared 
warning: _javabridge_nomac.pxd:20:4: 'JavaVMOption' redeclared 
warning: _javabridge_nomac.pyx:4:4: 'jint' redeclared 
warning: _javabridge_nomac.pyx:5:4: 'jboolean' redeclared 
warning: _javabridge_nomac.pyx:9:4: 'JavaVM' redeclared 
building 'javabridge._javabridge' extension
creating build/temp.linux-x86_64-3.7
gcc -pthread -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -I/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.fc30.x86_64/include -I/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.fc30.x86_64/include/linux -I/usr/lib64/python3.7/site-packages/numpy/core/include -I/usr/include/python3.7m -c _javabridge.c -o build/temp.linux-x86_64-3.7/_javabridge.o
error: command 'gcc' failed with exit status 1
@rapgro
Copy link
Author

rapgro commented May 12, 2019

Proposed fixes of other projects:
Toblerity/Fiona@19e36a2
stan-dev/pystan@68971f2

@rapgro
Copy link
Author

rapgro commented Jul 27, 2019

Not a good progress with latest git sources:

Fedora Rawhide
DEBUG util.py:587: java-1.8.0-openjdk-devel x86_64 1:1.8.0.222.b01-0.1.ea.fc31
DEBUG util.py:587: python3-Cython x86_64 0.29.12-2.fc31
DEBUG util.py:587: python3-devel x86_64 3.7.4-3.fc31
DEBUG util.py:587: python3-nose noarch 1.3.7-23.fc31
DEBUG util.py:587: python3-numpy x86_64 1:1.16.4-2.fc31
DEBUG util.py:587: python3-setuptools noarch 41.0.1-3.fc31
DEBUG util.py:587: python3-sphinx noarch 1:2.1.2-1.fc31
DEBUG util.py:587: rhino noarch 1.7.7.1-7.fc30

+ /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s'
BUILDSTDERR: Note: java/org/cellprofiler/javabridge/CPythonInvocationHandler.java uses unchecked or unsafe operations.
BUILDSTDERR: Note: Recompile with -Xlint:unchecked for details.
BUILDSTDERR: warning: _javabridge_osspecific.pxd:12:4: 'JavaVMOption' redeclared 
BUILDSTDERR: warning: _javabridge_osspecific.pxd:19:4: 'JavaVMInitArgs' redeclared 
BUILDSTDERR: warning: _javabridge.pyx:94:4: 'jvalue' redeclared 
BUILDSTDERR: warning: _javabridge.pyx:112:4: 'JavaVMOption' redeclared 
BUILDSTDERR: warning: _javabridge.pyx:119:4: 'JavaVMInitArgs' redeclared 
BUILDSTDERR: /usr/lib64/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /builddir/build/BUILD/python-javabridge-16d6c91c3aa9dbf8c80de1fc442aca696a6197fa/_javabridge_mac.pxd
BUILDSTDERR:   tree = Parsing.p_module(s, pxd, full_module_name)
BUILDSTDERR: warning: _javabridge_osspecific.pxd:12:4: 'JavaVMOption' redeclared 
BUILDSTDERR: warning: _javabridge_osspecific.pxd:19:4: 'JavaVMInitArgs' redeclared 
BUILDSTDERR: warning: _javabridge_mac.pyx:4:4: 'jint' redeclared 
BUILDSTDERR: warning: _javabridge_mac.pyx:5:4: 'jboolean' redeclared 
BUILDSTDERR: warning: _javabridge_mac.pyx:9:4: 'JavaVM' redeclared 
BUILDSTDERR: warning: _javabridge_mac.pyx:14:4: 'JavaVMOption' redeclared 
BUILDSTDERR: warning: _javabridge_mac.pyx:21:4: 'JavaVMInitArgs' redeclared 
BUILDSTDERR: /usr/lib64/python3.7/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /builddir/build/BUILD/python-javabridge-16d6c91c3aa9dbf8c80de1fc442aca696a6197fa/_javabridge_nomac.pxd
BUILDSTDERR:   tree = Parsing.p_module(s, pxd, full_module_name)
BUILDSTDERR: warning: _javabridge_nomac.pxd:15:4: 'JavaVMInitArgs' redeclared 
BUILDSTDERR: warning: _javabridge_nomac.pxd:20:4: 'JavaVMOption' redeclared 
BUILDSTDERR: warning: _javabridge_nomac.pyx:4:4: 'jint' redeclared 
BUILDSTDERR: warning: _javabridge_nomac.pyx:5:4: 'jboolean' redeclared 
BUILDSTDERR: warning: _javabridge_nomac.pyx:9:4: 'JavaVM' redeclared 

@rapgro rapgro changed the title FutureWarning: Cython directive 'language_level' not set [Python3] FutureWarning: Cython directive 'language_level' not set Jul 27, 2019
@LeeKamentsky
Copy link
Owner

I put code in setup.py to explicitly pass the -3 switch to Cython (c7ccaed). Does that fix the problem? All tests pass on Travis and the language_level warning appears to be gone.

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

2 participants