ets-labs / python-dependency-injector

Dependency injection framework for Python
https://python-dependency-injector.ets-labs.org/
BSD 3-Clause "New" or "Revised" License
3.97k stars 306 forks source link

can't install on Macbook M2 apple silicon #805

Open alm0ra opened 3 months ago

alm0ra commented 3 months ago

python version : 3.10.14 OS: macOS : 14.4.1 dependency-injector: 4.41.0

i want to install this library on my machine but i am getting this error

(venv) ➜  microservices git:(main) ✗ pip install dependency-injector
Collecting dependency-injector
  Downloading dependency-injector-4.41.0.tar.gz (913 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 913.2/913.2 kB 392.8 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six<=1.16.0,>=1.7.0 in ./venv/lib/python3.10/site-packages (from dependency-injector) (1.16.0)
Installing collected packages: dependency-injector
  DEPRECATION: dependency-injector is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for dependency-injector ... error
  error: subprocess-exited-with-error

  × Running setup.py install for dependency-injector did not run successfully.
  │ exit code: 1
  ╰─> [34 lines of output]
      running install
      /Users/ali/aban-tether/microservices/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

      running build
      running build_py
      creating build
      creating build/lib.macosx-11.0-arm64-cpython-310
      creating build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/__init__.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/resources.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/errors.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/schema.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/wiring.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      creating build/lib.macosx-11.0-arm64-cpython-310/dependency_injector/ext
      copying src/dependency_injector/ext/aiohttp.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector/ext
      copying src/dependency_injector/ext/flask.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector/ext
      copying src/dependency_injector/ext/__init__.py -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector/ext
      copying src/dependency_injector/providers.pxd -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/containers.pxd -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/containers.pyi -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/__init__.pyi -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/providers.pyi -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      copying src/dependency_injector/py.typed -> build/lib.macosx-11.0-arm64-cpython-310/dependency_injector
      running build_ext
      building 'dependency_injector.containers' extension
      creating build/temp.macosx-11.0-arm64-cpython-310
      creating build/temp.macosx-11.0-arm64-cpython-310/src
      creating build/temp.macosx-11.0-arm64-cpython-310/src/dependency_injector
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -mmacosx-version-min=11.0 -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-undef-prefix -fPIC -Werror=unguarded-availability-new -DCYTHON_CLINE_IN_TRACEBACK=0 -I/Users/ali/aban-tether/microservices/venv/include -I/install/include/python3.10 -c src/dependency_injector/containers.c -o build/temp.macosx-11.0-arm64-cpython-310/src/dependency_injector/containers.o -O2
      src/dependency_injector/containers.c:6:10: fatal error: 'Python.h' file not found
      #include "Python.h"
               ^~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

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

× Encountered error while trying to install package.
╰─> dependency-injector

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
yudgnahk commented 3 months ago

I got the same issue.

emrekasg commented 2 months ago

I inferred that using dependency-injector==4.42.0b1 instead of directly using dependency-injector solves the issue.