0

I'm trying to install Regex on macos catalina, but I'm getting this error, how do I proceed? I tried to update pip, pip3, pipwin, xcode, but both return the same error, the same happens when I install NLTK.

I was able to install on a ubuntu VM and installed everything, REGEX and NLTK, only on MacOs that I continue with this error below:

pip3 install regex
Collecting regex
  Using cached regex-2020.6.8.tar.gz (690 kB)
Building wheels for collected packages: regex
  Building wheel for regex (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-wheel-j6dr4ocd
       cwd: /private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/
  Complete output (17 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-x86_64-3.7
  creating build/lib.macosx-10.14-x86_64-3.7/regex
  copying regex_3/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/regex
  copying regex_3/regex.py -> build/lib.macosx-10.14-x86_64-3.7/regex
  copying regex_3/_regex_core.py -> build/lib.macosx-10.14-x86_64-3.7/regex
  copying regex_3/test_regex.py -> build/lib.macosx-10.14-x86_64-3.7/regex
  running build_ext
  building 'regex._regex' extension
  creating build/temp.macosx-10.14-x86_64-3.7
  creating build/temp.macosx-10.14-x86_64-3.7/regex_3
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c regex_3/_regex.c -o build/temp.macosx-10.14-x86_64-3.7/regex_3/_regex.o
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for regex
  Running setup.py clean for regex
Failed to build regex
Installing collected packages: regex
    Running setup.py install for regex ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/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/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-record-olfcxoeu/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/regex
         cwd: /private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/
    Complete output (17 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.14-x86_64-3.7
    creating build/lib.macosx-10.14-x86_64-3.7/regex
    copying regex_3/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/regex
    copying regex_3/regex.py -> build/lib.macosx-10.14-x86_64-3.7/regex
    copying regex_3/_regex_core.py -> build/lib.macosx-10.14-x86_64-3.7/regex
    copying regex_3/test_regex.py -> build/lib.macosx-10.14-x86_64-3.7/regex
    running build_ext
    building 'regex._regex' extension
    creating build/temp.macosx-10.14-x86_64-3.7
    creating build/temp.macosx-10.14-x86_64-3.7/regex_3
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c regex_3/_regex.c -o build/temp.macosx-10.14-x86_64-3.7/regex_3/_regex.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/opt/python/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-install-fzw0lg0t/regex/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/6h/wf23bbbj7t7dwhyzz0cjw3_r0000gn/T/pip-record-olfcxoeu/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7m/regex Check the logs for full command output.**strong text**
martineau
  • 119,623
  • 25
  • 170
  • 301
  • https://stackoverflow.com/search?q=%5Bpip%5D+xcrun%3A+error%3A+invalid+active+developer+path – phd Jun 23 '20 at 23:12

2 Answers2

3

I am no mac super user but you could try this and check if it works.

xcode-select --install

If it says it's already installed try:

xcode-select --reset

The reason I believe it might be the issue is cause of the xcrun error that is occurring.

Eivind
  • 74
  • 1
  • 7
1

The underlying error seems to be:

invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun`

You can most likely solve this by installing the command line tools:

xcode-select --install

See https://apple.stackexchange.com/questions/254380/why-am-i-getting-an-invalid-active-developer-path-when-attempting-to-use-git-a for more details.

DanielGibbs
  • 9,910
  • 11
  • 76
  • 121