DinoTools / python-ssdeep

Python wrapper for ssdeep fuzzy hashing library
GNU Lesser General Public License v3.0
152 stars 30 forks source link

pip install ssdeep returns error #66

Open shashank-shekher opened 1 year ago

shashank-shekher commented 1 year ago
ISSUE TYPE

Bug Report

Python ssdeep VERSION

latest version

OS / ENVIRONMENT

OS: Windows 10

Python version: Python 3.10.11

SUMMARY

Cannot install the ssdeep library with or without the Virtual env.

STEPS TO REPRODUCE

pip install ssdeep

EXPECTED RESULTS

Successful installation and no error on using "import ssdeep"

ACTUAL RESULTS
Collecting ssdeep
  Using cached ssdeep-3.4.tar.gz (110 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  python setup.py egg_info did not run successfully.
  exit code: 1
.
.
.
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

**note: This is an issue with the package mentioned above, not pip.**
welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template!

ooker777 commented 1 year ago

In #62 @phibos says:

Windows isn't on the "Tested on" list because I don't have a windows system to test

Take a look at MacDue/ssdeep-windows-32_64: ssdeep for python on windows instead.


However, I do have the same problem when running it via WSL2 Here is my output:

root@OokerLaptop:~# pip install ssdeep
Collecting ssdeep
  Using cached ssdeep-3.4.tar.gz (110 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [105 lines of output]
      /usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
        warnings.warn(
      /usr/lib/python3/dist-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      running egg_info
      creating /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info
      writing /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/requires.txt
      writing top-level names to /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/top_level.txt
      writing manifest file '/tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/SOURCES.txt'
      src/ssdeep/__pycache__/_ssdeep_cffi_a28e5628x27adcb8d.c:266:14: fatal error: fuzzy.h: No such file or directory
        266 |     #include "fuzzy.h"
            |              ^~~~~~~~~
      compilation terminated.
      Traceback (most recent call last):
        File "/usr/lib/python3.10/distutils/unixccompiler.py", line 117, in _compile
          self.spawn(compiler_so + cc_args + [src, '-o', obj] +
        File "/usr/lib/python3.10/distutils/ccompiler.py", line 910, in spawn
          spawn(cmd, dry_run=self.dry_run)
        File "/usr/lib/python3.10/distutils/spawn.py", line 91, in spawn
          raise DistutilsExecError(
      distutils.errors.DistutilsExecError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/dist-packages/cffi/ffiplatform.py", line 51, in _build
          dist.run_command('build_ext')
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 79, in run
          _build_ext.run(self)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run
          self.build_extensions()
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
          self._build_extensions_serial()
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
          self.build_extension(ext)
        File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 202, in build_extension
          _build_ext.build_extension(self, ext)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
          objects = self.compiler.compile(sources,
        File "/usr/lib/python3.10/distutils/ccompiler.py", line 574, in compile
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/usr/lib/python3.10/distutils/unixccompiler.py", line 120, in _compile
          raise CompileError(msg)
      distutils.errors.CompileError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/setup.py", line 108, in <module>
          setup(
        File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 299, in run
          self.find_sources()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 306, in find_sources
          mm.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 541, in run
          self.add_defaults()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 578, in add_defaults
          sdist.add_defaults(self)
        File "/usr/lib/python3.10/distutils/command/sdist.py", line 226, in add_defaults
          self._add_defaults_python()
        File "/usr/lib/python3/dist-packages/setuptools/command/sdist.py", line 111, in _add_defaults_python
          build_py = self.get_finalized_command('build_py')
        File "/usr/lib/python3.10/distutils/cmd.py", line 299, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "/usr/lib/python3.10/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/usr/lib/python3/dist-packages/setuptools/command/build_py.py", line 29, in finalize_options
          orig.build_py.finalize_options(self)
        File "/usr/lib/python3.10/distutils/command/build_py.py", line 43, in finalize_options
          self.set_undefined_options('build',
        File "/usr/lib/python3.10/distutils/cmd.py", line 287, in set_undefined_options
          src_cmd_obj.ensure_finalized()
        File "/usr/lib/python3.10/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/setup.py", line 24, in finalize_options
          self.distribution.ext_modules = get_ext_modules()
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/setup.py", line 79, in get_ext_modules
          binding.verify()
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/src/ssdeep/binding.py", line 126, in verify
          self._lib = self.ffi.verify(
        File "/usr/local/lib/python3.10/dist-packages/cffi/api.py", line 468, in verify
          lib = self.verifier.load_library()
        File "/usr/local/lib/python3.10/dist-packages/cffi/verifier.py", line 105, in load_library
          self._compile_module()
        File "/usr/local/lib/python3.10/dist-packages/cffi/verifier.py", line 202, in _compile_module
          outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
        File "/usr/local/lib/python3.10/dist-packages/cffi/ffiplatform.py", line 22, in compile
          outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
        File "/usr/local/lib/python3.10/dist-packages/cffi/ffiplatform.py", line 58, in _build
          raise VerificationError('%s: %s' % (e.__class__.__name__, e))
      cffi.VerificationError: CompileError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
HydraDragonAntivirus commented 1 year ago

I have same issue too on Windows but on Linux I managed to fix problem.

HydraDragonAntivirus commented 1 year ago

https://github.com/MacDue/ssdeep-windows-32_64 I managed to solve problem. Thanks!

BJTUpupil commented 10 months ago

在 #62 说:

Windows 不在“已测试”列表中,因为我没有要测试的 Windows 系统

看看 MacDue/ssdeep-windows-32_64:ssdeep for python on windows 代替。

但是,在通过 WSL2 运行它时,我确实遇到了同样的问题,这是我的输出:

root@OokerLaptop:~# pip install ssdeep
Collecting ssdeep
  Using cached ssdeep-3.4.tar.gz (110 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [105 lines of output]
      /usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
        warnings.warn(
      /usr/lib/python3/dist-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      running egg_info
      creating /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info
      writing /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/requires.txt
      writing top-level names to /tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/top_level.txt
      writing manifest file '/tmp/pip-pip-egg-info-5cddwrfv/ssdeep.egg-info/SOURCES.txt'
      src/ssdeep/__pycache__/_ssdeep_cffi_a28e5628x27adcb8d.c:266:14: fatal error: fuzzy.h: No such file or directory
        266 |     #include "fuzzy.h"
            |              ^~~~~~~~~
      compilation terminated.
      Traceback (most recent call last):
        File "/usr/lib/python3.10/distutils/unixccompiler.py", line 117, in _compile
          self.spawn(compiler_so + cc_args + [src, '-o', obj] +
        File "/usr/lib/python3.10/distutils/ccompiler.py", line 910, in spawn
          spawn(cmd, dry_run=self.dry_run)
        File "/usr/lib/python3.10/distutils/spawn.py", line 91, in spawn
          raise DistutilsExecError(
      distutils.errors.DistutilsExecError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/dist-packages/cffi/ffiplatform.py", line 51, in _build
          dist.run_command('build_ext')
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 79, in run
          _build_ext.run(self)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run
          self.build_extensions()
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
          self._build_extensions_serial()
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
          self.build_extension(ext)
        File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 202, in build_extension
          _build_ext.build_extension(self, ext)
        File "/usr/lib/python3.10/distutils/command/build_ext.py", line 529, in build_extension
          objects = self.compiler.compile(sources,
        File "/usr/lib/python3.10/distutils/ccompiler.py", line 574, in compile
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/usr/lib/python3.10/distutils/unixccompiler.py", line 120, in _compile
          raise CompileError(msg)
      distutils.errors.CompileError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/setup.py", line 108, in <module>
          setup(
        File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
          self.run_command(cmd)
        File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
          cmd_obj.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 299, in run
          self.find_sources()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 306, in find_sources
          mm.run()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 541, in run
          self.add_defaults()
        File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 578, in add_defaults
          sdist.add_defaults(self)
        File "/usr/lib/python3.10/distutils/command/sdist.py", line 226, in add_defaults
          self._add_defaults_python()
        File "/usr/lib/python3/dist-packages/setuptools/command/sdist.py", line 111, in _add_defaults_python
          build_py = self.get_finalized_command('build_py')
        File "/usr/lib/python3.10/distutils/cmd.py", line 299, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "/usr/lib/python3.10/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/usr/lib/python3/dist-packages/setuptools/command/build_py.py", line 29, in finalize_options
          orig.build_py.finalize_options(self)
        File "/usr/lib/python3.10/distutils/command/build_py.py", line 43, in finalize_options
          self.set_undefined_options('build',
        File "/usr/lib/python3.10/distutils/cmd.py", line 287, in set_undefined_options
          src_cmd_obj.ensure_finalized()
        File "/usr/lib/python3.10/distutils/cmd.py", line 107, in ensure_finalized
          self.finalize_options()
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/setup.py", line 24, in finalize_options
          self.distribution.ext_modules = get_ext_modules()
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/setup.py", line 79, in get_ext_modules
          binding.verify()
        File "/tmp/pip-install-76uv6xql/ssdeep_4ed7f9676f444932b8bed44719ace4c8/src/ssdeep/binding.py", line 126, in verify
          self._lib = self.ffi.verify(
        File "/usr/local/lib/python3.10/dist-packages/cffi/api.py", line 468, in verify
          lib = self.verifier.load_library()
        File "/usr/local/lib/python3.10/dist-packages/cffi/verifier.py", line 105, in load_library
          self._compile_module()
        File "/usr/local/lib/python3.10/dist-packages/cffi/verifier.py", line 202, in _compile_module
          outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
        File "/usr/local/lib/python3.10/dist-packages/cffi/ffiplatform.py", line 22, in compile
          outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
        File "/usr/local/lib/python3.10/dist-packages/cffi/ffiplatform.py", line 58, in _build
          raise VerificationError('%s: %s' % (e.__class__.__name__, e))
      cffi.VerificationError: CompileError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Hello, in WLS2 or WSL, you can refer : https://python-ssdeep.readthedocs.io/en/latest/installation.html#id9

saidberk27 commented 1 month ago

I solved the problem by using apt-get update && apt-get install -y libfuzzy-dev on docker python 3.8 image. plus, I used those commands as well but they did not suceed to install. Maybe they contributed to the solution somehow:

pip3 install --upgrade cffi

apt-get update && apt-get install -y \ gcc \ libffi-dev \ python3-dev \ libssl-dev \ make