pythonlessons / TensorFlow-2.x-YOLOv3

YOLOv3 implementation in TensorFlow 2.3.1
https://pylessons.com/
MIT License
606 stars 327 forks source link

Jetson Nano: ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly #69

Closed chrisTopp84 closed 4 years ago

chrisTopp84 commented 4 years ago

Hi,

I'm trying to install the requirements but I'm facing a problem with the installation of opencv-python.

Some information: I'm using Ubuntu 18.04, Python 3.6.9, OpenCV 4.1.1 and work in a virtual environment I created this way:

Maybe someone had the same problem and could solve it.

python3 -m venv yolov3Tensorflow
source yolov3Tensorflow/bin/activate
(yolov3Tensorflow) christopher@ccz:~$ cd TensorFlow_2_x_YOLOv3/

Description of the error

(yolov3Tensorflow) christopher@ccz:~/TensorFlow_2_x_YOLOv3$ pip install opencv-python
Collecting opencv-python
  Using cached opencv-python-4.4.0.44.tar.gz (88.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from opencv-python) (1.16.1)
Building wheels for collected packages: opencv-python
  Building wheel for opencv-python (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/christopher/yolov3Tensorflow/bin/python /home/christopher/yolov3Tensorflow/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpg3wn763c
       cwd: /tmp/pip-install-spfl5_2j/opencv-python
  Complete output (9 lines):
    File "/tmp/pip-build-env-3np44f8c/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
      cmkr = cmaker.CMaker(cmake_executable)
    File "/tmp/pip-build-env-3np44f8c/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
      self.cmake_version = get_cmake_version(self.cmake_executable)
    File "/tmp/pip-build-env-3np44f8c/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
      "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
  Traceback (most recent call last):

  Problem with the CMake installation, aborting build. CMake executable is cmake
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

This is what i did so far but nothing helped:

pip install --upgrade pip setuptools wheel

    (yolov3Tensorflow) christopher@ccz:~/TensorFlow_2_x_YOLOv3$ pip install --upgrade pip setuptools wheel Collecting pip Using cached pip-20.2.3-py2.py3-none-any.whl (1.5 MB) Collecting setuptools Using cached setuptools-50.3.0-py3-none-any.whl (785 kB) Collecting wheel
    Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB) Installing collected packages: pip, setuptools, wheel Attempting uninstall: pip Found existing installation: pip 20.1.1 Uninstalling pip-20.1.1: Successfully uninstalled pip-20.1.1 Attempting uninstall: setuptools Found existing installation: setuptools 47.1.1 Uninstalling setuptools-47.1.1: Successfully uninstalled setuptools-47.1.1 Attempting uninstall: wheel Found existing installation: wheel 0.34.2 Uninstalling wheel-0.34.2: Successfully uninstalled wheel-0.34.2 Successfully installed pip-20.2.3 setuptools-50.3.0 wheel-0.35.1
pip3 install scikit-build

    (yolov3Tensorflow) christopher@ccz:~/TensorFlow_2_x_YOLOv3$ pip3 install scikit-build Collecting scikit-build Using cached scikit_build-0.11.1-py2.py3-none-any.whl (72 kB) Collecting packaging Using cached packaging-20.4-py2.py3-none-any.whl (37 kB) Collecting distro Using cached distro-1.5.0-py2.py3-none-any.whl (18 kB) Requirement already satisfied: wheel>=0.29.0 in /home/christopher/yolov3Tensorflow/lib/python3.6/site-packages (from scikit-build) (0.35.1) Requirement already satisfied: setuptools>=28.0.0; python_version >= "3" in /home/christopher/yolov3Tensorflow/lib/python3.6/site-packages (from scikit-build) (50.3.0) Requirement already satisfied: six in /usr/local/lib/python3.6/dist-packages (from packaging->scikit-build) (1.14.0) Requirement already satisfied: pyparsing>=2.0.2 in /usr/lib/python3/dist-packages (from packaging->scikit-build) (2.2.0) Installing collected packages: packaging, distro, scikit-build Successfully installed distro-1.5.0 packaging-20.4 scikit-build-0.11.1
pip3 install --upgrade pip

    (yolov3Tensorflow) christopher@ccz:~/TensorFlow_2_x_YOLOv3$ pip3 install --upgrade pip Requirement already up-to-date: pip in /home/christopher/yolov3Tensorflow/lib/python3.6/site-packages (20.2.3)
pip3 install cmake

    (yolov3Tensorflow) christopher@ccz:~/TensorFlow_2_x_YOLOv3$ pip3 install cmake Collecting cmake Using cached cmake-3.18.2.post1-py3-none-manylinux2014_aarch64.whl (15.2 MB) Installing collected packages: cmake Successfully installed cmake-3.18.2.post1

Does anyone else know another way to solve the problem or what I can try?

best regards chris

pythonlessons commented 4 years ago

Try the technique I used in RPI3, maybe you can do something similar: https://pylessons.com/YOLOv3-TF2-RaspberryPi/

chrisTopp84 commented 4 years ago

Thank you in advance for the hint. I will try it later and let you know if it worked.

chrisTopp84 commented 4 years ago

@pythonlessons: I have managed to install opencv-python with sudo apt-get install python-opencv But now I have this issue #37 So I thought about following all the instructions on the website you recommended. But unfortunatelly you have to install TF 2.2. As you can see in issue #37 it is not possible for me to install TF 2.2.

Should I take all the remaining steps and leave out the installation of TF 2.2 because I already have TF 2.1 installed?

pythonlessons commented 4 years ago

I don't remember now, but I think yolov3 works with 2.1, yolov4 won't work, so you can test it with tf2.1 and yolov3