darvid/python-hyperscan

installation error on MacOS

yangzhang21 opened this issue · 2 comments

Hi,
I have tried to install python-hyperscan on my macbook. I have no luck no matter I use pip or poetry. I have hyperscan 5.4 installed properly by brew. While I try to install python-hyperscan, I always get error. .... Couldn't figure it out.

For pip, the error message is like

Building wheels for collected packages: hyperscan
Building wheel for hyperscan (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Library/Python/3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/tmpue4jkb24
cwd: /private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-install-slrkf9b5/hyperscan_17835bf2676c44b2b82c6fac9b18d0d7
Complete output (37 lines):
A setup.py file already exists. Using it.
Traceback (most recent call last):
File "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-install-slrkf9b5/hyperscan_17835bf2676c44b2b82c6fac9b18d0d7/setup.py", line 29, in
build(setup_kwargs)
File "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-install-slrkf9b5/hyperscan_17835bf2676c44b2b82c6fac9b18d0d7/build.py", line 48, in build
**pkgconfig(['libhs']),
File "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-install-slrkf9b5/hyperscan_17835bf2676c44b2b82c6fac9b18d0d7/build.py", line 27, in pkgconfig
subprocess.check_output(
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pkg-config'
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in
main()
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Library/Python/3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-build-env-ywjtnpm1/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 "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-build-env-ywjtnpm1/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 72, in make_in
wb.build()
File "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-build-env-ywjtnpm1/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 103, in build
self._build(zip_file)
File "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-build-env-ywjtnpm1/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 135, in _build
self._run_build_command(setup)
File "/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-build-env-ywjtnpm1/overlay/lib/python3.8/site-packages/poetry/core/masonry/builders/wheel.py", line 163, in _run_build_command
subprocess.check_call(
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Applications/Xcode.app/Contents/Developer/usr/bin/python3', '/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-install-slrkf9b5/hyperscan_17835bf2676c44b2b82c6fac9b18d0d7/setup.py', 'build', '-b', '/private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-install-slrkf9b5/hyperscan_17835bf2676c44b2b82c6fac9b18d0d7/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
'

=============
If I use poetry, the error is like the below

Installing the current project: hyperscan (0.2.0)
EnvCommandError

Command ['/Users/xxxx/Library/Caches/pypoetry/virtualenvs/hyperscan-ZlXSVyo--py3.8/bin/pip', 'install', '-e', '/Users/xxxx/Project/Python/python-hyperscan', '--no-deps'] errored with the following return code 1, and output:
Obtaining file:///Users/xxxx/Project/Python/python-hyperscan
ERROR: Command errored out with exit status 1:
command: /Users/xxxx/Library/Caches/pypoetry/virtualenvs/hyperscan-ZlXSVyo--py3.8/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/xxxx/Project/Python/python-hyperscan/setup.py'"'"'; file='"'"'/Users/xxxx/Project/Python/python-hyperscan/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/jk/vg7nnbhj4qg0r0xz3yhskylw0000gn/T/pip-pip-egg-info-ilttc02s
cwd: /Users/xxxx/Project/Python/python-hyperscan/
Complete output (17 lines):
Traceback (most recent call last):
File "", line 1, in
File "/Users/xxxx/Project/Python/python-hyperscan/setup.py", line 29, in
build(setup_kwargs)
File "/Users/xxxx/Project/Python/python-hyperscan/build.py", line 48, in build
**pkgconfig(['libhs']),
File "/Users/xxxx/Project/Python/python-hyperscan/build.py", line 27, in pkgconfig
subprocess.check_output(
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pkg-config'
----------------------------------------
WARNING: Discarding file:///Users/xxxx/Project/Python/python-hyperscan. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

at /usr/local/Cellar/poetry/1.1.5/libexec/lib/python3.9/site-packages/poetry/utils/env.py:1074 in run
1070│ output = subprocess.check_output(
1071│ cmd, stderr=subprocess.STDOUT, **kwargs
1072│ )
1073│ except CalledProcessError as e:
→ 1074│ raise EnvCommandError(e, input=input
)
1075│
1076│ return decode(output)
1077│
1078│ def execute(self, bin, *args, **kwargs):

looks like you're missing pkg-config, try running brew install pkg-config

yeah, check the closed tickets and found a solution. :) Thanks @darvid !