ERROR: Could not build wheels for opencv-python which > use PEP 517 and cannot be installed directly
ERROR: Could not build wheels for opencv-python which > use PEP 517 and cannot be installed directly
嗨,
我对这里显示的问题也有同样的问题 ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly。
我正在使用 jetson Nano (ubuntu 18.04)。
错误
Building wheel for opencv-python (PEP 517) ... error ERROR: Command
errored out with exit status 1: command:
/home/christopher/heartkillayolotest2/heartkillayolotest2/bin/python
/home/christopher/heartkillayolotest2/heartkillayolotest2/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py
build_wheel /tmp/tmpwort0shc
cwd: /tmp/pip-install-g68zdlf0/opencv-python Complete output (9 lines):
File "/tmp/pip-build-env-1b_l6sbo/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py",
line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/tmp/pip-build-env-1b_l6sbo/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-1b_l6sbo/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
我试过这个来解决问题,但没有帮助:
(heartkillayolotest2)christopher@ccz:~/heartkillayolotest2/heartkillayolotest2$
pip3 install --upgrade pip Requirement already up-to-date: pip in
./lib/python3.6/site-packages (20.2.3)
和
(heartkillayolotest2)
christopher@ccz:~/heartkillayolotest2/heartkillayolotest2/yolo-v3$
pip3 install --upgrade pip Requirement already up-to-date: pip in
/home/christopher/heartkillayolotest2/heartkillayolotest2/lib/python3.6/site-packages
(20.2.3)
不幸的是,错误仍然存在。
有人可以帮助我吗?
问题出在 cmake
和 python
上。 Python 需要 skbuild
和 cython
来完成这项工作。
pip3 install scikit-build
pip3 install cython
然后
pip3 install opencv-python
可惜我还好早了,因为还是会报错。
我做了以下操作(也许这些步骤会对其他人有所帮助)。
但对我来说,没有什么能解决问题。还有什么我可以做的吗?
pip 安装 cython
(yolov3Tensorflow) christopher@ccz:~/TensorFlow_2_x_YOLOv3$ pip install cython
Collecting cython Using cached
Cython-0.29.21-py2.py3-none-any.whl (974 kB) Installing collected
packages: cython Successfully installed cython-0.29.21 WARNING: You
are using pip version 20.1.1; however, version 20.2.3 is available.
You should consider upgrading via the
'/home/christopher/yolov3Tensorflow/bin/python -m pip install
--upgrade pip' command.
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 安装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 安装 --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 安装 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
这又是一个错误
(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
我不知道该怎么办知道吗?
您正在使用 Jetson Nano,这是一个 arm64
开发板。 opencv-python
的 ARM 架构没有 pre-built 个轮子。因此,pip
将尝试从源构建包。这不会成功,因为构建所需的 cmake
依赖项存在一个已知问题。您可以检查这些问题以获取更多信息:
- cmake: https://github.com/scikit-build/cmake-python-distributions/issues/115
- opencv-python: https://github.com/skvark/opencv-python/issues/366
目前,由于 cmake
问题,您无法在 ARM 架构系统上通过 opencv-python
包构建 OpenCV 的 Python 绑定。同时,您可以按照官方 OpenCV 文档从源代码安装 OpenCV Python 绑定:https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html
请注意,接受的答案不正确。如果您的 pip
版本大于 19.0,pip
将自动安装构建依赖项(不需要 cython
)。
非常感谢!我可以通过
安装它
$ sudo apt-get install python-opencv
之后我不得不再次安装opencv。我按照您提供给我的网站的说明进行操作 (https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html)。
我在 python-forum(德语)(https://www.python-forum.de/viewtopic.php?f=2&t=49781&p=373939#p373939) 中也得到了相同的 link。只是为了有人想用德语阅读它。
在尝试了本主题和其他主题中的大部分建议选项之后,包括最流行的选项:在安装 openCV 之前尝试 'pip install --upgrade pip setuptools wheel'。
最终对我有用的是:
pip install --no-use-pep517 opencv-python
(macOS)
嗨, 我对这里显示的问题也有同样的问题 ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly。
我正在使用 jetson Nano (ubuntu 18.04)。
错误
Building wheel for opencv-python (PEP 517) ... error ERROR: Command errored out with exit status 1: command: /home/christopher/heartkillayolotest2/heartkillayolotest2/bin/python /home/christopher/heartkillayolotest2/heartkillayolotest2/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpwort0shc cwd: /tmp/pip-install-g68zdlf0/opencv-python Complete output (9 lines): File "/tmp/pip-build-env-1b_l6sbo/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup cmkr = cmaker.CMaker(cmake_executable) File "/tmp/pip-build-env-1b_l6sbo/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-1b_l6sbo/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
我试过这个来解决问题,但没有帮助:
(heartkillayolotest2)christopher@ccz:~/heartkillayolotest2/heartkillayolotest2$ pip3 install --upgrade pip Requirement already up-to-date: pip in ./lib/python3.6/site-packages (20.2.3)
和
(heartkillayolotest2) christopher@ccz:~/heartkillayolotest2/heartkillayolotest2/yolo-v3$ pip3 install --upgrade pip Requirement already up-to-date: pip in /home/christopher/heartkillayolotest2/heartkillayolotest2/lib/python3.6/site-packages (20.2.3)
不幸的是,错误仍然存在。
有人可以帮助我吗?
问题出在 cmake
和 python
上。 Python 需要 skbuild
和 cython
来完成这项工作。
pip3 install scikit-build
pip3 install cython
然后
pip3 install opencv-python
可惜我还好早了,因为还是会报错。
我做了以下操作(也许这些步骤会对其他人有所帮助)。 但对我来说,没有什么能解决问题。还有什么我可以做的吗?
pip 安装 cython
(yolov3Tensorflow) christopher@ccz:~/TensorFlow_2_x_YOLOv3
$ pip install cython
Collecting cython Using cached Cython-0.29.21-py2.py3-none-any.whl (974 kB) Installing collected packages: cython Successfully installed cython-0.29.21 WARNING: You are using pip version 20.1.1; however, version 20.2.3 is available. You should consider upgrading via the '/home/christopher/yolov3Tensorflow/bin/python -m pip install --upgrade pip' command.
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 安装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 安装 --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 安装 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
这又是一个错误
(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
我不知道该怎么办知道吗?
您正在使用 Jetson Nano,这是一个 arm64
开发板。 opencv-python
的 ARM 架构没有 pre-built 个轮子。因此,pip
将尝试从源构建包。这不会成功,因为构建所需的 cmake
依赖项存在一个已知问题。您可以检查这些问题以获取更多信息:
- cmake: https://github.com/scikit-build/cmake-python-distributions/issues/115
- opencv-python: https://github.com/skvark/opencv-python/issues/366
目前,由于 cmake
问题,您无法在 ARM 架构系统上通过 opencv-python
包构建 OpenCV 的 Python 绑定。同时,您可以按照官方 OpenCV 文档从源代码安装 OpenCV Python 绑定:https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html
请注意,接受的答案不正确。如果您的 pip
版本大于 19.0,pip
将自动安装构建依赖项(不需要 cython
)。
非常感谢!我可以通过
安装它$ sudo apt-get install python-opencv
之后我不得不再次安装opencv。我按照您提供给我的网站的说明进行操作 (https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html)。
我在 python-forum(德语)(https://www.python-forum.de/viewtopic.php?f=2&t=49781&p=373939#p373939) 中也得到了相同的 link。只是为了有人想用德语阅读它。
在尝试了本主题和其他主题中的大部分建议选项之后,包括最流行的选项:在安装 openCV 之前尝试 'pip install --upgrade pip setuptools wheel'。
最终对我有用的是:
pip install --no-use-pep517 opencv-python
(macOS)