I'm running into problems when installing SpaCy and its language models through the terminal in MacOS.
Systeminformation:
MacOS 10.13.1
Python 3.6.3 :: Anaconda, Inc.
SpaCy 2.0.3
Installing SpaCy works just fine. conda install -c conda-forge spacy returns:
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment /Users/phndrff/anaconda3:
The following NEW packages will be INSTALLED:
spacy: 2.0.3-py36_0 conda-forge
Proceed ([y]/n)? y
Double checking it is still good:
# All requested packages already installed.
# packages in environment at /Users/phndrff/anaconda3:
#
spacy 2.0.3 py36_0 conda-forge
But as soon as I try to use spacy to download models or do anything else it runs into error messages, i.e. python -m spacy info --markdown:
Traceback (most recent call last):
File "/Users/phndrff/anaconda3/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/Users/phndrff/anaconda3/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/Users/phndrff/anaconda3/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/Users/phndrff/anaconda3/lib/python3.6/site-packages/spacy/__init__.py", line 4, in <module>
from .cli.info import info as cli_info
File "/Users/phndrff/anaconda3/lib/python3.6/site-packages/spacy/cli/__init__.py", line 1, in <module>
from .download import download
File "/Users/phndrff/anaconda3/lib/python3.6/site-packages/spacy/cli/download.py", line 10, in <module>
from .link import link
File "/Users/phndrff/anaconda3/lib/python3.6/site-packages/spacy/cli/link.py", line 8, in <module>
from ..util import prints
File "/Users/phndrff/anaconda3/lib/python3.6/site-packages/spacy/util.py", line 8, in <module>
import regex as re
File "/Users/phndrff/anaconda3/lib/python3.6/site-packages/regex.py", line 683, in <module>
_pattern_type = type(_compile("", 0, {}))
File "/Users/phndrff/anaconda3/lib/python3.6/site-packages/regex.py", line 436, in _compile
pattern_locale = _getlocale()[1]
File "/Users/phndrff/anaconda3/lib/python3.6/locale.py", line 581, in getlocale
return _parse_localename(localename)
File "/Users/phndrff/anaconda3/lib/python3.6/locale.py", line 490, in _parse_localename
raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8
Oddly enough I was able to download one model yesterday after unistalling spacy and installing it again but I'm unable to reproduce it now.
I've seen similar problems in other issues (i.e. #1517) but their solution of setting export LC_ALL=en_US.UTF-8 in ~/.bash_profile did not solve my issue anyway.
Any suggestions to solve this?
Oh well .... I found a different solution that solved this issue at stackoverflow:
Besides adding LC_ALL you've to add the same value to LANG as well. So the entry in .bash_profile looks like this:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
Writing down problems might solve problems
Thanks for updating with your solution – glad you got it working!
(I actually remember having this problem myself with some other library and setup – I chose to ignore the advice from StackOverflow because I thought "ah, it just can't be that simple" and spent another hour before I ended up back at LANG 🤦♀️)
I got the same issue, after trying the above solution I got the following:
usage: ipykernel_launcher.py [-h] [model]
ipykernel_launcher.py: error: unrecognized arguments: -f
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
/usr/local/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2918: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
How can I install the library?, thanks!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Oh well .... I found a different solution that solved this issue at stackoverflow:
Besides adding
LC_ALLyou've to add the same value toLANGas well. So the entry in.bash_profilelooks like this:Writing down problems might solve problems