I have been trying to install the "FastText" library on macOS but I keep encountering a Runtime error.
System - MacOS: 13.0.1 (22A400)
Python Version: 3.10
IDE: Pycharm
I tried installing it from Pycharm but it did not work, then i tried using the Terminal and this is what i got.
pip3 install fasttext and sudo pip3 install fasttext
all resulted with the same error below:
Using cached fasttext-0.9.2.tar.gz (68 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pybind11>=2.2 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (2.10.2)
Requirement already satisfied: setuptools>=0.7.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (65.5.0)
Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from fasttext) (1.21.4)
Building wheels for collected packages: fasttext
Building wheel for fasttext (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [67 lines of output]
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-310
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/FastText.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/util.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_script.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_configurations.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
running build_ext
creating var
creating var/folders
creating var/folders/xg
creating var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn
creating var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpejxme0zs.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpejxme0zs.o -stdlib=libc++
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpyu7_bprq.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmpyu7_bprq.o -stdlib=libc++ -mmacosx-version-min=10.7
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 168, in <module>
setup(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 131, in build_extensions
raise RuntimeError(
RuntimeError: libc++ is needed! Failed to compile with -stdlib=libc++ -mmacosx-version-min=10.7 and -stdlib=libc++.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for fasttext
Running setup.py clean for fasttext
Failed to build fasttext
Installing collected packages: fasttext
Running setup.py install for fasttext ... error
error: subprocess-exited-with-error
× Running setup.py install for fasttext did not run successfully.
│ exit code: 1
╰─> [66 lines of output]
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running install
/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.macosx-10.9-universal2-cpython-310
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
copying python/fasttext_module/fasttext/FastText.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/util.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
copying python/fasttext_module/fasttext/util/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/util
creating build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_script.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/__init__.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
copying python/fasttext_module/fasttext/tests/test_configurations.py -> build/lib.macosx-10.9-universal2-cpython-310/fasttext/tests
running build_ext
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7pgbysh_.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7pgbysh_.o -stdlib=libc++
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c /var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7hnnqnja.cpp -o var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/tmp7hnnqnja.o -stdlib=libc++ -mmacosx-version-min=10.7
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 168, in <module>
setup(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
return run_commands(dist)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/install.py", line 68, in run
return orig.install.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/install.py", line 698, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
super().run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
_build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
self.build_extensions()
File "/private/var/folders/xg/jxm9dqwn5k3f4m0ns9rwyldw0000gn/T/pip-install-mv_4oqbh/fasttext_1af9a5c892f74b668dc43e515183597f/setup.py", line 131, in build_extensions
raise RuntimeError(
RuntimeError: libc++ is needed! Failed to compile with -stdlib=libc++ -mmacosx-version-min=10.7 and -stdlib=libc++.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> fasttext
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure. ```