ncnn icon indicating copy to clipboard operation
ncnn copied to clipboard

macos 安装python ncnn失败

Open ChaoII opened this issue 2 years ago • 3 comments

环境:
  • 系统:macos 12.2 intel i5 x86
  • python版本:python3.8.5
问题:
  • 执行pip install ncnn报找不到Cmakelists.txt的错误
  • 在源码(cd ncnn)执行 python steup.py install 成功安装ncnn但是执行import ncnn报错没有ncnn.ncnn 模块错误,导致无法进行快速验证。 请问这一块该怎么处理?

ChaoII avatar Jun 28 '22 03:06 ChaoII

I can confirm this on my mac (m1) with miniforge installed python3.9.10

(base) ➜  model_zoo git:(examples-early-stop-if-load-models-failed) ✗ pip install -U ncnn
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting ncnn
  Downloading http://mirrors.aliyun.com/pypi/packages/20/98/8e46767ec120bd61d5bdbe85f26a451dbb5a4978541ad1881e38bde822aa/ncnn-1.0.20220701.tar.gz (38 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      Traceback (most recent call last):
        File "/Users/zz/soft/miniforge3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/zz/soft/miniforge3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/zz/soft/miniforge3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/kz/zl8nc1654c58czlnmx7ssrk80000gn/T/pip-build-env-3n86n_uy/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/private/var/folders/kz/zl8nc1654c58czlnmx7ssrk80000gn/T/pip-build-env-3n86n_uy/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/kz/zl8nc1654c58czlnmx7ssrk80000gn/T/pip-build-env-3n86n_uy/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 128, in <module>
          version=find_version(),
        File "setup.py", line 13, in find_version
          with io.open("CMakeLists.txt", encoding="utf8") as f:
      FileNotFoundError: [Errno 2] No such file or directory: 'CMakeLists.txt'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
(base) ➜  model_zoo git:(examples-early-stop-if-load-models-failed) ✗ pip install -U ncnn
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting ncnn
  Using cached http://mirrors.aliyun.com/pypi/packages/20/98/8e46767ec120bd61d5bdbe85f26a451dbb5a4978541ad1881e38bde822aa/ncnn-1.0.20220701.tar.gz (38 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      Traceback (most recent call last):
        File "/Users/zz/soft/miniforge3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/zz/soft/miniforge3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/zz/soft/miniforge3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/kz/zl8nc1654c58czlnmx7ssrk80000gn/T/pip-build-env-bl6x6cka/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
          return self._get_build_requires(
        File "/private/var/folders/kz/zl8nc1654c58czlnmx7ssrk80000gn/T/pip-build-env-bl6x6cka/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/kz/zl8nc1654c58czlnmx7ssrk80000gn/T/pip-build-env-bl6x6cka/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 174, in run_setup
          exec(compile(code, __file__, 'exec'), locals())
        File "setup.py", line 128, in <module>
          version=find_version(),
        File "setup.py", line 13, in find_version
          with io.open("CMakeLists.txt", encoding="utf8") as f:
      FileNotFoundError: [Errno 2] No such file or directory: 'CMakeLists.txt'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

zchrissirhcz avatar Jul 02 '22 02:07 zchrissirhcz

环境:
  • 系统:macos 12.2 intel i5 x86
  • python版本:python3.8.5
问题:
  • 执行pip install ncnn报找不到Cmakelists.txt的错误
  • 在源码(cd ncnn)执行 python steup.py install 成功安装ncnn但是执行import ncnn报错没有ncnn.ncnn 模块错误,导致无法进行快速验证。 请问这一块该怎么处理?

我的 python 环境是 miniforge 安装的(和 miniconda 基本一样),我是用 pip install . 命令安装的。安装后, import ncnn 不会报错,可考虑尝试。(mac M1, python 版本 3.9.10)

zchrissirhcz avatar Jul 02 '22 03:07 zchrissirhcz

@zchrissirhcz ZZ佬,你好,按照你的方法pip install . 确实成功安装了,感谢!

ChaoII avatar Jul 04 '22 06:07 ChaoII

Same issue.

redthing1 avatar Jul 30 '23 17:07 redthing1