1

Recent python user, I am trying to use fcm module to analyze flow cytometry data (https://pythonhosted.org/fcm/). I find an error related to 'gcc' during pip install.

Tried updating pip and setuptools, also installed brew and openssl as suggested in How to fix gcc error produced by pip install?, still finding the same error.

The terminal output is the following:

Collecting fcm

  Downloading https://files.pythonhosted.org/packages/b8/50/92e6fcf82b3411def7c5c08a1b9be5fc4d5f4a4ae8eb7c95ee4b0485fbdd/fcm-0.9.1.tar.gz (1.1MB)
    100% |████████████████████████████████| 1.1MB 12.9MB/s

Installing collected packages: fcm

  Running setup.py install for fcm ... error

    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-424k_8e4/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-43efnrvl/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/fcm
    copying src/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/transforms.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/tree.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/annotation.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmdata.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/logicle.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/compensate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmcollection.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmexceptions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/subsample.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/experimental.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/dimechart.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_qgate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/flowjoxml.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/export_to_fcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/readfcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/mvnpdf.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/partition.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/modelresult.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/kmeans.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dime.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/distributions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dp_cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/component.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    running build_ext
    building 'fcm.core._logicle' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/src
    creating build/temp.macosx-10.7-x86_64-3.7/src/core
    creating build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/anaconda3/include -arch x86_64 -I/anaconda3/include -arch x86_64 -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/Logicle.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/Logicle.o
    warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    src/core/logicle_ext/Logicle.cpp:3:10: fatal error: 'cstring' file not found
    #include <cstring>
             ^~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-424k_8e4/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-43efnrvl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-424k_8e4/fcm/

I appreciate any further advice

Edit: After installing Command Line Tools and exporting -stdlib=libc++

Downloading https://files.pythonhosted.org/packages/b8/50/92e6fcf82b3411def7c5c08a1b9be5fc4d5f4a4ae8eb7c95ee4b0485fbdd/fcm-0.9.1.tar.gz (1.1MB)
    100% |████████████████████████████████| 1.1MB 13.3MB/s 
Installing collected packages: fcm
  Running setup.py install for fcm ... error
    Complete output from command /anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-p_ehtvg8/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-4xk1zm47/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    creating build/lib.macosx-10.7-x86_64-3.7/fcm
    copying src/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/transforms.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/tree.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/annotation.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmdata.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/logicle.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/compensate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmcollection.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/fcmexceptions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    copying src/core/subsample.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/core
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/experimental.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/plot_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    copying src/graphics/dimechart.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/graphics
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_qgate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    copying src/gui/mpl_gate.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/gui
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/flowjoxml.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/export_to_fcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    copying src/io/readfcs.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/io
    creating build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/mvnpdf.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/partition.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/util.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/modelresult.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/kmeans.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dime.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/distributions.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/dp_cluster.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    copying src/statistics/component.py -> build/lib.macosx-10.7-x86_64-3.7/fcm/statistics
    running build_ext
    building 'fcm.core._logicle' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/src
    creating build/temp.macosx-10.7-x86_64-3.7/src/core
    creating build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext
    gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -stdlib=libc++ -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/Logicle.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/Logicle.o
    src/core/logicle_ext/Logicle.cpp:290:4: warning: add explicit braces to avoid dangling else [-Wdangling-else]
                            else
                            ^
    1 warning generated.
    gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -stdlib=libc++ -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/my_logicle.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/my_logicle.o
    gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -stdlib=libc++ -I/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/anaconda3/include/python3.7m -c src/core/logicle_ext/my_logicle_wrapper.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/core/logicle_ext/my_logicle_wrapper.o
    src/core/logicle_ext/my_logicle_wrapper.cpp:788:3: error: no matching function for call to 'PyBytes_AsStringAndSize'
      PyBytes_AsStringAndSize(str, &cstr, &len);
      ^~~~~~~~~~~~~~~~~~~~~~~
    /anaconda3/include/python3.7m/bytesobject.h:103:17: note: candidate function not viable: no known conversion from 'int *' to 'Py_ssize_t *' (aka 'long *') for 3rd argument
    PyAPI_FUNC(int) PyBytes_AsStringAndSize(
                    ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2229:11: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
                        res = SWIG_AddCast(res);
                        ~~~ ^              ~~~
    src/core/logicle_ext/my_logicle_wrapper.cpp:2232:11: warning: explicitly assigning value of variable of type 'int' to itself [-Wself-assign]
                        res = SWIG_AddCast(res);
                        ~~~ ^              ~~~
    src/core/logicle_ext/my_logicle_wrapper.cpp:2454:20: error: use of undeclared identifier 'PyCObject_Import'; did you mean 'PyObject_Init'?
        type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
                       ^~~~~~~~~~~~~~~~
                       PyObject_Init
    /anaconda3/include/python3.7m/objimpl.h:130:24: note: 'PyObject_Init' declared here
    PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
                           ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2454:37: error: cannot initialize a parameter of type 'PyObject *' (aka '_object *') with an rvalue of type 'char *'
        type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /anaconda3/include/python3.7m/objimpl.h:130:48: note: passing argument to parameter here
    PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *);
                                                   ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2524:23: error: use of undeclared identifier 'PyCObject_FromVoidPtr'
      PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
                          ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2547:37: error: use of undeclared identifier 'PyCObject_AsVoidPtr'
        descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
                                        ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2552:13: error: use of undeclared identifier 'PyCObject_FromVoidPtr'
          obj = PyCObject_FromVoidPtr(descriptor, NULL);
                ^
    In file included from src/core/logicle_ext/my_logicle_wrapper.cpp:2800:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
    In file included from /anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:
    /anaconda3/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 " \
     ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2919:9: error: use of undeclared identifier 'PyString_Check'; did you mean 'PyMapping_Check'?
        if (PyString_Check(  py_obj)) return "string"      ;
            ^~~~~~~~~~~~~~
            PyMapping_Check
    /anaconda3/include/python3.7m/abstract.h:1006:17: note: 'PyMapping_Check' declared here
    PyAPI_FUNC(int) PyMapping_Check(PyObject *o);
                    ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2925:9: error: use of undeclared identifier 'PyFile_Check'
        if (PyFile_Check(    py_obj)) return "file"        ;
            ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:2927:9: error: use of undeclared identifier 'PyInstance_Check'; did you mean 'PySequence_Check'?
        if (PyInstance_Check(py_obj)) return "instance"    ;
            ^~~~~~~~~~~~~~~~
            PySequence_Check
    /anaconda3/include/python3.7m/abstract.h:838:17: note: 'PySequence_Check' declared here
    PyAPI_FUNC(int) PySequence_Check(PyObject *o);
                    ^
    src/core/logicle_ext/my_logicle_wrapper.cpp:3435:14: warning: explicitly assigning value of variable of type 'void *' to itself [-Wself-assign]
      clientdata = clientdata;
      ~~~~~~~~~~ ^ ~~~~~~~~~~
    4 warnings and 9 errors generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-p_ehtvg8/fcm/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-record-4xk1zm47/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/kt/54_zwpj929b852yth43_hj440000gn/T/pip-install-p_ehtvg8/fcm/

amr95
  • 23
  • 4
  • Try following this answer and see if this works for you https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave – Ron Serruya Jul 17 '19 at 12:03
  • Otherwise, try running ```export CFLAGS="-stdlib=libc++"``` and then pip install – Ron Serruya Jul 17 '19 at 12:04
  • I tried following the indications in the post you attach (with no effect) and then the export you suggest. This seems to have done something since now I am getting a different error message – amr95 Jul 18 '19 at 07:42

2 Answers2

0

if you are trying to install 'fcm' for 'django' then you can do it by

    pip install django-fcm
Rahul Verma
  • 2,988
  • 2
  • 11
  • 26
0

I am the maintainer of the FCM codebase, inherited after the original author graduated. FCM was developed to support an hierarchical Dirichlet process (HDP) clustering algorithm. I eventually decided to separate the functionality into 3 different libraries:

  • FlowIO: for those that simply need to read FCS data or create new FCS files
  • FlowUtils: for performing basic flow functions (compensation & transforms)
  • FlowStats: for those looking to use the specific HDP clustering algorithm

All of these have seen significant development since the last version of FCM. In addition to these, we've recently started development on FlowKit, which promises to be a more high-level and (hopefully) more intuitive Python framework for flow cytometry analysis and visualization, including GatingML support.

Note that FlowIO, FlowUtils, and FlowKit are on PyPI and available to install via pip, and are compatible with all platforms including Windows, Mac, and Linux due to the reduced number of dependencies and recent bug fixes.

Fiver
  • 9,909
  • 9
  • 43
  • 63