python-bioformats icon indicating copy to clipboard operation
python-bioformats copied to clipboard

Need to pass CFLAG to get pip/developer (python setup.py) installation to work

Open zacsimile opened this issue 5 years ago • 0 comments

If I run pip install python-bioformats or python setup.py develop in a cloned python-bioformats on my mac (macOS Catalina 10.15.7/python 3.7), the installation fails, and I get the following traceback.

running develop
running egg_info
creating python_bioformats.egg-info
writing python_bioformats.egg-info/PKG-INFO
writing dependency_links to python_bioformats.egg-info/dependency_links.txt
writing requirements to python_bioformats.egg-info/requires.txt
writing top-level names to python_bioformats.egg-info/top_level.txt
writing manifest file 'python_bioformats.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.py' under directory 'bioformats/tests'
warning: no files found matching '*.tif' under directory 'bioformats/tests'
warning: no files found matching '*.xml' under directory 'bioformats/tests'
writing manifest file 'python_bioformats.egg-info/SOURCES.txt'
running build_ext
Creating /Users/zachcm/opt/miniconda3/envs/pyme/lib/python3.7/site-packages/python-bioformats.egg-link (link to .)
Adding python-bioformats 4.0.0rc5.dev2+g05a053b to easy-install.pth file

Installed /Users/zachcm/Code/python-bioformats
Processing dependencies for python-bioformats==4.0.0rc5.dev2+g05a053b
Searching for python-javabridge==4.0.0
Reading https://pypi.org/simple/python-javabridge/
Downloading https://files.pythonhosted.org/packages/58/5c/bfcc52002c9dfe5fe3bd067783243ab0130f59f757b0517f62f1ba7e88ea/python-javabridge-4.0.0.tar.gz#sha256=9fd9c85e6a32f4edd9fff659d387cbf4c1c91fde9fe3670e4f6d37d79eb6200f
Best match: python-javabridge 4.0.0
Processing python-javabridge-4.0.0.tar.gz
Writing /var/folders/rc/qr0v_fvn3kl2gqscbtvck4v40000gn/T/easy_install-bti4e0w6/python-javabridge-4.0.0/setup.cfg
Running python-javabridge-4.0.0/setup.py -q bdist_egg --dist-dir /var/folders/rc/qr0v_fvn3kl2gqscbtvck4v40000gn/T/easy_install-bti4e0w6/python-javabridge-4.0.0/egg-dist-tmp-tu7t9384
no previously-included directories found matching '*.pyx'
Note: /var/folders/rc/qr0v_fvn3kl2gqscbtvck4v40000gn/T/easy_install-bti4e0w6/python-javabridge-4.0.0/java/org/cellprofiler/javabridge/CPythonInvocationHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
In file included from _javabridge.c:610:
In file included from /Users/zachcm/opt/miniconda3/envs/pyme/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/zachcm/opt/miniconda3/envs/pyme/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /Users/zachcm/opt/miniconda3/envs/pyme/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822:
/Users/zachcm/opt/miniconda3/envs/pyme/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: 
      "Using deprecated NumPy API, disable it with "          "#define
      NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
 ^
In file included from _javabridge.c:616:
./mac_javabridge_utils.h:47:25: warning: this function declaration is not a
      prototype [-Wstrict-prototypes]
JNIEXPORT void MacStopVM();
                        ^
                         void
./mac_javabridge_utils.h:55:30: warning: this function declaration is not a
      prototype [-Wstrict-prototypes]
JNIEXPORT void MacRunLoopInit();
                             ^
                              void
./mac_javabridge_utils.h:63:29: warning: this function declaration is not a
      prototype [-Wstrict-prototypes]
JNIEXPORT void MacRunLoopRun();
                            ^
                             void
./mac_javabridge_utils.h:71:31: warning: this function declaration is not a
      prototype [-Wstrict-prototypes]
JNIEXPORT void MacRunLoopReset();
                              ^
                               void
./mac_javabridge_utils.h:79:30: warning: this function declaration is not a
      prototype [-Wstrict-prototypes]
JNIEXPORT void MacStopRunLoop();
                             ^
                              void
./mac_javabridge_utils.h:88:30: warning: this function declaration is not a
      prototype [-Wstrict-prototypes]
JNIEXPORT int MacIsMainThread();
                             ^
                              void
./mac_javabridge_utils.h:103:20: warning: this function declaration is not a
      prototype [-Wstrict-prototypes]
void MacRunLoopStop();
                   ^
                    void
_javabridge.c:8237:36: error: implicit declaration of function 'CreateJavaVM' is
      invalid in C99 [-Werror,-Wimplicit-function-declaration]
  __pyx_t_3 = __Pyx_PyInt_From_int(CreateJavaVM((&__pyx_v_self->vm), ((v...
                                   ^
_javabridge.c:8237:36: note: did you mean 'JNI_CreateJavaVM'?
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/include/jni.h:1938:1: note: 
      'JNI_CreateJavaVM' declared here
JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
^
_javabridge.c:9326:5: error: implicit declaration of function 'StopVM' is
      invalid in C99 [-Werror,-Wimplicit-function-declaration]
    StopVM(__pyx_v_self->vm);
    ^
_javabridge.c:29467:3: warning: incompatible pointer to integer conversion
      returning 'void *' from a function with result type 'int'
      [-Wint-conversion]
  import_array();
  ^~~~~~~~~~~~~~
/Users/zachcm/opt/miniconda3/envs/pyme/lib/python3.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1531:151: note: 
      expanded from macro 'import_array'
  ..."numpy.core.multiarray failed to import"); return NULL; } }
                                                       ^~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/stddef.h:89:16: note: 
      expanded from macro 'NULL'
#  define NULL ((void*)0)
               ^~~~~~~~~~
9 warnings and 2 errors generated.

If I first run

export CFLAGS='-Wno-implicit-function-declaration'

then the pip/development install works fine.

zacsimile avatar Dec 04 '20 15:12 zacsimile