我正在尝试按照 here 的说明安装 TF 对象检测 API。 不使用任何与 GPU 相关的东西。 除了这一行,我已经成功地完成了所有事情:
python -m pip install --use-feature=2020-resolver .
计算该命令后,我得到:
(Py37_{defect_detector}) MacBook-Pro-melamoro:research melamoro$ python -m pip install --use-feature=2020-resolver .
Usage:
/Users/melamoro/Desktop/venvs/Py37_{defect_detector}/bin/python -m pip install [options] <requirement specifier> [package-index-options] ...
/Users/melamoro/Desktop/venvs/Py37_{defect_detector}/bin/python -m pip install [options] -r <requirements file> [package-index-options] ...
/Users/melamoro/Desktop/venvs/Py37_{defect_detector}/bin/python -m pip install [options] [-e] <vcs project url> ...
/Users/melamoro/Desktop/venvs/Py37_{defect_detector}/bin/python -m pip install [options] [-e] <local project path> ...
/Users/melamoro/Desktop/venvs/Py37_{defect_detector}/bin/python -m pip install [options] <archive url/path> ...
option --use-feature: invalid choice: '2020-resolver' (choose from 'fast-deps', 'truststore', 'no-binary-enable-wheel-cache')
我不是 python 专家,我不知道我还应该检查或安装什么来解决这个错误。 我试图用谷歌搜索它,但还没有遇到任何可能有帮助的东西。 非常欢迎任何帮助。
我的笔记本电脑:2014 年末的 MacBook Pro,macOS Big Sur 11.7。 我为我的任务创建了一个虚拟环境,并且我正在执行其他已经存在的命令。 让我的 venv 处于活动状态,我检查是否安装了主要包:
(Py37_{defect_detector}) MacBook-Pro-melamoro:research melamoro$ pip --version
pip 23.0.1 from /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages/pip (python 3.11)
(Py37_{defect_detector}) MacBook-Pro-melamoro:research melamoro$ pip show tensorflow
Name: tensorflow
Version: 2.12.0rc0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages
Requires: absl-py, astunparse, flatbuffers, gast, google-pasta, grpcio, h5py, jax, keras, libclang, numpy, opt-einsum, packaging, protobuf, setuptools, six, tensorboard, tensorflow-estimator, tensorflow-io-gcs-filesystem, termcolor, typing-extensions, wrapt
Required-by:
(Py37_{defect_detector}) MacBook-Pro-melamoro:research melamoro$ python --version
Python 3.11.2
更新
我考虑了答案中的一些建议,看起来情况有所好转,但仍然存在错误,但有点不同:
(Py37_{defect_detector}) MacBook-Pro-melamoro:research melamoro$ python -m pip install .
Processing /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/models/research
Preparing metadata (setup.py) ... done
Collecting avro-python3
Downloading avro-python3-1.10.2.tar.gz (38 kB)
Preparing metadata (setup.py) ... done
Collecting apache-beam
Downloading apache-beam-2.45.0.zip (3.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 3.2 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: pillow in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (9.4.0)
Collecting lxml
Using cached lxml-4.9.2-cp311-cp311-macosx_11_0_x86_64.whl
Requirement already satisfied: matplotlib in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (3.7.1)
Requirement already satisfied: Cython in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (0.29.33)
Requirement already satisfied: contextlib2 in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (21.6.0)
Collecting tf-slim
Downloading tf_slim-1.1.0-py2.py3-none-any.whl (352 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 352.1/352.1 kB 7.3 MB/s eta 0:00:00
Requirement already satisfied: six in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (1.16.0)
Collecting pycocotools
Downloading pycocotools-2.0.6.tar.gz (24 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting lvis
Downloading lvis-0.5.3-py3-none-any.whl (14 kB)
Requirement already satisfied: scipy in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (1.10.1)
Requirement already satisfied: pandas in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (1.5.3)
Collecting tf-models-official>=2.5.1
Downloading tf_models_official-2.11.3-py2.py3-none-any.whl (2.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 3.5 MB/s eta 0:00:00
Collecting tensorflow_io
Downloading tensorflow_io-0.31.0-cp311-cp311-macosx_10_14_x86_64.whl (24.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24.6/24.6 MB 3.0 MB/s eta 0:00:00
Requirement already satisfied: keras in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from object-detection==0.1) (2.12.0rc1)
Collecting pyparsing==2.4.7
Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 67.8/67.8 kB 5.6 MB/s eta 0:00:00
Collecting sacrebleu<=2.2.0
Downloading sacrebleu-2.2.0-py3-none-any.whl (116 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.6/116.6 kB 10.1 MB/s eta 0:00:00
Collecting portalocker
Downloading portalocker-2.7.0-py2.py3-none-any.whl (15 kB)
Collecting regex
Downloading regex-2022.10.31-cp311-cp311-macosx_10_9_x86_64.whl (293 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 294.0/294.0 kB 11.8 MB/s eta 0:00:00
Collecting tabulate>=0.8.9
Downloading tabulate-0.9.0-py3-none-any.whl (35 kB)
Requirement already satisfied: numpy>=1.17 in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from sacrebleu<=2.2.0->object-detection==0.1) (1.23.5)
Collecting colorama
Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting gin-config
Downloading gin_config-0.5.0-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.3/61.3 kB 6.9 MB/s eta 0:00:00
Collecting google-api-python-client>=1.6.7
Downloading google_api_python_client-2.80.0-py2.py3-none-any.whl (11.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.0/11.0 MB 24.5 MB/s eta 0:00:00
Collecting immutabledict
Downloading immutabledict-2.2.3-py3-none-any.whl (4.0 kB)
Collecting kaggle>=1.3.9
Downloading kaggle-1.5.13.tar.gz (63 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.3/63.3 kB 5.2 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting oauth2client
Downloading oauth2client-4.1.3-py2.py3-none-any.whl (98 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.2/98.2 kB 9.6 MB/s eta 0:00:00
Collecting opencv-python-headless
Downloading opencv_python_headless-4.7.0.72-cp37-abi3-macosx_10_16_x86_64.whl (53.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.9/53.9 MB 15.9 MB/s eta 0:00:00
Requirement already satisfied: psutil>=5.4.3 in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from tf-models-official>=2.5.1->object-detection==0.1) (5.9.4)
Collecting py-cpuinfo>=3.3.0
Downloading py_cpuinfo-9.0.0-py3-none-any.whl (22 kB)
Collecting pyyaml<6.0,>=5.1
Downloading PyYAML-5.4.1.tar.gz (175 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.1/175.1 kB 5.7 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting sentencepiece
Downloading sentencepiece-0.1.97.tar.gz (524 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 524.7/524.7 kB 18.8 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting seqeval
Downloading seqeval-1.2.2.tar.gz (43 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.6/43.6 kB 4.6 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting tf-models-official>=2.5.1
Downloading tf_models_official-2.11.2-py2.py3-none-any.whl (2.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 21.7 MB/s eta 0:00:00
Downloading tf_models_official-2.11.0-py2.py3-none-any.whl (2.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 8.0 MB/s eta 0:00:00
Downloading tf_models_official-2.10.1-py2.py3-none-any.whl (2.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 22.5 MB/s eta 0:00:00
Downloading tf_models_official-2.10.0-py2.py3-none-any.whl (2.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 3.8 MB/s eta 0:00:00
Downloading tf_models_official-2.9.2-py2.py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 3.5 MB/s eta 0:00:00
Downloading tf_models_official-2.9.1-py2.py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 3.7 MB/s eta 0:00:00
Downloading tf_models_official-2.9.0-py2.py3-none-any.whl (2.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 7.6 MB/s eta 0:00:00
Downloading tf_models_official-2.8.0-py2.py3-none-any.whl (2.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 3.6 MB/s eta 0:00:00
Downloading tf_models_official-2.7.2-py2.py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 18.1 MB/s eta 0:00:00
Requirement already satisfied: pyyaml>=5.1 in /Users/melamoro/Desktop/venvs/Py37_{defect_detector}/lib/python3.11/site-packages (from tf-models-official>=2.5.1->object-detection==0.1) (6.0)
Downloading tf_models_official-2.7.1-py2.py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 6.6 MB/s eta 0:00:00
Downloading tf_models_official-2.7.0-py2.py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 5.0 MB/s eta 0:00:00
Downloading tf_models_official-2.6.1-py2.py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 4.7 MB/s eta 0:00:00
Downloading tf_models_official-2.6.0-py2.py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 1.6 MB/s eta 0:00:00
Downloading tf_models_official-2.5.1-py2.py3-none-any.whl (1.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 4.6 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of sacrebleu to determine which version is compatible with other requirements. This could take a while.
Collecting sacrebleu<=2.2.0
Downloading sacrebleu-2.1.0-py3-none-any.whl (92 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 92.0/92.0 kB 2.7 MB/s eta 0:00:00
INFO: pip is looking at multiple versions of pyparsing to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of object-detection to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install object-detection and object-detection==0.1 because these package versions have conflicting dependencies.
The conflict is caused by:
tf-models-official 2.11.3 depends on tensorflow-addons
tf-models-official 2.11.2 depends on tensorflow-addons
tf-models-official 2.11.0 depends on opencv-python-headless==4.5.2.52
object-detection 0.1 depends on sacrebleu<=2.2.0
tf-models-official 2.10.1 depends on sacrebleu==2.2.0
tf-models-official 2.10.0 depends on opencv-python-headless==4.5.2.52
tf-models-official 2.9.2 depends on tensorflow-addons
tf-models-official 2.9.1 depends on tensorflow-addons
tf-models-official 2.9.0 depends on tensorflow-addons
tf-models-official 2.8.0 depends on tensorflow-addons
tf-models-official 2.7.2 depends on tensorflow-addons
tf-models-official 2.7.1 depends on tensorflow-addons
tf-models-official 2.7.0 depends on tensorflow-addons
tf-models-official 2.6.1 depends on tensorflow-addons
tf-models-official 2.6.0 depends on tensorflow-addons
tf-models-official 2.5.1 depends on tensorflow-addons
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts