Installing sagemath on macOS

352 views
Skip to first unread message

Sai Chandhrasekhar

unread,
Feb 5, 2024, 4:26:31 PM2/5/24
to sage-devel
Hello,

When I tried to run python3 -m pip install sage_conf, I got this error message from config.log. I tried to change to GCC but then I got a message that Sage cannot be built on macOS with GNU's gcc. Any suggestions on what to do would be appreciated.
configure:6595: x86_64-apple-darwin13.4.0-clang -V >&5
clang-16: error: argument to '-V' is missing (expected 1 value)
clang-16: error: no input files
configure:6606: $? = 1
configure:6595: x86_64-apple-darwin13.4.0-clang -qversion >&5
clang-16: error: unknown argument '-qversion'; did you mean '--version'?
clang-16: error: no input files
configure:6606: $? = 1
configure:6595: x86_64-apple-darwin13.4.0-clang -version >&5
clang-16: error: unknown argument '-version'; did you mean '--version'?
clang-16: error: no input files

Matthias Koeppe

unread,
Feb 5, 2024, 4:49:02 PM2/5/24
to sage-devel
We would need to see the full logs

dan...@gmail.com

unread,
Feb 5, 2024, 4:58:54 PM2/5/24
to sage-devel
You could just use Sage_macOS, quick and easy!

Dima Pasechnik

unread,
Feb 5, 2024, 5:48:08 PM2/5/24
to sage-...@googlegroups.com


On 5 February 2024 21:58:54 GMT, "dan...@gmail.com" <dan...@gmail.com> wrote:
>You could just use Sage_macOS
><https://github.com/3-manifolds/Sage_macOS/releases/tag/v2.2.0>, quick and
>easy!

for Sage development, you need a source install.

Sai Chandhrasekhar

unread,
Feb 5, 2024, 5:58:36 PM2/5/24
to sage-devel
config.log

Sai Chandhrasekhar

unread,
Feb 6, 2024, 2:38:08 PM2/6/24
to sage-devel
How do I change clang to GCC? 

Matthias Koeppe

unread,
Feb 6, 2024, 3:01:03 PM2/6/24
to sage-devel
According to your config.log, the run of "configure" succeeded. 
That config.log contains error messages from various compiler invocations is a normal part of the configure process.

What is the actual problem that you encountered?


Dima Pasechnik

unread,
Feb 6, 2024, 3:07:12 PM2/6/24
to sage-...@googlegroups.com


On 6 February 2024 16:50:13 GMT, Sai Chandhrasekhar <skchandh...@gmail.com> wrote:
>How do I change clang to GCC?

hmm, what do you mean? You cannot build Sage on macOS with gcc (not "gcc" the alias of clang, but real gcc from gcc.gnu.org project).

The problem is that gcc cannot compile some of macOS headers.

Sai Chandhrasekhar

unread,
Feb 6, 2024, 3:15:08 PM2/6/24
to sage-devel
When I ran python3 -m pip install sage_conf I got this error message:

Error building Sage.

      

      The following package(s) may have failed to build (not necessarily

      during this run of 'make all-build'):

      

      * package:         gf2x-1.3.0

        last build time: Feb 6 14:07

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/gf2x-1.3.0.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/gf2x-1.3.0

      

      * package:         cddlib-0.94m

        last build time: Feb 6 14:07

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/cddlib-0.94m.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/cddlib-0.94m

      

      * package:         cliquer-1.22

        last build time: Feb 6 14:07

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/cliquer-1.22.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/cliquer-1.22

      

      * package:         libatomic_ops-7.8.0

        last build time: Feb 6 14:07

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/libatomic_ops-7.8.0.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/libatomic_ops-7.8.0

      

      * package:         m4ri-20200115

        last build time: Feb 6 14:07

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/m4ri-20200115.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/m4ri-20200115

      

      * package:         ecm-7.0.5

        last build time: Feb 6 14:07

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/ecm-7.0.5.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/ecm-7.0.5

      

      * package:         info-6.8

        last build time: Feb 6 14:07

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/info-6.8.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/info-6.8

      

      * package:         pari-2.15.4

        last build time: Feb 6 14:08

        log file:        /Users/user/.sage/sage-10.2-Darwin-x86_64/logs/pkgs/pari-2.15.4.log

        build directory: /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/pari-2.15.4


For those packages the following error message was printed earlier: 

configure: error: C compiler cannot create executables


Matthias Koeppe

unread,
Feb 6, 2024, 5:22:59 PM2/6/24
to sage-devel
Could you post one of these log files please? For example info-6.8.log

And could you try "python3 -m pip install --pre sage_conf" also?

Sai Chandhrasekhar

unread,
Feb 6, 2024, 5:36:21 PM2/6/24
to sage-devel
libatomic_ops-7.8.0.log

Matthias Koeppe

unread,
Feb 6, 2024, 6:14:56 PM2/6/24
to sage-devel
and /Users/user/.sage/sage-10.2-Darwin-x86_64/local/var/tmp/sage/build/libatomic_ops-7.8.0/src/config.log 
please

Sai Chandhrasekhar

unread,
Feb 6, 2024, 6:54:11 PM2/6/24
to sage-devel
config.log

Sai Chandhrasekhar

unread,
Feb 6, 2024, 7:10:53 PM2/6/24
to sage-devel
I also tried to run the install command again with the --pre flag and got the same result. 

Matthias Koeppe

unread,
Feb 7, 2024, 12:06:12 PM2/7/24
to sage-devel
Thanks for sharing these logs.
The key failure is here:

configure:3938: x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -isystem /Users/user/anaconda3/include -D_FORTIFY_SOURCE=2 -isystem /Users/user/anaconda3/include -L/Users/user/.sage/sage-10.2-Darwin-x86_64/local/lib -Wl,-ld_classic,-rpath,/Users/user/.sage/sage-10.2-Darwin-x86_64/local/lib -L/Users/user/.sage/sage-10.2-Darwin-x86_64/local/lib -Wl,-ld_classic,-rpath,/Users/user/.sage/sage-10.2-Darwin-x86_64/local/lib -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/user/anaconda3/lib -L/Users/user/anaconda3/lib conftest.c  >&5
ld: library not found for -ld_classic
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

What's happening here is that a workaround that we use on macOS for compilation with XCode is incompatible with the conda toolchain.
I have a fix for this in https://github.com/sagemath/sage/pull/37237

For now, if you want to use the installation method using "pip install sage_conf", deactivate conda first.
Or alternatively if you want to use conda, use one of the installation methods described in https://doc.sagemath.org/html/en/installation/conda.html

Sai Chandhrasekhar

unread,
Feb 7, 2024, 3:10:21 PM2/7/24
to sage-devel
I am still getting the same error. In the config.log files, I see this: x86_64-apple-darwin13.4.0-clang: command not found. I have tried uninstalling and reinstalling Xcode and the Xcode command line tools, but I still get the same result.
config.log
info-6.8.log

Matthias Koeppe

unread,
Feb 7, 2024, 4:13:27 PM2/7/24
to sage-devel
To start from scratch in this mode of installation, you will need to remove the directory "/Users/user/.sage/sage-10.3.beta7-Darwin-x86_64/"

Sai Chandhrasekhar

unread,
Feb 8, 2024, 11:38:27 AM2/8/24
to sage-devel
I was able to install sage_conf successfully, but when I run, "python3 -m pip install $(sage-config SAGE_SPKG_WHEELS)/*.whl sage_setup", I get the following error messages: 

zsh: command not found: sage-config

zsh: no matches found: /*.whl


Matthias Koeppe

unread,
Feb 8, 2024, 1:27:29 PM2/8/24
to sage-devel
That's great progress. 

Did pip issue any warnings when you installed sage_conf?
In particular, it may have warned that the installation location for scripts is not in your PATH.
If so, you can fix it as follows:

export PATH="$(python3 -c 'import sysconfig; print(sysconfig.get_path("scripts", "posix_user"))'):$PATH"

Sai Chandhrasekhar

unread,
Feb 8, 2024, 2:00:52 PM2/8/24
to sage-devel
I did get a warning about that and added it to my PATH before running the command, but I still got the result. I did what you suggested and still got the same error message. 

Sai Chandhrasekhar

unread,
Feb 8, 2024, 2:46:26 PM2/8/24
to sage-devel
I was able to get it to work. I found out I added the wrong location to PATH. I fixed it and got the command to work. 

Sai Chandhrasekhar

unread,
Feb 8, 2024, 4:21:32 PM2/8/24
to sage-devel
When running python3 -m pip install --no-build-isolation sagemath-standard I got this error message:

clang -bundle -undefined dynamic_lookup -g -L/Users/user/.sage/sage-10.3.beta7-Darwin-x86_64/local/lib -Wl,-rpath,/Users/user/.sage/sage-10.3.beta7-Darwin-x86_64/local/lib build/temp.macosx-10.9-universal2-cpython-311/build/cythonized/sage/monoids/free_abelian_monoid_element.o -lgmp -o build/lib.macosx-10.9-universal2-cpython-311/sage/monoids/free_abelian_monoid_element.cpython-311-darwin.so -lpari

      error: command '/usr/bin/clang' failed with exit code 1

      Exception ignored in: <function Pool.__del__ at 0x11ce2dee0>

      Traceback (most recent call last):

        File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/pool.py", line 271, in __del__

          self._change_notifier.put(None)

        File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/queues.py", line 377, in put

          self._writer.send_bytes(obj)

        File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/connection.py", line 199, in send_bytes

          self._send_bytes(m[offset:offset + size])

        File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/connection.py", line 410, in _send_bytes

          self._send(header + buf)

        File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/connection.py", line 367, in _send

          n = write(self._handle, buf)

              ^^^^^^^^^^^^^^^^^^^^^^^^

      OSError: [Errno 9] Bad file descriptor


Matthias Koeppe

unread,
Feb 8, 2024, 5:43:46 PM2/8/24
to sage-devel
You can try if 'export MAKE="make -j4"' fixes this

Sai Chandhrasekhar

unread,
Feb 8, 2024, 7:23:24 PM2/8/24
to sage-devel
I got rid of that error message but I still get a failure to build the wheel for sagemath-standard. Here's the terminal output I got:
Terminal Saved Output.txt.zip

Matthias Koeppe

unread,
Feb 9, 2024, 1:38:29 AM2/9/24
to sage-devel
In the terminal output, it looks like you are installing sagemath-standard 10.2 in an environment with sage-conf 10.3.beta7. Try forcing sagemath-standard==10.3.beta7 (or use the switch "--pre" with pip install).

(In https://github.com/sagemath/sage/pull/37261 I am updating the instructions; you may want to take a look.)

Sai Chandhrasekhar

unread,
Feb 9, 2024, 1:19:28 PM2/9/24
to sage-devel
I was able to install SageMath and get it running. Thank you very much for all of your help.  
Reply all
Reply to author
Forward
0 new messages