错误:imagededup 构建轮失败

问题描述 投票:0回答:1

我需要安装这个包来构建图像识别工具。 我尝试重新安装 Python 和 Visual Studio Build Tools,但无法成功安装 Imagededup,总是出现车轮错误。 我快疯了,但我的技能很基础,所以可能会缺少一些基本的东西。 我正在使用Python 3.12.1

`C:\Users\r.sousa>pip install imagededup
Collecting imagededup
  Using cached imagededup-0.3.1.tar.gz (20.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Collecting torch (from imagededup)
  Using cached torch-2.3.0-cp312-cp312-win_amd64.whl.metadata (26 kB)
Collecting torchvision (from imagededup)
  Using cached torchvision-0.18.0-cp312-cp312-win_amd64.whl.metadata (6.6 kB)
Requirement already satisfied: Pillow>=9.0 in c:\users\r.sousa\appdata\local\programs\python\python312\lib\site-packages (from imagededup) (10.2.0)
Requirement already satisfied: tqdm in c:\users\r.sousa\appdata\local\programs\python\python312\lib\site-packages (from imagededup) (4.66.1)
Collecting scikit-learn (from imagededup)
  Using cached scikit_learn-1.4.2-cp312-cp312-win_amd64.whl.metadata (11 kB)
Collecting PyWavelets (from imagededup)
  Using cached pywavelets-1.6.0-cp312-cp312-win_amd64.whl.metadata (9.0 kB)
Collecting matplotlib (from imagededup)
  Using cached matplotlib-3.8.4-cp312-cp312-win_amd64.whl.metadata (5.9 kB)
Collecting contourpy>=1.0.1 (from matplotlib->imagededup)
  Using cached contourpy-1.2.1-cp312-cp312-win_amd64.whl.metadata (5.8 kB)
Collecting cycler>=0.10 (from matplotlib->imagededup)
  Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)
Collecting fonttools>=4.22.0 (from matplotlib->imagededup)`
  Using cached fonttools-4.51.0-cp312-cp312-win_amd64.whl.metadata (162 kB)
Collecting kiwisolver>=1.3.1 (from matplotlib->imagededup)
  Using cached kiwisolver-1.4.5-cp312-cp312-win_amd64.whl.metadata (6.5 kB)
Collecting numpy>=1.21 (from matplotlib->imagededup)
  Using cached numpy-1.26.4-cp312-cp312-win_amd64.whl.metadata (61 kB)
Requirement already satisfied: packaging>=20.0 in c:\users\r.sousa\appdata\local\programs\python\python312\lib\site-packages (from matplotlib->imagededup) (23.2)
Collecting pyparsing>=2.3.1 (from matplotlib->imagededup)
  Using cached pyparsing-3.1.2-py3-none-any.whl.metadata (5.1 kB)
Collecting python-dateutil>=2.7 (from matplotlib->imagededup)
  Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting scipy>=1.6.0 (from scikit-learn->imagededup)
  Using cached scipy-1.13.0-cp312-cp312-win_amd64.whl.metadata (60 kB)
Collecting joblib>=1.2.0 (from scikit-learn->imagededup)
  Using cached joblib-1.4.2-py3-none-any.whl.metadata (5.4 kB)
Collecting threadpoolctl>=2.0.0 (from scikit-learn->imagededup)
  Using cached threadpoolctl-3.5.0-py3-none-any.whl.metadata (13 kB)
Collecting filelock (from torch->imagededup)
  Using cached filelock-3.14.0-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\r.sousa\appdata\local\programs\python\python312\lib\site-packages (from torch->imagededup) (4.9.0)
Collecting sympy (from torch->imagededup)
  Using cached sympy-1.12-py3-none-any.whl.metadata (12 kB)
Collecting networkx (from torch->imagededup)
  Using cached networkx-3.3-py3-none-any.whl.metadata (5.1 kB)
Collecting jinja2 (from torch->imagededup)
  Using cached jinja2-3.1.4-py3-none-any.whl.metadata (2.6 kB)
Collecting fsspec (from torch->imagededup)
  Using cached fsspec-2024.3.1-py3-none-any.whl.metadata (6.8 kB)
Collecting mkl<=2021.4.0,>=2021.1.1 (from torch->imagededup)
  Using cached mkl-2021.4.0-py2.py3-none-win_amd64.whl.metadata (1.4 kB)
Requirement already satisfied: colorama in c:\users\r.sousa\appdata\local\programs\python\python312\lib\site-packages (from tqdm->imagededup) (0.4.6)
Collecting intel-openmp==2021.* (from mkl<=2021.4.0,>=2021.1.1->torch->imagededup)
  Using cached intel_openmp-2021.4.0-py2.py3-none-win_amd64.whl.metadata (1.2 kB)
Collecting tbb==2021.* (from mkl<=2021.4.0,>=2021.1.1->torch->imagededup)
  Using cached tbb-2021.12.0-py3-none-win_amd64.whl.metadata (1.1 kB)
Collecting six>=1.5 (from python-dateutil>=2.7->matplotlib->imagededup)
  Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting MarkupSafe>=2.0 (from jinja2->torch->imagededup)
  Using cached MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl.metadata (3.1 kB)
Collecting mpmath>=0.19 (from sympy->torch->imagededup)
  Using cached mpmath-1.3.0-py3-none-any.whl.metadata (8.6 kB)
Using cached matplotlib-3.8.4-cp312-cp312-win_amd64.whl (7.7 MB)
Using cached pywavelets-1.6.0-cp312-cp312-win_amd64.whl (4.2 MB)
Using cached scikit_learn-1.4.2-cp312-cp312-win_amd64.whl (10.6 MB)
Using cached torch-2.3.0-cp312-cp312-win_amd64.whl (159.7 MB)
Using cached torchvision-0.18.0-cp312-cp312-win_amd64.whl (1.2 MB)
Using cached contourpy-1.2.1-cp312-cp312-win_amd64.whl (189 kB)
Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)
Using cached fonttools-4.51.0-cp312-cp312-win_amd64.whl (2.2 MB)
Using cached joblib-1.4.2-py3-none-any.whl (301 kB)
Using cached kiwisolver-1.4.5-cp312-cp312-win_amd64.whl (56 kB)
Using cached mkl-2021.4.0-py2.py3-none-win_amd64.whl (228.5 MB)
Using cached intel_openmp-2021.4.0-py2.py3-none-win_amd64.whl (3.5 MB)
Using cached tbb-2021.12.0-py3-none-win_amd64.whl (286 kB)
Using cached numpy-1.26.4-cp312-cp312-win_amd64.whl (15.5 MB)
Using cached pyparsing-3.1.2-py3-none-any.whl (103 kB)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Using cached scipy-1.13.0-cp312-cp312-win_amd64.whl (45.9 MB)
Using cached threadpoolctl-3.5.0-py3-none-any.whl (18 kB)
Using cached filelock-3.14.0-py3-none-any.whl (12 kB)
Using cached fsspec-2024.3.1-py3-none-any.whl (171 kB)
Using cached jinja2-3.1.4-py3-none-any.whl (133 kB)
Using cached networkx-3.3-py3-none-any.whl (1.7 MB)
Using cached sympy-1.12-py3-none-any.whl (5.7 MB)
Using cached MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl (17 kB)
Using cached mpmath-1.3.0-py3-none-any.whl (536 kB)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: imagededup
  Building wheel for imagededup (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for imagededup (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [51 lines of output]
      C:\Users\r.sousa\AppData\Local\Temp\pip-build-env-lq7qgxmg\overlay\Lib\site-packages\setuptools\dist.py:476: SetuptoolsDeprecationWarning: Invalid dash-separated options
      !!

              ********************************************************************************
              Usage of dash-separated 'description-file' will not be supported in future
              versions. Please use the underscore name 'description_file' instead.

              By 2024-Sep-26, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.

              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************

      !!
        opt = self.warn_dash_deprecation(opt, section)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\imagededup
      copying imagededup\__init__.py -> build\lib.win-amd64-cpython-312\imagededup
      creating build\lib.win-amd64-cpython-312\imagededup\evaluation
      copying imagededup\evaluation\evaluation.py -> build\lib.win-amd64-cpython-312\imagededup\evaluation
      copying imagededup\evaluation\__init__.py -> build\lib.win-amd64-cpython-312\imagededup\evaluation
      creating build\lib.win-amd64-cpython-312\imagededup\handlers
      copying imagededup\handlers\__init__.py -> build\lib.win-amd64-cpython-312\imagededup\handlers
      creating build\lib.win-amd64-cpython-312\imagededup\methods
      copying imagededup\methods\cnn.py -> build\lib.win-amd64-cpython-312\imagededup\methods
      copying imagededup\methods\hashing.py -> build\lib.win-amd64-cpython-312\imagededup\methods
      copying imagededup\methods\__init__.py -> build\lib.win-amd64-cpython-312\imagededup\methods
      creating build\lib.win-amd64-cpython-312\imagededup\utils
      copying imagededup\utils\data_generator.py -> build\lib.win-amd64-cpython-312\imagededup\utils
      copying imagededup\utils\general_utils.py -> build\lib.win-amd64-cpython-312\imagededup\utils
      copying imagededup\utils\image_utils.py -> build\lib.win-amd64-cpython-312\imagededup\utils
      copying imagededup\utils\logger.py -> build\lib.win-amd64-cpython-312\imagededup\utils
      copying imagededup\utils\plotter.py -> build\lib.win-amd64-cpython-312\imagededup\utils
      copying imagededup\utils\__init__.py -> build\lib.win-amd64-cpython-312\imagededup\utils
      creating build\lib.win-amd64-cpython-312\imagededup\handlers\metrics
      copying imagededup\handlers\metrics\classification.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\metrics
      copying imagededup\handlers\metrics\information_retrieval.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\metrics
      copying imagededup\handlers\metrics\__init__.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\metrics
      creating build\lib.win-amd64-cpython-312\imagededup\handlers\search
      copying imagededup\handlers\search\bktree.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\search
      copying imagededup\handlers\search\brute_force.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\search
      copying imagededup\handlers\search\brute_force_cython.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\search
      copying imagededup\handlers\search\retrieval.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\search
      copying imagededup\handlers\search\__init__.py -> build\lib.win-amd64-cpython-312\imagededup\handlers\search
      running build_ext
      building 'brute_force_cython_ext' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for imagededup
Failed to build imagededup
ERROR: Could not build wheels for imagededup, which is required to install pyproject.toml-based projects

C:\Users\r.sousa>python pip install pyproject.toml-based
python: can't open file 'C:\\Users\\r.sousa\\pip': [Errno 2] No such file or directory

C:\Users\r.sousa>pip install pyproject.toml-based
ERROR: Could not find a version that satisfies the requirement pyproject.toml-based (from versions: none)
ERROR: No matching distribution found for pyproject.toml-based````

I need to install this package to build a image recognition tool.
I tried reinstalling Python and also Visual Studio Build Tools but cannot sucessfully install Imagededup, always gives me the wheel error.
I am driving nuts but my skills are basic so might be missing something basic.
python installation cmd package
1个回答
0
投票

当 Python 包包含需要在安装过程中编译的 C 扩展模块(在您的情况下为 brute_force_cython_ext)时,通常会发生此错误。在 Windows 上构建这些 C 扩展所需的编译器是 Microsoft Visual C++。

为了解决您的问题,您需要安装 Microsoft Visual C++ Build Tools 14.0 或更高版本,其中包括必要的编译器。您可以从https://visualstudio.microsoft.com/visual-cpp-build-tools/

下载它
© www.soinside.com 2019 - 2024. All rights reserved.