hhatto / nude.py

Nudity detection with Python
MIT License
924 stars 131 forks source link

not build at m1 #27

Open vvzvlad opened 1 year ago

vvzvlad commented 1 year ago
>pip install nudepy
Collecting nudepy
  Using cached nudepy-0.5.1.tar.gz (35 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pillow in ./.venv/lib/python3.11/site-packages (from nudepy) (9.5.0)
Installing collected packages: nudepy
  DEPRECATION: nudepy 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 nudepy ... error
  error: subprocess-exited-with-error

  × Running setup.py install for nudepy did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      running install
      /Users/vvzvlad/Downloads/nudecrawler/.venv/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      copying nude.py -> build/lib.macosx-13-arm64-cpython-311
      running build_ext
      building 'skin_classifier' extension
      creating build/temp.macosx-13-arm64-cpython-311
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/Users/vvzvlad/Downloads/nudecrawler/.venv/include -I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c skin_classifier.c -o build/temp.macosx-13-arm64-cpython-311/skin_classifier.o
      skin_classifier.c:196:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.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.
╰─> nudepy

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
CygnusBewickii commented 1 year ago

Same problem. Did you find solution?

vvzvlad commented 1 year ago

I used "python3.9 -m pip install nudepy" because last python version in my system (3.11) not contain precompiled nudepy, wherefore in install process pip trying build from sources and crashing.

yaroslaff commented 3 months ago

Two solutions:

  1. Stay with nudepy: You should have python-dev and cython installed (and if your own package depends on nude.py, all your users must have it), because nude.py does not comes with binary (wheel) build. Maybe this will help.

  2. Switch to mudepy Mudepy is maintained fork of nudepy.
    Github URL: https://github.com/yaroslaff/mudepy Disclaimer: this is my project. My other project nudecrawler depends on nudepy too , but can not be installed with current nudepy version because fails to compile binary wheel, so I created this replacement. For now I do not promise to maintain mudepy for long time (maybe I will abandon this project if @hhatto will fix nudepy). But usually I'm quite stable and my other projects lives for long time.

How to switch to mudepy Just change one letter, nudepy -> mudepy. Mudepy uses same module name (nude.py), same class name (Nude), same console script (nudepy). If you will like to change back - change one letter again. To install it: pip install mudepy. To use as dependency - use mudepy. Not very hard.

How mudepy is better

  1. mudepy comes with binary wheels (manylinux wheels), so it's easier to install for user, has lower requirements (no need for cython or longintrepr.h). I will try to make such wheels for platforms which I can access. For other systems (like MacOS) I may need help from someone, who can compile it there and provide me package file.

  2. in mudepy I fixed another problem which comes with newer (10.0.0, since 1st Jul 2023) version of Pillow PIL.Image.ANTIALIAS which produces this error: AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' https://stackoverflow.com/questions/76616042/attributeerror-module-pil-image-has-no-attribute-antialias

I do not plan to invest much of time into mudepy to develop it - it's mission is to be 'working version of nudepy': lightweight, simple, easy to use, easy to embed with your project. No new features expected, but it must be working.