Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3.9 installation errors #30

Closed
marcorosa opened this issue Feb 4, 2021 · 27 comments
Closed

Python3.9 installation errors #30

marcorosa opened this issue Feb 4, 2021 · 27 comments

Comments

@marcorosa
Copy link

Hi, I'm facing the following error when trying to install hyperscan==0.1.5 from pip (I will give more context below).

  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python /usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp9ybf83mg
       cwd: /tmp/pip-install-abs2u1co/hyperscan_e483bc77b1a7411d9142094e042fbd7d
  Complete output (25 lines):
  A setup.py file already exists. Using it.
  Traceback (most recent call last):
    File "/tmp/pip-install-abs2u1co/hyperscan_e483bc77b1a7411d9142094e042fbd7d/setup.py", line 2, in <module>
      from setuptools import setup
  ModuleNotFoundError: No module named 'setuptools'
  Traceback (most recent call last):
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
      main()
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-pdwain6d/overlay/lib/python3.9/site-packages/poetry/core/masonry/api.py", line 57, in build_wheel
      return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
    File "/tmp/pip-build-env-pdwain6d/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 59, in make_in
      wb.build()
    File "/tmp/pip-build-env-pdwain6d/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 89, in build
      self._build(zip_file)
    File "/tmp/pip-build-env-pdwain6d/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 121, in _build
      self._run_build_command(setup)
    File "/tmp/pip-build-env-pdwain6d/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 149, in _run_build_command
      subprocess.check_call(
    File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/local/bin/python', '/tmp/pip-install-abs2u1co/hyperscan_e483bc77b1a7411d9142094e042fbd7d/setup.py', 'build', '-b', '/tmp/pip-install-abs2u1co/hyperscan_e483bc77b1a7411d9142094e042fbd7d/build']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for hyperscan
Failed to build hyperscan
ERROR: Could not build wheels for hyperscan which use PEP 517 and cannot be installed directly

I'm using docker, image python:3.9-slim-buster. I have already installed libhyperscan5 (and all the other dependencies needed) and made sure that setuptools is installed and upgraded (I have v53.0.0).

I have made a test also for hyperscan==0.2.0 and no errors are raised during the installation. Yet, every time I import hyperscan in my code, I get the same error described in #28

root@08e7ef3102e3:~# python -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/hyperscan/__init__.py", line 5, in <module>
    from hyperscan._hyperscan import *
ImportError: /usr/local/lib/python3.9/site-packages/hyperscan/_hyperscan.cpython-39-x86_64-linux-gnu.so: undefined symbol: hs_compile_lit_multi

Nevertheless, and it is a big question mark to me, the setup MacOS (11.2) + python3.9 + hyperscan library installed from brew + pip install hyperscan==0.2.0 perfectly works

@darvid
Copy link
Owner

darvid commented Mar 11, 2021

were you able to resolve this?

the second error is probably because you installed libhs from a package manager rather than building from source. Debian/Ubuntu have <5.1 in the stable channels but this binding requires 5.2 or higher, so you probably need to build from source.

@marcorosa
Copy link
Author

I noticed the stable versions of libhyperscan for Debian and macOS are different (should be v5.1 on Debian/Ubuntu and v5.4 on MacOS), so I hope that the Debian one will be updated (sooner or later...). At the moment, I'm using a workaround where I download hyperscan==0.2.0 on MacOS and hyperscan==0.1.5 on Debian.

Nevertheless, what I still don't get, it's why on Debian, given the "working" environment with stable libhyperscan5, hyperscan==0.1.5 only works with python3.7 and python3.8, and fails with python3.9. In this case, the corresponding package in pypi should be updated as Requires: Python >=3.5, <3.9

@darvid
Copy link
Owner

darvid commented Mar 15, 2021

I'm using 3.9 on my personal machine, and the wheels are built on each cpython version currently supported, and you can see a successful run here. so 3.9 is supported and working, I think you just need to build a more recent version of Hyperscan from source on Debian.

@marcorosa
Copy link
Author

I built hyperscan from source (using docker container python:3.9, i.e., Debian Buster), and then installed from pypi hyperscan==0.2.0. There were no errors at installation time, but I get the following error when trying to use it:

root@f274cdf9705e:~# python -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/hyperscan/__init__.py", line 5, in <module>
    from hyperscan._hyperscan import *
ImportError: libhs.so.5: cannot open shared object file: No such file or directory

At this stage, I'm not sure whether it is related to this pip package or to hyperscan itself.

@darvid
Copy link
Owner

darvid commented Mar 22, 2021

did you install hyperscan to /usr or /usr/local? make sure it's in your LD_LIBRARY_PATH if it's not in /usr.

@marcorosa
Copy link
Author

I installed it in /usr/local, and updated the LD_LIBRARY_PATH accordingly

@darvid darvid added the bug label Mar 23, 2021
@darvid
Copy link
Owner

darvid commented Mar 23, 2021

ah, you need to build Hyperscan with BUILD_SHARED_LIBS set to ON. This is already documented here, but it probably would help to have some checking in the build script.

@marcorosa
Copy link
Author

Hi, after building hyperscan from source following your indications I managed to test the python package successfully. So, I think we can close the issue. Thanks for the help.

@yiwiz-sai
Copy link

yiwiz-sai commented Apr 26, 2022

Hi @darvid I got this error when install hyperscan==0.3, I used python3.8, this is my Dockerfile

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
RUN echo "Acquire::Check-Valid-Until false;Acquire::Check-Date false;" > /etc/apt/apt.conf.d/10-nocheckvalid

RUN apt update
RUN apt install -y tzdata wget curl less vim git nano zip unzip make cmake gcc g++ gdb autoconf iputils-ping libtool pkg-config autoconf python3-dev python3-pip supervisor

RUN echo "check_certificate = off" >> ~/.wgetrc

RUN apt install -y libhyperscan-dev
RUN pip3 install hyperscan

@darvid
Copy link
Owner

darvid commented Apr 26, 2022

@yiwiz-sai use python3 -m pip install hyperscan rather than pip

and note that all those build requirements and libhyperscan are no longer needed, this package is linked statically now so installing the wheel should just work.

@yiwiz-sai
Copy link

@darvid I used python3 -m pip install hyperscan, still error, you can try the dockerfile

I got:

Building wheels for collected packages: hyperscan
  Building wheel for hyperscan (PEP 517): started
  Building wheel for hyperscan (PEP 517): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /tmp/tmp1syqu0ja build_wheel /tmp/tmpmdltw441
       cwd: /tmp/pip-install-5exomt12/hyperscan
  Complete output (41 lines):
  A setup.py file already exists. Using it.
  Package libhs was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libhs.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libhs' found
  Package libch was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libch.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libch' found
  Traceback (most recent call last):
    File "/tmp/pip-install-5exomt12/hyperscan/setup.py", line 29, in <module>
      build(setup_kwargs)
    File "/tmp/pip-install-5exomt12/hyperscan/build.py", line 75, in build
      **pkgconfig(["libhs", "libch"], static=True),
    File "/tmp/pip-install-5exomt12/hyperscan/build.py", line 30, in pkgconfig
      subprocess.check_output(
    File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "/usr/lib/python3.8/subprocess.py", line 516, in run
      raise CalledProcessError(retcode, process.args,
  subprocess.CalledProcessError: Command '['pkg-config', '', '--libs-only-l', 'libhs',
 'libch']' returned non-zero exit status 1.
  Traceback (most recent call last):
    File "/tmp/tmp1syqu0ja", line 280, in <module>
      main()
    File "/tmp/tmp1syqu0ja", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmp1syqu0ja", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-hi1cwpa_/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 68, in build_wheel
      return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
    File "/tmp/pip-build-env-hi1cwpa_/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 78, in make_in
      wb.build()
    File "/tmp/pip-build-env-hi1cwpa_/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 110, in build
      self._build(zip_file)
    File "/tmp/pip-build-env-hi1cwpa_/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 162, in _build
      self._run_build_command(setup)
    File "/tmp/pip-build-env-hi1cwpa_/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 190, in _run_build_command
      subprocess.check_call(
    File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3', '/tmp/pip-install-5exomt12/hyperscan/setup.py', 'build', '-b', '/tmp/pip-install-5exomt12/hyperscan/build']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for hyperscan
Failed to build hyperscan
ERROR: Could not build wheels for hyperscan which use PEP 517 and cannot be installed directly
The command '/bin/sh -c python3 -m pip install hyperscan' returned a non-zero code: 1

@marcorosa
Copy link
Author

I also tried to install this new version of hyperscan, using MacOS + python3.9 in a virtual environment, and got the same error. I reopen the issue to keep track of it

⇒  python -m pip install hyperscan==0.3.0
Collecting hyperscan==0.3.0
  Downloading hyperscan-0.3.0.tar.gz (15 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: hyperscan
  Building wheel for hyperscan (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for hyperscan (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [37 lines of output]
      A setup.py file already exists. Using it.
      Package libch was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libch.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libch' found
      Traceback (most recent call last):
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-install-fzdae6u8/hyperscan_2b9c371c77b04f47abdf428422d2ceb7/setup.py", line 29, in <module>
          build(setup_kwargs)
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-install-fzdae6u8/hyperscan_2b9c371c77b04f47abdf428422d2ceb7/build.py", line 75, in build
          **pkgconfig(["libhs", "libch"], static=True),
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-install-fzdae6u8/hyperscan_2b9c371c77b04f47abdf428422d2ceb7/build.py", line 30, in pkgconfig
          subprocess.check_output(
        File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['pkg-config', '', '--libs-only-l', 'libhs', 'libch']' returned non-zero exit status 1.
      Traceback (most recent call last):
        File "/Users/marco/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/Users/marco/venv/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/marco/venv/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 261, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-build-env-26ukr9b6/overlay/lib/python3.9/site-packages/poetry/core/masonry/api.py", line 68, in build_wheel
          return unicode(WheelBuilder.make_in(poetry, Path(wheel_directory)))
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-build-env-26ukr9b6/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 78, in make_in
          wb.build()
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-build-env-26ukr9b6/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 110, in build
          self._build(zip_file)
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-build-env-26ukr9b6/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 162, in _build
          self._run_build_command(setup)
        File "/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-build-env-26ukr9b6/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 190, in _run_build_command
          subprocess.check_call(
        File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/Users/marco/venv/bin/python', '/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-install-fzdae6u8/hyperscan_2b9c371c77b04f47abdf428422d2ceb7/setup.py', 'build', '-b', '/private/var/folders/7t/3qnrz9cj0ml8zsb_fw1wk4t40000gn/T/pip-install-fzdae6u8/hyperscan_2b9c371c77b04f47abdf428422d2ceb7/build']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hyperscan
Failed to build hyperscan
ERROR: Could not build wheels for hyperscan, which is required to install pyproject.toml-based projects

@marcorosa marcorosa reopened this Apr 26, 2022
@darvid
Copy link
Owner

darvid commented Apr 26, 2022

ah looks like pip needs to be updated in the container first

RUN python3 -m pip install -UI pip
RUN python3 -m pip install hyperscan

@yiwiz-sai
Copy link

@darvid solved ! thanks !

@evrial
Copy link

evrial commented Jul 22, 2022

This solves NOTHING . I created clean env to test that
Only 0.2.0 installs on macos.
0.1.5 ModuleNotFoundError: No module named 'setuptools'
0.3.2 No package 'libch' found

@marcorosa
Copy link
Author

v0.1.5 is based on old libhyperscan v4. If you recently installed the hyperscan formula via brew, then you will surely have hyperscan v5.x that works with python-hyperscan v0.2. In case you really want to use v0.1.5 then you have to install the old deprecated formula hyperscan@4.x (in case it's still available).

As for python-hyperscan v0.3.x I'm in your same situation.

BTW the name of the issue is misleading because the issue is not really dealing with python3.9, but with some OS (first it was Debian, then the discussion moved to MacOS) and the version of the library they support.

@darvid:
Q1: should we rename the issue?
Q2: how can we help you with providing a working package for MacOS? I tried following your guide here but it's not working with me (I can't even compile hyperscan, in case it's really needed and installing it via homebrew is not sufficient)

@evrial
Copy link

evrial commented Jul 22, 2022

Well it should work as simple as pip install -U hyperscan . But the 0.2.0 version cannot import on Docker/ubuntu

@marcorosa
Copy link
Author

Only the 0.3 version has binaries included (I tried with ubuntu and works).
Previous versions like v0.2 require to install libhyperscan (on ubuntu it's libhyperscan5)

@abhinavbom
Copy link

is there a way to get this resolved on MacOS ?

@darvid
Copy link
Owner

darvid commented Jul 27, 2022

I currently don't have the bandwidth to look into this right now, apologies (#44)

all I will add, and I know this isn't the ideal fix, but you should be able to run your application in a docker container.

@betterlch
Copy link

Hello, I compiled and installed hyperscan 5.4.0(before is master 5.4.1) on Centos7.9

Install the project...
-- Install configuration: "RELWITHDEBINFO"
-- Installing: /usr/lib64/pkgconfig/libhs.pc
-- Installing: /usr/include/hs/hs.h
-- Up-to-date: /usr/include/hs/hs_common.h
-- Installing: /usr/include/hs/hs_compile.h
-- Up-to-date: /usr/include/hs/hs_runtime.h
-- Installing: /usr/lib64/libhs_runtime.a
-- Installing: /usr/lib64/libhs_runtime.so.5.4.0
-- Installing: /usr/lib64/libhs_runtime.so.5
-- Installing: /usr/lib64/libhs_runtime.so
-- Installing: /usr/lib64/libhs.a
-- Installing: /usr/lib64/libhs.so.5.4.0
-- Installing: /usr/lib64/libhs.so.5
-- Up-to-date: /usr/lib64/libhs.so
-- Up-to-date: /usr/include/hs/ch.h
-- Up-to-date: /usr/include/hs/ch_common.h
-- Up-to-date: /usr/include/hs/ch_compile.h
-- Up-to-date: /usr/include/hs/ch_runtime.h
-- Installing: /usr/lib64/libchimera.a
-- Installing: /usr/lib64/pkgconfig/libch.pc
-- Installing: /usr/share/doc/hyperscan/examples/simplegrep.c
-- Installing: /usr/share/doc/hyperscan/examples/pcapscan.cc
-- Installing: /usr/share/doc/hyperscan/examples/patbench.cc
-- Up-to-date: /usr/share/doc/hyperscan/examples/README.md

Python version is 3.10.9, after install hyperscan , run import hyperscan, it can't find the pcakages.

python3 -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/hyperscan/__init__.py", line 3, in <module>
    from hyperscan._hyperscan import *  # noqa: F401, F403
ModuleNotFoundError: No module named 'hyperscan._hyperscan'

anything worng?

@dfarley1
Copy link

dfarley1 commented Apr 7, 2023

@betterlch I'm having the same issue, but I think it deserves its own issue. I opened #55

@coolalexhuang
Copy link

coolalexhuang commented Jun 24, 2023

Hello, I compiled and installed hyperscan 5.4.0(before is master 5.4.1) on Centos7.9

Install the project...
-- Install configuration: "RELWITHDEBINFO"
-- Installing: /usr/lib64/pkgconfig/libhs.pc
-- Installing: /usr/include/hs/hs.h
-- Up-to-date: /usr/include/hs/hs_common.h
-- Installing: /usr/include/hs/hs_compile.h
-- Up-to-date: /usr/include/hs/hs_runtime.h
-- Installing: /usr/lib64/libhs_runtime.a
-- Installing: /usr/lib64/libhs_runtime.so.5.4.0
-- Installing: /usr/lib64/libhs_runtime.so.5
-- Installing: /usr/lib64/libhs_runtime.so
-- Installing: /usr/lib64/libhs.a
-- Installing: /usr/lib64/libhs.so.5.4.0
-- Installing: /usr/lib64/libhs.so.5
-- Up-to-date: /usr/lib64/libhs.so
-- Up-to-date: /usr/include/hs/ch.h
-- Up-to-date: /usr/include/hs/ch_common.h
-- Up-to-date: /usr/include/hs/ch_compile.h
-- Up-to-date: /usr/include/hs/ch_runtime.h
-- Installing: /usr/lib64/libchimera.a
-- Installing: /usr/lib64/pkgconfig/libch.pc
-- Installing: /usr/share/doc/hyperscan/examples/simplegrep.c
-- Installing: /usr/share/doc/hyperscan/examples/pcapscan.cc
-- Installing: /usr/share/doc/hyperscan/examples/patbench.cc
-- Up-to-date: /usr/share/doc/hyperscan/examples/README.md

Python version is 3.10.9, after install hyperscan , run import hyperscan, it can't find the pcakages.

python3 -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/hyperscan/__init__.py", line 3, in <module>
    from hyperscan._hyperscan import *  # noqa: F401, F403
ModuleNotFoundError: No module named 'hyperscan._hyperscan'

anything worng?

met the same issue, have u solved it? @betterlch

@betterlch
Copy link

Hello, I compiled and installed hyperscan 5.4.0(before is master 5.4.1) on Centos7.9

Install the project...
-- Install configuration: "RELWITHDEBINFO"
-- Installing: /usr/lib64/pkgconfig/libhs.pc
-- Installing: /usr/include/hs/hs.h
-- Up-to-date: /usr/include/hs/hs_common.h
-- Installing: /usr/include/hs/hs_compile.h
-- Up-to-date: /usr/include/hs/hs_runtime.h
-- Installing: /usr/lib64/libhs_runtime.a
-- Installing: /usr/lib64/libhs_runtime.so.5.4.0
-- Installing: /usr/lib64/libhs_runtime.so.5
-- Installing: /usr/lib64/libhs_runtime.so
-- Installing: /usr/lib64/libhs.a
-- Installing: /usr/lib64/libhs.so.5.4.0
-- Installing: /usr/lib64/libhs.so.5
-- Up-to-date: /usr/lib64/libhs.so
-- Up-to-date: /usr/include/hs/ch.h
-- Up-to-date: /usr/include/hs/ch_common.h
-- Up-to-date: /usr/include/hs/ch_compile.h
-- Up-to-date: /usr/include/hs/ch_runtime.h
-- Installing: /usr/lib64/libchimera.a
-- Installing: /usr/lib64/pkgconfig/libch.pc
-- Installing: /usr/share/doc/hyperscan/examples/simplegrep.c
-- Installing: /usr/share/doc/hyperscan/examples/pcapscan.cc
-- Installing: /usr/share/doc/hyperscan/examples/patbench.cc
-- Up-to-date: /usr/share/doc/hyperscan/examples/README.md

Python version is 3.10.9, after install hyperscan , run import hyperscan, it can't find the pcakages.

python3 -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/hyperscan/__init__.py", line 3, in <module>
    from hyperscan._hyperscan import *  # noqa: F401, F403
ModuleNotFoundError: No module named 'hyperscan._hyperscan'

anything worng?

met the same issue, have u solved it? @betterlch

Just rename _hyperscan.pyi to _hyperscan.py
Or you can use dynamic linking and recompile

@coolalexhuang
Copy link

coolalexhuang commented Jun 25, 2023

Hello, I compiled and installed hyperscan 5.4.0(before is master 5.4.1) on Centos7.9

Install the project...
-- Install configuration: "RELWITHDEBINFO"
-- Installing: /usr/lib64/pkgconfig/libhs.pc
-- Installing: /usr/include/hs/hs.h
-- Up-to-date: /usr/include/hs/hs_common.h
-- Installing: /usr/include/hs/hs_compile.h
-- Up-to-date: /usr/include/hs/hs_runtime.h
-- Installing: /usr/lib64/libhs_runtime.a
-- Installing: /usr/lib64/libhs_runtime.so.5.4.0
-- Installing: /usr/lib64/libhs_runtime.so.5
-- Installing: /usr/lib64/libhs_runtime.so
-- Installing: /usr/lib64/libhs.a
-- Installing: /usr/lib64/libhs.so.5.4.0
-- Installing: /usr/lib64/libhs.so.5
-- Up-to-date: /usr/lib64/libhs.so
-- Up-to-date: /usr/include/hs/ch.h
-- Up-to-date: /usr/include/hs/ch_common.h
-- Up-to-date: /usr/include/hs/ch_compile.h
-- Up-to-date: /usr/include/hs/ch_runtime.h
-- Installing: /usr/lib64/libchimera.a
-- Installing: /usr/lib64/pkgconfig/libch.pc
-- Installing: /usr/share/doc/hyperscan/examples/simplegrep.c
-- Installing: /usr/share/doc/hyperscan/examples/pcapscan.cc
-- Installing: /usr/share/doc/hyperscan/examples/patbench.cc
-- Up-to-date: /usr/share/doc/hyperscan/examples/README.md

Python version is 3.10.9, after install hyperscan , run import hyperscan, it can't find the pcakages.

python3 -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/hyperscan/__init__.py", line 3, in <module>
    from hyperscan._hyperscan import *  # noqa: F401, F403
ModuleNotFoundError: No module named 'hyperscan._hyperscan'

anything worng?

met the same issue, have u solved it? @betterlch

Just rename _hyperscan.pyi to _hyperscan.py Or you can use dynamic linking and recompile

@betterlch , the python script works after rename the file, but it alway returns None for the complied DB

`import hyperscan

db = hyperscan.Database()
patterns = (
# expression, id, flags
(br'fo+', 0, 0),
(br'^foobar$', 1, hyperscan.HS_FLAG_CASELESS),
(br'BAR', 2, hyperscan.HS_FLAG_CASELESS
| hyperscan.HS_FLAG_SOM_LEFTMOST),
)
expressions, ids, flags = zip(*patterns)
db.compile(
expressions=expressions, ids=ids, elements=len(patterns), flags=flags
)
print(db.info())`

I am using brew install hyperscan to install hyperscan, python 3.10, MacOS v11.6.8, do I need to install hyperscan from source code?

@betterlch
Copy link

Hello, I compiled and installed hyperscan 5.4.0(before is master 5.4.1) on Centos7.9

Install the project...
-- Install configuration: "RELWITHDEBINFO"
-- Installing: /usr/lib64/pkgconfig/libhs.pc
-- Installing: /usr/include/hs/hs.h
-- Up-to-date: /usr/include/hs/hs_common.h
-- Installing: /usr/include/hs/hs_compile.h
-- Up-to-date: /usr/include/hs/hs_runtime.h
-- Installing: /usr/lib64/libhs_runtime.a
-- Installing: /usr/lib64/libhs_runtime.so.5.4.0
-- Installing: /usr/lib64/libhs_runtime.so.5
-- Installing: /usr/lib64/libhs_runtime.so
-- Installing: /usr/lib64/libhs.a
-- Installing: /usr/lib64/libhs.so.5.4.0
-- Installing: /usr/lib64/libhs.so.5
-- Up-to-date: /usr/lib64/libhs.so
-- Up-to-date: /usr/include/hs/ch.h
-- Up-to-date: /usr/include/hs/ch_common.h
-- Up-to-date: /usr/include/hs/ch_compile.h
-- Up-to-date: /usr/include/hs/ch_runtime.h
-- Installing: /usr/lib64/libchimera.a
-- Installing: /usr/lib64/pkgconfig/libch.pc
-- Installing: /usr/share/doc/hyperscan/examples/simplegrep.c
-- Installing: /usr/share/doc/hyperscan/examples/pcapscan.cc
-- Installing: /usr/share/doc/hyperscan/examples/patbench.cc
-- Up-to-date: /usr/share/doc/hyperscan/examples/README.md

Python version is 3.10.9, after install hyperscan , run import hyperscan, it can't find the pcakages.

python3 -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/hyperscan/__init__.py", line 3, in <module>
    from hyperscan._hyperscan import *  # noqa: F401, F403
ModuleNotFoundError: No module named 'hyperscan._hyperscan'

anything worng?

met the same issue, have u solved it? @betterlch

Just rename _hyperscan.pyi to _hyperscan.py Or you can use dynamic linking and recompile

@betterlch , the python script works after rename the file, but it alway returns None for the complied DB

`import hyperscan

db = hyperscan.Database() patterns = ( # expression, id, flags (br'fo+', 0, 0), (br'^foobar$', 1, hyperscan.HS_FLAG_CASELESS), (br'BAR', 2, hyperscan.HS_FLAG_CASELESS | hyperscan.HS_FLAG_SOM_LEFTMOST), ) expressions, ids, flags = zip(*patterns) db.compile( expressions=expressions, ids=ids, elements=len(patterns), flags=flags ) print(db.info())`

I am using brew install hyperscan to install hyperscan, python 3.10, MacOS v11.6.8, do I need to install hyperscan from source code?
I‘m’

Hello, I compiled and installed hyperscan 5.4.0(before is master 5.4.1) on Centos7.9

Install the project...
-- Install configuration: "RELWITHDEBINFO"
-- Installing: /usr/lib64/pkgconfig/libhs.pc
-- Installing: /usr/include/hs/hs.h
-- Up-to-date: /usr/include/hs/hs_common.h
-- Installing: /usr/include/hs/hs_compile.h
-- Up-to-date: /usr/include/hs/hs_runtime.h
-- Installing: /usr/lib64/libhs_runtime.a
-- Installing: /usr/lib64/libhs_runtime.so.5.4.0
-- Installing: /usr/lib64/libhs_runtime.so.5
-- Installing: /usr/lib64/libhs_runtime.so
-- Installing: /usr/lib64/libhs.a
-- Installing: /usr/lib64/libhs.so.5.4.0
-- Installing: /usr/lib64/libhs.so.5
-- Up-to-date: /usr/lib64/libhs.so
-- Up-to-date: /usr/include/hs/ch.h
-- Up-to-date: /usr/include/hs/ch_common.h
-- Up-to-date: /usr/include/hs/ch_compile.h
-- Up-to-date: /usr/include/hs/ch_runtime.h
-- Installing: /usr/lib64/libchimera.a
-- Installing: /usr/lib64/pkgconfig/libch.pc
-- Installing: /usr/share/doc/hyperscan/examples/simplegrep.c
-- Installing: /usr/share/doc/hyperscan/examples/pcapscan.cc
-- Installing: /usr/share/doc/hyperscan/examples/patbench.cc
-- Up-to-date: /usr/share/doc/hyperscan/examples/README.md

Python version is 3.10.9, after install hyperscan , run import hyperscan, it can't find the pcakages.

python3 -c "import hyperscan"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/hyperscan/__init__.py", line 3, in <module>
    from hyperscan._hyperscan import *  # noqa: F401, F403
ModuleNotFoundError: No module named 'hyperscan._hyperscan'

anything worng?

met the same issue, have u solved it? @betterlch

Just rename _hyperscan.pyi to _hyperscan.py Or you can use dynamic linking and recompile

@betterlch , the python script works after rename the file, but it alway returns None for the complied DB

`import hyperscan

db = hyperscan.Database() patterns = ( # expression, id, flags (br'fo+', 0, 0), (br'^foobar$', 1, hyperscan.HS_FLAG_CASELESS), (br'BAR', 2, hyperscan.HS_FLAG_CASELESS | hyperscan.HS_FLAG_SOM_LEFTMOST), ) expressions, ids, flags = zip(*patterns) db.compile( expressions=expressions, ids=ids, elements=len(patterns), flags=flags ) print(db.info())`

I am using brew install hyperscan to install hyperscan, python 3.10, MacOS v11.6.8, do I need to install hyperscan from source code?

I'm not sure, I havn't try it because I don't have macbook ^_^.
You can reinstall by source code, or using CentOS (I use)

@marcorosa
Copy link
Author

I think we can close this issue.
As of python-hyperscan v0.5.0 the issues with python3.9 seem solved.
Probably v0.6.0 also works, but its package has not been released on pypi for python3.9 (#96 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants