How to install OpenCV on Raspbian Stretch? The Next CEO of Stack OverflowHow to install OpenCV on Raspberry Pi 3 in Raspbian Jessie?How to install OpenCV 3 on Raspbian JessieError Install OpenCV 3.1.0Installing Opencv make errorHow to install opencv on raspbian jessie Lite?Video Output through ssh on Raspbian Minimal + OpenCV example?How to install RetroPie over Raspbian Stretch?Can't install OpenCV-3.4.0 on Raspbian Stretch (CMake error)How to install R 3.5.1 on raspbian stretchcan't install mariadb 10.1 on raspbian stretchRaspbian Stretch install imapclient to Python 3.5.3

Math-accent symbol over parentheses enclosing accented symbol (amsmath)

Method for adding error messages to a dictionary given a key

Why do airplanes bank sharply to the right after air-to-air refueling?

Where do students learn to solve polynomial equations these days?

Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?

What is the value of α and β in a triangle?

What steps are necessary to read a Modern SSD in Medieval Europe?

Why didn't Khan get resurrected in the Genesis Explosion?

Why do remote US companies require working in the US?

Why this way of making earth uninhabitable in Interstellar?

How many extra stops do monopods offer for tele photographs?

Find non-case sensitive string in a mixed list of elements?

Is it convenient to ask the journal's editor for two additional days to complete a review?

Why does the flight controls check come before arming the autobrake on the A320?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

Is it professional to write unrelated content in an almost-empty email?

Chain wire methods together in Lightning Web Components

Recycling old answers

Is there a difference between "Fahrstuhl" and "Aufzug"

How to install OpenCV on Raspbian Stretch?

Powershell. How to parse gci Name?

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

How to place nodes around a circle from some initial angle?

Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?



How to install OpenCV on Raspbian Stretch?



The Next CEO of Stack OverflowHow to install OpenCV on Raspberry Pi 3 in Raspbian Jessie?How to install OpenCV 3 on Raspbian JessieError Install OpenCV 3.1.0Installing Opencv make errorHow to install opencv on raspbian jessie Lite?Video Output through ssh on Raspbian Minimal + OpenCV example?How to install RetroPie over Raspbian Stretch?Can't install OpenCV-3.4.0 on Raspbian Stretch (CMake error)How to install R 3.5.1 on raspbian stretchcan't install mariadb 10.1 on raspbian stretchRaspbian Stretch install imapclient to Python 3.5.3










2















The directions for Raspbian Jessie fail with Error 2:



...
[ 43%] Building CXX object modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_imgproc_tests_cpu.cpp.o
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
modules/gapi/CMakeFiles/opencv_test_gapi.dir/build.make:158: recipe for target 'modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o' failed
make[2]: *** [modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o] Error 4
make[2]: *** Waiting for unfinished jobs....
[ 43%] Building CXX object modules/dnn/CMakeFiles/opencv_test_dnn.dir/test/test_ie_models.cpp.o
...


How can I install on Stretch?










share|improve this question







New contributor




mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    2















    The directions for Raspbian Jessie fail with Error 2:



    ...
    [ 43%] Building CXX object modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_imgproc_tests_cpu.cpp.o
    c++: internal compiler error: Killed (program cc1plus)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
    modules/gapi/CMakeFiles/opencv_test_gapi.dir/build.make:158: recipe for target 'modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o' failed
    make[2]: *** [modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o] Error 4
    make[2]: *** Waiting for unfinished jobs....
    [ 43%] Building CXX object modules/dnn/CMakeFiles/opencv_test_dnn.dir/test/test_ie_models.cpp.o
    ...


    How can I install on Stretch?










    share|improve this question







    New contributor




    mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      2












      2








      2








      The directions for Raspbian Jessie fail with Error 2:



      ...
      [ 43%] Building CXX object modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_imgproc_tests_cpu.cpp.o
      c++: internal compiler error: Killed (program cc1plus)
      Please submit a full bug report,
      with preprocessed source if appropriate.
      See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
      modules/gapi/CMakeFiles/opencv_test_gapi.dir/build.make:158: recipe for target 'modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o' failed
      make[2]: *** [modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o] Error 4
      make[2]: *** Waiting for unfinished jobs....
      [ 43%] Building CXX object modules/dnn/CMakeFiles/opencv_test_dnn.dir/test/test_ie_models.cpp.o
      ...


      How can I install on Stretch?










      share|improve this question







      New contributor




      mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      The directions for Raspbian Jessie fail with Error 2:



      ...
      [ 43%] Building CXX object modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_imgproc_tests_cpu.cpp.o
      c++: internal compiler error: Killed (program cc1plus)
      Please submit a full bug report,
      with preprocessed source if appropriate.
      See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
      modules/gapi/CMakeFiles/opencv_test_gapi.dir/build.make:158: recipe for target 'modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o' failed
      make[2]: *** [modules/gapi/CMakeFiles/opencv_test_gapi.dir/test/cpu/gapi_core_tests_cpu.cpp.o] Error 4
      make[2]: *** Waiting for unfinished jobs....
      [ 43%] Building CXX object modules/dnn/CMakeFiles/opencv_test_dnn.dir/test/test_ie_models.cpp.o
      ...


      How can I install on Stretch?







      raspbian-stretch opencv






      share|improve this question







      New contributor




      mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 5 hours ago









      mmorinmmorin

      1414




      1414




      New contributor




      mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes


















          3














          Following these directions from PyImageSearch fixes the problem. I assume you already have





          sudo apt-get update
          sudo apt-get -y upgrade
          sudo apt-get -y install build-essential cmake unzip pkg-config
          sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev
          sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
          sudo apt-get -y install libxvidcore-dev libx264-dev
          sudo apt-get -y install libgtk-3-dev
          sudo apt-get -y install libcanberra-gtk*
          sudo apt-get -y install libatlas-base-dev gfortran
          sudo apt-get -y install python3-dev

          cd ~
          sudo rm -r -f opencv
          git clone https://github.com/opencv/opencv.git
          sudo rm -r -f opencv_contrib
          git clone https://github.com/Itseez/opencv_contrib.git

          pip3 install numpy
          cd ~/opencv
          mkdir build
          cd build
          cmake -D CMAKE_BUILD_TYPE=RELEASE
          -D CMAKE_INSTALL_PREFIX=/usr/local
          -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
          -D ENABLE_NEON=ON
          -D ENABLE_VFPV3=ON
          -D BUILD_TESTS=OFF
          -D OPENCV_ENABLE_NONFREE=ON
          -D INSTALL_PYTHON_EXAMPLES=OFF
          -D BUILD_EXAMPLES=OFF ..

          make -j4
          sudo make install
          sudo ldconfig


          Stuck at 99%?



          You may get this error:



          ...
          [ 99%] Built target gen_opencv_python_source
          [ 99%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
          c++: internal compiler error: Killed (program cc1plus)
          Please submit a full bug report,
          with preprocessed source if appropriate.
          See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
          modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
          make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
          CMakeFiles/Makefile2:11656: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
          make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
          Makefile:160: recipe for target 'all' failed
          make: *** [all] Error 2


          You need to increase your swap size, as mentioned in the original directions. Open /etc/dphys-swapfile:



          sudo nano /etc/dphys-swapfile


          and edit the CONF_SWAPSIZE variable:



          # set size to absolute value, leaving empty (default) then uses computed value
          # you most likely don't want this, unless you have an special disk situation
          # CONF_SWAPSIZE=100
          CONF_SWAPSIZE=2048


          It worked for me without further problems:



          >>> import cv2
          >>>





          share|improve this answer








          New contributor




          mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















            Your Answer






            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("schematics", function ()
            StackExchange.schematics.init();
            );
            , "cicuitlab");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "447"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            mmorin is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f95982%2fhow-to-install-opencv-on-raspbian-stretch%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            Following these directions from PyImageSearch fixes the problem. I assume you already have





            sudo apt-get update
            sudo apt-get -y upgrade
            sudo apt-get -y install build-essential cmake unzip pkg-config
            sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev
            sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
            sudo apt-get -y install libxvidcore-dev libx264-dev
            sudo apt-get -y install libgtk-3-dev
            sudo apt-get -y install libcanberra-gtk*
            sudo apt-get -y install libatlas-base-dev gfortran
            sudo apt-get -y install python3-dev

            cd ~
            sudo rm -r -f opencv
            git clone https://github.com/opencv/opencv.git
            sudo rm -r -f opencv_contrib
            git clone https://github.com/Itseez/opencv_contrib.git

            pip3 install numpy
            cd ~/opencv
            mkdir build
            cd build
            cmake -D CMAKE_BUILD_TYPE=RELEASE
            -D CMAKE_INSTALL_PREFIX=/usr/local
            -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
            -D ENABLE_NEON=ON
            -D ENABLE_VFPV3=ON
            -D BUILD_TESTS=OFF
            -D OPENCV_ENABLE_NONFREE=ON
            -D INSTALL_PYTHON_EXAMPLES=OFF
            -D BUILD_EXAMPLES=OFF ..

            make -j4
            sudo make install
            sudo ldconfig


            Stuck at 99%?



            You may get this error:



            ...
            [ 99%] Built target gen_opencv_python_source
            [ 99%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
            c++: internal compiler error: Killed (program cc1plus)
            Please submit a full bug report,
            with preprocessed source if appropriate.
            See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
            modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
            make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
            CMakeFiles/Makefile2:11656: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
            make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
            Makefile:160: recipe for target 'all' failed
            make: *** [all] Error 2


            You need to increase your swap size, as mentioned in the original directions. Open /etc/dphys-swapfile:



            sudo nano /etc/dphys-swapfile


            and edit the CONF_SWAPSIZE variable:



            # set size to absolute value, leaving empty (default) then uses computed value
            # you most likely don't want this, unless you have an special disk situation
            # CONF_SWAPSIZE=100
            CONF_SWAPSIZE=2048


            It worked for me without further problems:



            >>> import cv2
            >>>





            share|improve this answer








            New contributor




            mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.
























              3














              Following these directions from PyImageSearch fixes the problem. I assume you already have





              sudo apt-get update
              sudo apt-get -y upgrade
              sudo apt-get -y install build-essential cmake unzip pkg-config
              sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev
              sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
              sudo apt-get -y install libxvidcore-dev libx264-dev
              sudo apt-get -y install libgtk-3-dev
              sudo apt-get -y install libcanberra-gtk*
              sudo apt-get -y install libatlas-base-dev gfortran
              sudo apt-get -y install python3-dev

              cd ~
              sudo rm -r -f opencv
              git clone https://github.com/opencv/opencv.git
              sudo rm -r -f opencv_contrib
              git clone https://github.com/Itseez/opencv_contrib.git

              pip3 install numpy
              cd ~/opencv
              mkdir build
              cd build
              cmake -D CMAKE_BUILD_TYPE=RELEASE
              -D CMAKE_INSTALL_PREFIX=/usr/local
              -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
              -D ENABLE_NEON=ON
              -D ENABLE_VFPV3=ON
              -D BUILD_TESTS=OFF
              -D OPENCV_ENABLE_NONFREE=ON
              -D INSTALL_PYTHON_EXAMPLES=OFF
              -D BUILD_EXAMPLES=OFF ..

              make -j4
              sudo make install
              sudo ldconfig


              Stuck at 99%?



              You may get this error:



              ...
              [ 99%] Built target gen_opencv_python_source
              [ 99%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
              c++: internal compiler error: Killed (program cc1plus)
              Please submit a full bug report,
              with preprocessed source if appropriate.
              See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
              modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
              make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
              CMakeFiles/Makefile2:11656: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
              make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
              Makefile:160: recipe for target 'all' failed
              make: *** [all] Error 2


              You need to increase your swap size, as mentioned in the original directions. Open /etc/dphys-swapfile:



              sudo nano /etc/dphys-swapfile


              and edit the CONF_SWAPSIZE variable:



              # set size to absolute value, leaving empty (default) then uses computed value
              # you most likely don't want this, unless you have an special disk situation
              # CONF_SWAPSIZE=100
              CONF_SWAPSIZE=2048


              It worked for me without further problems:



              >>> import cv2
              >>>





              share|improve this answer








              New contributor




              mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                3












                3








                3







                Following these directions from PyImageSearch fixes the problem. I assume you already have





                sudo apt-get update
                sudo apt-get -y upgrade
                sudo apt-get -y install build-essential cmake unzip pkg-config
                sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev
                sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
                sudo apt-get -y install libxvidcore-dev libx264-dev
                sudo apt-get -y install libgtk-3-dev
                sudo apt-get -y install libcanberra-gtk*
                sudo apt-get -y install libatlas-base-dev gfortran
                sudo apt-get -y install python3-dev

                cd ~
                sudo rm -r -f opencv
                git clone https://github.com/opencv/opencv.git
                sudo rm -r -f opencv_contrib
                git clone https://github.com/Itseez/opencv_contrib.git

                pip3 install numpy
                cd ~/opencv
                mkdir build
                cd build
                cmake -D CMAKE_BUILD_TYPE=RELEASE
                -D CMAKE_INSTALL_PREFIX=/usr/local
                -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
                -D ENABLE_NEON=ON
                -D ENABLE_VFPV3=ON
                -D BUILD_TESTS=OFF
                -D OPENCV_ENABLE_NONFREE=ON
                -D INSTALL_PYTHON_EXAMPLES=OFF
                -D BUILD_EXAMPLES=OFF ..

                make -j4
                sudo make install
                sudo ldconfig


                Stuck at 99%?



                You may get this error:



                ...
                [ 99%] Built target gen_opencv_python_source
                [ 99%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
                c++: internal compiler error: Killed (program cc1plus)
                Please submit a full bug report,
                with preprocessed source if appropriate.
                See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
                modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
                make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
                CMakeFiles/Makefile2:11656: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
                make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
                Makefile:160: recipe for target 'all' failed
                make: *** [all] Error 2


                You need to increase your swap size, as mentioned in the original directions. Open /etc/dphys-swapfile:



                sudo nano /etc/dphys-swapfile


                and edit the CONF_SWAPSIZE variable:



                # set size to absolute value, leaving empty (default) then uses computed value
                # you most likely don't want this, unless you have an special disk situation
                # CONF_SWAPSIZE=100
                CONF_SWAPSIZE=2048


                It worked for me without further problems:



                >>> import cv2
                >>>





                share|improve this answer








                New contributor




                mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                Following these directions from PyImageSearch fixes the problem. I assume you already have





                sudo apt-get update
                sudo apt-get -y upgrade
                sudo apt-get -y install build-essential cmake unzip pkg-config
                sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev
                sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
                sudo apt-get -y install libxvidcore-dev libx264-dev
                sudo apt-get -y install libgtk-3-dev
                sudo apt-get -y install libcanberra-gtk*
                sudo apt-get -y install libatlas-base-dev gfortran
                sudo apt-get -y install python3-dev

                cd ~
                sudo rm -r -f opencv
                git clone https://github.com/opencv/opencv.git
                sudo rm -r -f opencv_contrib
                git clone https://github.com/Itseez/opencv_contrib.git

                pip3 install numpy
                cd ~/opencv
                mkdir build
                cd build
                cmake -D CMAKE_BUILD_TYPE=RELEASE
                -D CMAKE_INSTALL_PREFIX=/usr/local
                -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
                -D ENABLE_NEON=ON
                -D ENABLE_VFPV3=ON
                -D BUILD_TESTS=OFF
                -D OPENCV_ENABLE_NONFREE=ON
                -D INSTALL_PYTHON_EXAMPLES=OFF
                -D BUILD_EXAMPLES=OFF ..

                make -j4
                sudo make install
                sudo ldconfig


                Stuck at 99%?



                You may get this error:



                ...
                [ 99%] Built target gen_opencv_python_source
                [ 99%] Building CXX object modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o
                c++: internal compiler error: Killed (program cc1plus)
                Please submit a full bug report,
                with preprocessed source if appropriate.
                See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.
                modules/python2/CMakeFiles/opencv_python2.dir/build.make:62: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o' failed
                make[2]: *** [modules/python2/CMakeFiles/opencv_python2.dir/__/src2/cv2.cpp.o] Error 4
                CMakeFiles/Makefile2:11656: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
                make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
                Makefile:160: recipe for target 'all' failed
                make: *** [all] Error 2


                You need to increase your swap size, as mentioned in the original directions. Open /etc/dphys-swapfile:



                sudo nano /etc/dphys-swapfile


                and edit the CONF_SWAPSIZE variable:



                # set size to absolute value, leaving empty (default) then uses computed value
                # you most likely don't want this, unless you have an special disk situation
                # CONF_SWAPSIZE=100
                CONF_SWAPSIZE=2048


                It worked for me without further problems:



                >>> import cv2
                >>>






                share|improve this answer








                New contributor




                mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 5 hours ago









                mmorinmmorin

                1414




                1414




                New contributor




                mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                mmorin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




















                    mmorin is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    mmorin is a new contributor. Be nice, and check out our Code of Conduct.












                    mmorin is a new contributor. Be nice, and check out our Code of Conduct.











                    mmorin is a new contributor. Be nice, and check out our Code of Conduct.














                    Thanks for contributing an answer to Raspberry Pi Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f95982%2fhow-to-install-opencv-on-raspbian-stretch%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to create a command for the “strange m” symbol in latex? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How do you make your own symbol when Detexify fails?Writing bold small caps with mathpazo packageplus-minus symbol with parenthesis around the minus signGreek character in Beamer document titleHow to create dashed right arrow over symbol?Currency symbol: Turkish LiraDouble prec as a single symbol?Plus Sign Too Big; How to Call adfbullet?Is there a TeX macro for three-legged pi?How do I get my integral-like symbol to align like the integral?How to selectively substitute a letter with another symbol representing the same letterHow do I generate a less than symbol and vertical bar that are the same height?

                    Българска екзархия Съдържание История | Български екзарси | Вижте също | Външни препратки | Литература | Бележки | НавигацияУстав за управлението на българската екзархия. Цариград, 1870Слово на Ловешкия митрополит Иларион при откриването на Българския народен събор в Цариград на 23. II. 1870 г.Българската правда и гръцката кривда. От С. М. (= Софийски Мелетий). Цариград, 1872Предстоятели на Българската екзархияПодмененият ВеликденИнформационна агенция „Фокус“Димитър Ризов. Българите в техните исторически, етнографически и политически граници (Атлас съдържащ 40 карти). Berlin, Königliche Hoflithographie, Hof-Buch- und -Steindruckerei Wilhelm Greve, 1917Report of the International Commission to Inquire into the Causes and Conduct of the Balkan Wars

                    Чепеларе Съдържание География | История | Население | Спортни и природни забележителности | Културни и исторически обекти | Религии | Обществени институции | Известни личности | Редовни събития | Галерия | Източници | Литература | Външни препратки | Навигация41°43′23.99″ с. ш. 24°41′09.99″ и. д. / 41.723333° с. ш. 24.686111° и. д.*ЧепелареЧепеларски Linux fest 2002Начало на Зимен сезон 2005/06Национални хайдушки празници „Капитан Петко Войвода“Град ЧепелареЧепеларе – народният ски курортbgrod.orgwww.terranatura.hit.bgСправка за населението на гр. Исперих, общ. Исперих, обл. РазградМузей на родопския карстМузей на спорта и скитеЧепеларебългарскибългарскианглийскитукИстория на градаСки писти в ЧепелареВремето в ЧепелареРадио и телевизия в ЧепелареЧепеларе мами с родопски чар и добри пистиЕвтин туризъм и снежни атракции в ЧепелареМестоположениеИнформация и снимки от музея на родопския карст3D панорами от ЧепелареЧепелареррр