4

I'm trying to install chatterbot on macOS with

python3 -m pip install chatterbot

and every time I get the same error during the step "Installing build dependencies ... /"

ERROR: Failed building wheel for spacy
Running setup.py clean for spacy
Failed to build spacy
ERROR: Could not build wheels for spacy which use PEP 517 and cannot be installed directly

Can someone please help?

Installing collected packages: spacy, chatterbot
  Running setup.py install for spacy ... error
    ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-record-z9jsui8q/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.7
    creating build/lib.macosx-10.9-x86_64-3.7/spacy
    copying spacy/lemmatizer.py -> build/lib.macosx-10.9-x86_64-3.7/spacy


running build_ext
    building 'spacy._align' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/spacy
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -I/private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c spacy/_align.cpp -o build/temp.macosx-10.9-x86_64-3.7/spacy/_align.o -O2 -Wno-strict-prototypes -Wno-unused-function -stdlib=libc++
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-record-z9jsui8q/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-33629q9f/spacy/
jfar7
  • 41
  • 1
  • 1
  • 5

6 Answers6

13

You could try python3 -m pip install --no-binary spacy chatterbot, which should tell pip to not build the wheel

Alternately python3 -m pip install --no-use-pep517 chatterbot.

Nick T
  • 25,754
  • 12
  • 83
  • 121
  • Nick T, thanks for the answer i tried the first one and gave me this: Running setup.py install for spacy ... error ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/ry/sht50z853vn58nwg6wbzt4l00000gn/T/pip-install-7130d3lz/spacy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record the second tells me i have to use pep517 – jfar7 May 03 '19 at 16:39
  • 1
    @jfar7 it's very difficult to read code like that when not wrapped in code tags (``` GRAVE ACCENT). If there's a lot, it's best to add it to the question itself (click "edit" under the python/macos/chatterbot tags) – Nick T May 03 '19 at 17:03
  • sorry my bad, i posted as you say, on the question, thats the new error its given me – jfar7 May 03 '19 at 18:04
2

I had the same problem while installing kivy through command prompt. If you use Pycharm then there is an easy way to avoid these problems.

Open Pycharm-->GoTo Files-->Settings-->Project-->Python Interpreter--> + sign-->then search for what you want to install. Check the version which works for you and install it. If you get an error then try and install other versions of it. That would solve the issue.

1

Try installing the python-dev version.

For python3.7

sudo apt-get install python3.7-dev

For python3.6

sudo apt-get install python3.6-dev
1

In one of the scenarios where if you are using Anaconda, then you have to install using this command: conda install -c conda-forge spacy, hope this helps !!

Shirish Singh
  • 797
  • 7
  • 17
0

I had this issue with MacOS for a different package. I found this warning in the log:

WARNING: Building wheel for bottleneck failed: [Errno 13] Permission denied: '/Users/avi/Library/Caches/pip/wheels/87'

Then I gave my user access to the pip/wheels directory and then the installation worked.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Avision
  • 3,613
  • 1
  • 19
  • 24
-8

Easy, try to run this:

pip install pep517

And then try to install again

python3 -m pip install chatterbot

Francesco Mantovani
  • 10,216
  • 13
  • 73
  • 113