简体   繁体   中英

Cannot install jamspell on macOS Big Sur via pip?

I followed the instructions on how to install JamSpell spell checking library.

I installed swig by running brew install swig (v. 4.0.2), but I cannot manage to install the library with pip install jamspell on macOS Big Sur, Python3 (not even with sudo ).

Error log:

WARNING: The directory '/Users/ljudmilapetkovic/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
WARNING: Ignoring invalid distribution -cwidth (/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages)
WARNING: Ignoring invalid distribution -cwidth (/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages)
Collecting jamspell
  Downloading jamspell-0.0.12.tar.gz (174 kB)
     |████████████████████████████████| 174 kB 4.1 MB/s 
Building wheels for collected packages: jamspell
  Building wheel for jamspell (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/ljudmilapetkovic/opt/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/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'"'"'))' bdist_wheel -d /private/tmp/pip-wheel-bw5_k9h5
       cwd: /private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/
  Complete output (41 lines):
  running bdist_wheel
  running build
  running build_ext
  building '_jamspell' extension
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py", line 55, in <module>
      setup(
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
      self.run_command('build')
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py", line 37, in run
      self.run_command('build_ext')
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 340, in run
      self.build_extensions()
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
      self._build_extensions_serial()
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
      self.build_extension(ext)
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 506, in build_extension
      sources = self.swig_sources(sources, ext)
    File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 597, in swig_sources
      swig = self.swig or self.find_swig()
    File "/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py", line 50, in find_swig
      assert subprocess.check_output([swigBinary, "-version"]).find(b'SWIG Version 3') != -1
  AssertionError
  ----------------------------------------
  ERROR: Failed building wheel for jamspell
  Running setup.py clean for jamspell
Failed to build jamspell
WARNING: Ignoring invalid distribution -cwidth (/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages)
Installing collected packages: jamspell
    Running setup.py install for jamspell ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/ljudmilapetkovic/opt/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/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'"'"'))' install --record /private/tmp/pip-record-lu0nx9hk/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ljudmilapetkovic/opt/anaconda3/include/python3.8/jamspell
         cwd: /private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/
    Complete output (34 lines):
    running install
    running build_ext
    building '_jamspell' extension
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py", line 55, in <module>
        setup(
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py", line 43, in run
        self.run_command('build_ext')
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
        self._build_extensions_serial()
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
        self.build_extension(ext)
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 506, in build_extension
        sources = self.swig_sources(sources, ext)
      File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 597, in swig_sources
        swig = self.swig or self.find_swig()
      File "/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py", line 50, in find_swig
        assert subprocess.check_output([swigBinary, "-version"]).find(b'SWIG Version 3') != -1
    AssertionError
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/ljudmilapetkovic/opt/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-_wxwt5tq/jamspell_2c920e7dbac74937875274f33ed536c4/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'"'"'))' install --record /private/tmp/pip-record-lu0nx9hk/install-record.txt --single-version-externally-managed --compile --install-headers /Users/ljudmilapetkovic/opt/anaconda3/include/python3.8/jamspell Check the logs for full command output.
WARNING: Ignoring invalid distribution -cwidth (/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages)
WARNING: Ignoring invalid distribution -cwidth (/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages)

python setup.py install does not help either:

running install
running build_ext
building '_jamspell' extension
Traceback (most recent call last):
  File "setup.py", line 55, in <module>
    setup(
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 43, in run
    self.run_command('build_ext')
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 506, in build_extension
    sources = self.swig_sources(sources, ext)
  File "/Users/ljudmilapetkovic/opt/anaconda3/lib/python3.8/distutils/command/build_ext.py", line 597, in swig_sources
    swig = self.swig or self.find_swig()
  File "setup.py", line 50, in find_swig
    assert subprocess.check_output([swigBinary, "-version"]).find(b'SWIG Version 3') != -1
AssertionError

What is going on here?

Having encountered this same exact problem with your same desktop specs, this thread should fix your problem. It took a long while for me to find this buried discussion, but since your post came up at the very top of my original search results, I'm hoping that keeping this up can guide other people to a solution much more quickly.

I'm linking it here but also including the solution that worked for me:

  1. Manually download swig3 via sourceforge
  2. Extract the zipped download folder
  3. Run the following via terminal:
    <add_directory_of_folder_here>/swig-3.0.12/configure && make && make install
    • Running this command will display a very long output and take ~1 minute
  4. Run pip install jamspell
    • Terminal may appear to "hesitate" for a second longer than it would with the normal installation process before building wheels for the package:
      • It'll tell you the package has been install, but you will not see the usual:
        Downloading jamspell-0.0.12.tar.gz (174 kB) |████████████████████████████████| 174 kB 4.1 MB/s

An alternative is, if you just run the package via Co-Lab , it'll work. The only downside I suppose is that you'll have to reinstall the package every time you reconnect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM