I have the error "error: command '/usr/bin/g++' failed with exit code 1" when trying to install python package QuTip via Juyter notebook:
and below "error: command '/usr/bin/g++' failed with exit code 1"
= = = =
What fixes can be tried for such error?
= = = =
EDIT: From "g++ --version" I got: Apple clang version 16.0.0 (clang-1600.0.26.4) Target: x86_64-apple-darwin24.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin"
= = = =
EDIT 2: Error message from Terminal
qutip/core/data/matmul.cpp:806:10: fatal error: 'algorithm' file not found 806 | #include | ^~~~~~~~~~~ 1 error generated. error: command '/usr/bin/g++' failed with exit code 1 [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for qutip Failed to build qutip ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (qutip)
= = = =
with verbose:
creating build/temp.macosx-10.9-x86_64-cpython-39/qutip/core/data /usr/bin/g++ -std=c++11 -I./qutip/core/data -I/private/var/folders/yx/m2j_vzc92x90rz6pvbtyr5yh0000gp/T/pip-build-env-54zb7hd_/overlay/lib/python3.9/site-packages/numpy/_core/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c qutip/core/data/ptrace.cpp -o build/temp.macosx-10.9-x86_64-cpython-39/qutip/core/data/ptrace.o -w -O3 -funroll-loops -mmacosx-version-min=10.9 qutip/core/data/ptrace.cpp:810:10: fatal error: 'algorithm' file not found 810 | #include | ^~~~~~~~~~~ 1 error generated. error: command '/usr/bin/g++' failed with exit code 1 error: subprocess-exited-with-error × Building wheel for qutip (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip. full command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /var/folders/yx/m2j_vzc92x90rz6pvbtyr5yh0000gp/T/tmpb5xnoy6m cwd: /private/var/folders/yx/m2j_vzc92x90rz6pvbtyr5yh0000gp/T/pip-install-nhnwe50w/qutip_eac9898a4af34fe48af890fadb95feae Building wheel for qutip (pyproject.toml) ... error ERROR: Failed building wheel for qutip Failed to build qutip ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (qutip)
= = = =


%pip install qutip. The magic pip command variation was added in 2019 to ensure the install occurs in the environment where the kernel is running that backs the active notebook. The exclamation point doesn't do that and can lead to ....%pip installcommand here. The second paragraph here goes into more details about why the exclamation point may lead to issues.