win11 wsl ubuntu20.4 conda 安装 pycocotools 时出现bug

时间:2023.7.9

BUG:

Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting pycocotools
  Downloading https://mirrors.aliyun.com/pypi/packages/ef/c6/90220be3b39fbc4cbd203775ca47dd8dc97fae06fbd2b500637395621b7c/pycocotools-2.0.6.tar.gz (24 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: matplotlib>=2.1.0 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from pycocotools) (3.7.2)
Requirement already satisfied: numpy in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from pycocotools) (1.24.4)
Requirement already satisfied: contourpy>=1.0.1 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (1.1.0)
Requirement already satisfied: cycler>=0.10 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (4.40.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (1.4.4)
Requirement already satisfied: packaging>=20.0 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (23.1)
Requirement already satisfied: pillow>=6.2.0 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (9.3.0)
Requirement already satisfied: pyparsing<3.1,>=2.3.1 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (2.8.2)
Requirement already satisfied: importlib-resources>=3.2.0 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from matplotlib>=2.1.0->pycocotools) (6.0.0)
Requirement already satisfied: zipp>=3.1.0 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from importlib-resources>=3.2.0->matplotlib>=2.1.0->pycocotools) (3.16.0)
Requirement already satisfied: six>=1.5 in /root/anaconda3/envs/mmdetection3/lib/python3.8/site-packages (from python-dateutil>=2.7->matplotlib>=2.1.0->pycocotools) (1.16.0)
Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pycocotools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/mask.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/coco.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      copying pycocotools/__init__.py -> build/lib.linux-x86_64-cpython-38/pycocotools
      running build_ext
      cythoning pycocotools/_mask.pyx to pycocotools/_mask.c
      building 'pycocotools._mask' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/common
      creating build/temp.linux-x86_64-cpython-38/pycocotools
      gcc -pthread -B /root/anaconda3/envs/mmdetection3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/tmp/pip-build-env-81ye_g9x/overlay/lib/python3.8/site-packages/numpy/core/include -I./common -I/root/anaconda3/envs/mmdetection3/include/python3.8 -c ./common/maskApi.c -o build/temp.linux-x86_64-cpython-38/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
      /tmp/pip-build-env-81ye_g9x/overlay/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-s00_pyri/pycocotools_c850da5be55142cf9ce244e31f5d2178/pycocotools/_mask.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      error: command 'gcc' failed: No such file or directory
      [end of output]

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

解决方法:
用conda安装

 conda install -c conda-forge pycocotools

就好啦

Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 23.3.1
  latest version: 23.5.0

Please update conda by running

    $ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

     conda install conda=23.5.0



## Package Plan ##

  environment location: /root/anaconda3/envs/mmdetection3

  added / updated specs:
    - pycocotools


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _libgcc_mutex-0.1          |      conda_forge           3 KB  conda-forge
    _openmp_mutex-4.5          |       2_kmp_llvm           6 KB  conda-forge
    ca-certificates-2023.5.7   |       hbcca054_0         145 KB  conda-forge
    certifi-2023.5.7           |     pyhd8ed1ab_0         149 KB  conda-forge
    cycler-0.11.0              |     pyhd8ed1ab_0          10 KB  conda-forge
    kiwisolver-1.4.4           |   py38h6a678d5_0          76 KB
    libgcc-ng-13.1.0           |       he5830b7_0         758 KB  conda-forge
    llvm-openmp-14.0.6         |       h9e868ea_0         4.4 MB
    matplotlib-base-3.4.3      |   py38hf4fb855_1         7.3 MB  conda-forge
    mkl-service-2.4.0          |   py38h5eee18b_1          54 KB
    mkl_fft-1.3.6              |   py38h417a72b_1         215 KB
    mkl_random-1.2.2           |   py38h417a72b_1         309 KB
    numpy-1.24.3               |   py38hf6e8229_1          10 KB
    numpy-base-1.24.3          |   py38h060ed82_1         6.2 MB
    openssl-3.1.1              |       hd590300_1         2.5 MB  conda-forge
    pycocotools-2.0.6          |   py38h26c90d9_1         111 KB  conda-forge
    pyparsing-3.1.0            |     pyhd8ed1ab_0          87 KB  conda-forge
    python-dateutil-2.8.2      |     pyhd8ed1ab_0         240 KB  conda-forge
    python_abi-3.8             |           2_cp38           4 KB  conda-forge
    six-1.16.0                 |     pyh6c4a22f_0          14 KB  conda-forge
    tornado-6.3.2              |   py38h01eb140_0         613 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        23.2 MB

The following NEW packages will be INSTALLED:

  certifi            conda-forge/noarch::certifi-2023.5.7-pyhd8ed1ab_0
  cycler             conda-forge/noarch::cycler-0.11.0-pyhd8ed1ab_0
  kiwisolver         pkgs/main/linux-64::kiwisolver-1.4.4-py38h6a678d5_0
  llvm-openmp        pkgs/main/linux-64::llvm-openmp-14.0.6-h9e868ea_0
  matplotlib-base    conda-forge/linux-64::matplotlib-base-3.4.3-py38hf4fb855_1
  mkl-service        pkgs/main/linux-64::mkl-service-2.4.0-py38h5eee18b_1
  mkl_fft            pkgs/main/linux-64::mkl_fft-1.3.6-py38h417a72b_1
  mkl_random         pkgs/main/linux-64::mkl_random-1.2.2-py38h417a72b_1
  numpy              pkgs/main/linux-64::numpy-1.24.3-py38hf6e8229_1
  numpy-base         pkgs/main/linux-64::numpy-base-1.24.3-py38h060ed82_1
  pycocotools        conda-forge/linux-64::pycocotools-2.0.6-py38h26c90d9_1
  pyparsing          conda-forge/noarch::pyparsing-3.1.0-pyhd8ed1ab_0
  python-dateutil    conda-forge/noarch::python-dateutil-2.8.2-pyhd8ed1ab_0
  python_abi         conda-forge/linux-64::python_abi-3.8-2_cp38
  six                conda-forge/noarch::six-1.16.0-pyh6c4a22f_0
  tornado            conda-forge/linux-64::tornado-6.3.2-py38h01eb140_0

The following packages will be REMOVED:

  libgomp-11.2.0-h1234567_1

The following packages will be UPDATED:

  libgcc-ng          pkgs/main::libgcc-ng-11.2.0-h1234567_1 --> conda-forge::libgcc-ng-13.1.0-he5830b7_0
  openssl               pkgs/main::openssl-3.0.9-h7f8727e_0 --> conda-forge::openssl-3.1.1-hd590300_1

The following packages will be SUPERSEDED by a higher-priority channel:

  _libgcc_mutex           pkgs/main::_libgcc_mutex-0.1-main --> conda-forge::_libgcc_mutex-0.1-conda_forge
  _openmp_mutex          pkgs/main::_openmp_mutex-5.1-1_gnu --> conda-forge::_openmp_mutex-4.5-2_kmp_llvm
  ca-certificates    pkgs/main::ca-certificates-2023.05.30~ --> conda-forge::ca-certificates-2023.5.7-hbcca054_0


Proceed ([y]/n)? y


Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值