I'm trying to install the nltk package using pip 20.1.1. I'm on macOS Catalina version 10.15.3.
I've tried using pip3 install nltk
, sudo pip3 install nltk
, and pip3 install -U nltk
but they all give me the same error.
This is the cmd output when I run pip3 install -U nltk
:
users@user-MacBook-Pro bin % pip3 install -U nltk
Collecting nltk
Using cached nltk-3.5.zip (1.4 MB)
Requirement already satisfied, skipping upgrade: click in /Users/jingyixie/Library/Python/3.8/lib/python/site-packages (from nltk) (7.1.2)
Requirement already satisfied, skipping upgrade: joblib in /Users/jingyixie/Library/Python/3.8/lib/python/site-packages (from nltk) (0.16.0)
Collecting regex
Using cached regex-2020.7.14.tar.gz (690 kB)
Collecting tqdm
Using cached tqdm-4.48.2-py2.py3-none-any.whl (68 kB)
Using legacy setup.py install for nltk, since package 'wheel' is not installed.
Using legacy setup.py install for regex, since package 'wheel' is not installed.
Installing collected packages: regex, tqdm, nltk
Running setup.py install for regex ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-w2v3_a8b/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-w2v3_a8b/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/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-record-r4iqnzs0/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/regex
cwd: /private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-w2v3_a8b/regex/
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/_regex_core.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/test_regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
running build_ext
building 'regex._regex' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/regex_3
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.8/include/python3.8 -c regex_3/_regex.c -o build/temp.macosx-10.9-x86_64-3.8/regex_3/_regex.o
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 errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-w2v3_a8b/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-w2v3_a8b/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/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-record-r4iqnzs0/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/regex Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install --upgrade pip' command.
So I went and successfully installed wheel with pip3 install wheel
and tried pip3 install -U nltk
again with this output:
users@user-MacBook-Pro bin % pip3 install -U nltk
Collecting nltk
Using cached nltk-3.5.zip (1.4 MB)
Requirement already satisfied, skipping upgrade: click in /Users/jingyixie/Library/Python/3.8/lib/python/site-packages (from nltk) (7.1.2)
Requirement already satisfied, skipping upgrade: joblib in /Users/jingyixie/Library/Python/3.8/lib/python/site-packages (from nltk) (0.16.0)
Collecting regex
Using cached regex-2020.7.14.tar.gz (690 kB)
Collecting tqdm
Using cached tqdm-4.48.2-py2.py3-none-any.whl (68 kB)
Building wheels for collected packages: nltk, regex
Building wheel for nltk (setup.py) ... done
Created wheel for nltk: filename=nltk-3.5-py3-none-any.whl size=1434675 sha256=3346ae3d0a1e22416ff021c85299b4f947a3c1981b328a34b345a6c1d4a0b788
Stored in directory: /Users/jingyixie/Library/Caches/pip/wheels/ff/d5/7b/f1fb4e1e1603b2f01c2424dd60fbcc50c12ef918bafc44b155
Building wheel for regex (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/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/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-wheel-76vx3e3i
cwd: /private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/regex/
Complete output (17 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/_regex_core.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/test_regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
running build_ext
building 'regex._regex' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/regex_3
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.8/include/python3.8 -c regex_3/_regex.c -o build/temp.macosx-10.9-x86_64-3.8/regex_3/_regex.o
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: Failed building wheel for regex
Running setup.py clean for regex
Successfully built nltk
Failed to build regex
Installing collected packages: regex, tqdm, nltk
Running setup.py install for regex ... error
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/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/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-record-q0npgwaj/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/regex
cwd: /private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/regex/
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.8
creating build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/_regex_core.py -> build/lib.macosx-10.9-x86_64-3.8/regex
copying regex_3/test_regex.py -> build/lib.macosx-10.9-x86_64-3.8/regex
running build_ext
building 'regex._regex' extension
creating build/temp.macosx-10.9-x86_64-3.8
creating build/temp.macosx-10.9-x86_64-3.8/regex_3
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.8/include/python3.8 -c regex_3/_regex.c -o build/temp.macosx-10.9-x86_64-3.8/regex_3/_regex.o
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 errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/regex/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-install-3evnmx60/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/dt/zf0dkxc169v3vswhdl4q_m740000gn/T/pip-record-q0npgwaj/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/regex Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install --upgrade pip' command.
Then I went and uninstalled python 3.8 and reinstalled it again, but it still gives me the same error. How do I install nltk?