templated
templated

Reputation: 21

python - errors installing spaCy (UnicodeDecodeError)

I am trying to install spaCy on Ubuntu in VirtualBox. I am following the instructions here: https://spacy.io/usage/#section-instructions

I type each of the following into the terminal as is; I do not navigate into any directories.

I try the first instruction:

pip install -U spacy

Which gives:

error: could not delete '/usr/local/lib/python2.7/dist-packages/spacy/pipeline.so': Permission denied

So after following advice on another question I instead try:

sudo pip install -U spacy

Which does not give me the error from before, but now I get the following:

Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/spacy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0HIkOS-record/install-record.txt --single-version-externally-managed --compile failed with error code -9 in /tmp/pip_build_root/spacy
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)

So if I then try to download the English package (ignoring the errors above):

python -m spacy download en

I get:

/usr/bin/python: No module named plac; 'spacy' is a package and cannot be directly executed

Not sure if this information is relevant: When I look in /usr/lib I find python2.7 and python3.4; each folder also contains a spacy folder. Probably because I tried the above commands with python3 as well as just python when trying to solve my problem.

Can someone help me solve this issue so I can install spaCy and make use of the English model?

Upvotes: 2

Views: 503

Answers (1)

Jerry K.
Jerry K.

Reputation: 527

Try updating pip:

 $ pip install -U pip

Then try the Spacy install again.

I got the same error message during the Spacy install when it was in the process of installing numpy. The pip update fixed the problem and everything went smoothly after that, including Spacy's English language model download.

Upvotes: 1

Related Questions