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

Pip install fails on macOS 12.5 (Apple silicon M1) #38

Open
adno opened this issue Aug 25, 2022 · 2 comments
Open

Pip install fails on macOS 12.5 (Apple silicon M1) #38

adno opened this issue Aug 25, 2022 · 2 comments

Comments

@adno
Copy link

adno commented Aug 25, 2022

I tried to install the current version of CyHunspell (1.3.4). pip install cyhunspell first fails with "package hunspell was not found in the pkg-config search path". When I add it to the path, it fails again because it cannot find 'hunspell/hunspell.hxx' in the include path.

The following command works OK as a workaround:

PKG_CONFIG_PATH=/opt/homebrew/Cellar/hunspell/1.7.0_2/lib/pkgconfig pip install --global-option=build_ext --global-option="-I/opt/homebrew/Cellar/hunspell/1.7.0_2/include" cyhunspell

Details of my configuration and the error messages follow.

My configuration:

  • macOS 12.5
  • Apple silicon M1
  • hunspell installed via homebrew
  • python 3.9 or 3.10 (both fail the same way) in a conda environment

First error message (pkg-config):

  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /opt/homebrew/Caskroom/miniforge/base/bin/python3.10 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/49/858b60c08xl87j008k8x2shh0000gn/T/pip-install-1msosrr7/cyhunspell_651d3396f3c745008b2f22388a0bfd1e/setup.py'"'"'; __file__='"'"'/private/var/folders/49/858b60c08xl87j008k8x2shh0000gn/T/pip-install-1msosrr7/cyhunspell_651d3396f3c745008b2f22388a0bfd1e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/49/858b60c08xl87j008k8x2shh0000gn/T/pip-pip-egg-info-x6wlvww7
       cwd: /private/var/folders/49/858b60c08xl87j008k8x2shh0000gn/T/pip-install-1msosrr7/cyhunspell_651d3396f3c745008b2f22388a0bfd1e/
  Complete output (1289 lines):

...

   ./install-sh -c -d '/private/var/folders/49/858b60c08xl87j008k8x2shh0000gn/T/pip-install-1msosrr7/cyhunspell_ec8a410d2e92487187afdf9db199bbb7/libs/tmp/lib/pkgconfig'
   /usr/bin/install -c -m 644 hunspell.pc '/private/var/folders/49/858b60c08xl87j008k8x2shh0000gn/T/pip-install-1msosrr7/cyhunspell_ec8a410d2e92487187afdf9db199bbb7/libs/tmp/lib/pkgconfig'
  Traceback (most recent call last):
    File "/private/var/folders/49/858b60c08xl87j008k8x2shh0000gn/T/pip-install-1msosrr7/cyhunspell_ec8a410d2e92487187afdf9db199bbb7/find_library.py", line 226, in pkgconfig
      raise RuntimeError(response)
  RuntimeError: Package hunspell was not found in the pkg-config search path.
  Perhaps you should add the directory containing `hunspell.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'hunspell' found

Second error message (include):
hunspell/hunspell.cpp:633:10: fatal error: 'hunspell/hunspell.hxx' file not found

@adno adno changed the title Pip install on macOS 12.5 (Apple silicon M1) Pip install fails on macOS 12.5 (Apple silicon M1) Aug 25, 2022
@astariul
Copy link

I had the same problem. I could make it work by first cloning the repository and install from there :

git clone https://github.com/MSeal/cython_hunspell.git
cd cython_hunspell
pip install .

You can test it works properly :

cd ..
python -c "from hunspell import Hunspell; h = Hunspell(); print(h.spell('correct')); print(h.spell('incorect'))"

@adno
Copy link
Author

adno commented Jan 16, 2023

Update: The problem and the workaround is still the same even for macOS 13.1 and Python 3.11, depending on where and which version of hunspell you have, a command similar to this will work:

PKG_CONFIG_PATH=/opt/homebrew/Cellar/hunspell/1.7.2/lib/pkgconfig pip install --global-option=build_ext --global-option="-I/opt/homebrew/Cellar/hunspell/1.7.2/include" cyhunspell

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

No branches or pull requests

2 participants