TobyPDE / chianti

Python C++ extension for loading image batches for semantic segmentation asynchronously.
MIT License
10 stars 1 forks source link

Installation problem: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 #1

Closed srk97 closed 7 years ago

srk97 commented 7 years ago

Collecting git+https://github.com/TobyPDE/chianti Cloning https://github.com/TobyPDE/chianti to /tmp/pip-de3azgei-build Installing collected packages: Chianti Running setup.py install for Chianti ... error Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-de3azgei-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-x9r7_3j4-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_ext building 'chianti' extension creating build creating build/temp.linux-x86_64-3.5 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I/usr/include/python3.5m -c dataprovider.cpp -o build/temp.linux-x86_64-3.5/dataprovider.o -std=c++11 -fopenmp cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1788:0, from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18, from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/arrayobject.h:4, from dataprovider.cpp:2: /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

warning "Using deprecated NumPy API, disable it by " \

  ^
In file included from dataprovider.cpp:4:0:
chianti/provider.h: In member function ‘void Chianti::TensorDataProvider::computeNextBatch()’:
chianti/provider.h:266:131: error: ‘isnan’ was not declared in this scope
                             if (isnan(imgs[i0 * imgsStrides[0] + _i1 * imgsStrides[1] + i2 * imgsStrides[2] + i3 * imgsStrides[3]])) {
                                                                                                                                   ^
chianti/provider.h:266:131: note: suggested alternative:
In file included from /usr/include/c++/5/random:38:0,
                 from /usr/include/c++/5/bits/stl_algo.h:66,
                 from /usr/include/c++/5/algorithm:62,
                 from /usr/local/include/opencv2/core/core.hpp:56,
                 from /usr/local/include/opencv2/opencv.hpp:47,
                 from chianti/common.h:3,
                 from chianti/provider.h:3,
                 from dataprovider.cpp:4:
/usr/include/c++/5/cmath:641:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^
dataprovider.cpp: At global scope:
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
 };
 ^
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp: In function ‘int PyDataProvider_init(PyDataProvider*, PyObject*, PyObject*)’:
dataprovider.cpp:280:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"iterator", "batchsize", "augmentors", 0};
                                                                           ^
dataprovider.cpp:280:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp:280:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp: In function ‘PyObject* sequentialIterator(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:447:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"files", 0};
                                             ^
dataprovider.cpp: In function ‘PyObject* randomIterator(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:485:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"files", 0};
                                             ^
dataprovider.cpp: In function ‘PyObject* sampleIterator(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:523:56: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"files", "weights", 0};
                                                        ^
dataprovider.cpp:523:56: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp: In function ‘PyObject* subsampleAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:568:46: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"factor", 0};
                                              ^
dataprovider.cpp: In function ‘PyObject* gammaAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:590:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"gamma", 0};
                                             ^
dataprovider.cpp: In function ‘PyObject* translationAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:612:46: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"offset", 0};
                                              ^
dataprovider.cpp: In function ‘PyObject* zoomingAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:634:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"range", 0};
                                             ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-de3azgei-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-x9r7_3j4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-de3azgei-build/

srk97 commented 7 years ago

I used sudo pip3 install git+https://github.com/TobyPDE/chianti

TobyPDE commented 7 years ago

Can you try again now?

srk97 commented 7 years ago

Collecting git+https://github.com/TobyPDE/chianti Cloning https://github.com/TobyPDE/chianti to /tmp/pip-md7aalnl-build Installing collected packages: Chianti Running setup.py install for Chianti ... error Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-md7aalnl-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-dxrlfevu-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_ext building 'chianti' extension creating build creating build/temp.linux-x86_64-3.5 x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.5/dist-packages/numpy/core/include -I/usr/include/python3.5m -c dataprovider.cpp -o build/temp.linux-x86_64-3.5/dataprovider.o -std=c++11 -fopenmp cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1788:0, from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18, from /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/arrayobject.h:4, from dataprovider.cpp:2: /usr/local/lib/python3.5/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

warning "Using deprecated NumPy API, disable it by " \

  ^
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
 };
 ^
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp:30:1: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp: In function ‘int PyDataProvider_init(PyDataProvider*, PyObject*, PyObject*)’:
dataprovider.cpp:280:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"iterator", "batchsize", "augmentors", 0};
                                                                           ^
dataprovider.cpp:280:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp:280:75: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp: In function ‘PyObject* sequentialIterator(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:447:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"files", 0};
                                             ^
dataprovider.cpp: In function ‘PyObject* randomIterator(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:485:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"files", 0};
                                             ^
dataprovider.cpp: In function ‘PyObject* sampleIterator(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:523:56: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"files", "weights", 0};
                                                        ^
dataprovider.cpp:523:56: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
dataprovider.cpp: In function ‘PyObject* subsampleAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:568:46: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"factor", 0};
                                              ^
dataprovider.cpp: In function ‘PyObject* gammaAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:590:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"gamma", 0};
                                             ^
dataprovider.cpp: In function ‘PyObject* translationAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:612:46: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"offset", 0};
                                              ^
dataprovider.cpp: In function ‘PyObject* zoomingAugmentor(PyObject*, PyObject*, PyObject*)’:
dataprovider.cpp:634:45: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
     static char *keywordList[] = {"range", 0};
                                             ^
creating build/lib.linux-x86_64-3.5
x86_64-linux-gnu-g++ -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.5/dataprovider.o -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -o build/lib.linux-x86_64-3.5/chianti.cpython-35m-x86_64-linux-gnu.so -lgomp
/usr/bin/ld: cannot find -lopencv_imgcodecs
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

----------------------------------------

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-md7aalnl-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-dxrlfevu-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-md7aalnl-build/

srk97 commented 7 years ago

Getting a different error now.

TobyPDE commented 7 years ago

This error indicates that the setup script cannot find the opencv shared libraries. Make sure that they are available in der LD_LIBRARY_PATH.

TobyPDE commented 7 years ago

You might need to run it with sudo -E in order for your environment variables to be available in super user mode.

srk97 commented 7 years ago

Solved it! Thanks

Tetsujinfr commented 7 years ago

ok I got the same issue. So I did locate my OpenCV libraries and include files wth the command "pkg-config --libs --cflags opencv", which returns:

pkg-config --libs --cflags opencv
-I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_cudabgsegm -lopencv_cudaobjdetect -lopencv_cudastereo -lopencv_stitching -lopencv_cudafeatures2d -lopencv_superres -lopencv_cudacodec -lopencv_videostab -lopencv_cudaoptflow -lopencv_cudalegacy -lopencv_cudawarping -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dpm -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_plot -lopencv_dnn -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_photo -lopencv_imgcodecs -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_imgproc -lopencv_cudaarithm -lopencv_core -lopencv_cudev

I did export the three paths under $LD_LIBRARY_PATH, but when doing "sudo -E pip install git+https://github.com/TobyPDE/chianti" I still have the same error as above, which ends by:

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-Dt3JrW-build/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-upTGyc-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-Dt3JrW-build/

Can you tell me what I am doing wrong here? thank you

Tets

Tetsujinfr commented 7 years ago

SRK97, can you pls share what you did exactly that fixed it? thanks Tets