Ask Your Question

RecursionError when installing SageMath 8.2

asked 2018-06-10 17:23:32 +0200

Jingguo Yao gravatar image

I downloaded sage-8.2-OSX_10.13.4-x86_64.dmg. Then I ran ./sage from the extracted SageMath directory in a Terminal. Then I got the following error:

Last login: Sun Jun 10 23:17:18 on ttys001 /Users/jing/tools/SageMath/sage ; exit; ➜ ~ /Users/jing/tools/SageMath/sage ; exit; RecursionError: maximum recursion depth exceeded during compilation

It seems that you are attempting to run Sage from an unpacked source tarball, but you have not compiled it yet (or maybe the build has not finished). You should run make in the Sage root directory first. If you did not intend to build Sage from source, you should download a binary tarball instead. Read README.txt for more information.

[Process completed]

I am using macOS 10.13.4. Can anyone help me on this?

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2018-07-09 14:47:40 +0200

Biel Cardona gravatar image

As some other answers pointed out, the problem is that the first time that sage is called, the script is executed. Since in that file, the shebang line reads /usr/bin/env python, the system calls the default python interpreter. The simplest solution is to have python 2.7 installed and change that line to /usr/bin/env python2.7 or directly the path of a python 2.7 interpreter.

edit flag offensive delete link more

answered 2018-06-11 10:58:40 +0200

j.c. gravatar image

On the off-chance you're using Anaconda, try commenting out the export PATH="/anaconda/bin:$PATH" line in the .bash_profile file (and restarting your terminal) before you run Sage for the first time.

You can uncomment it again after sage successfully runs (until you have to rebuild or upgrade Sage).

edit flag offensive delete link more


This fixed this problem for me. Thanks!

blove gravatar imageblove ( 2019-05-13 01:53:22 +0200 )edit

answered 2018-06-16 03:24:59 +0200

Jingguo Yao gravatar image

I finally found that the cause of this problem is that I have used brew to installed python3 and linked python to python3. After I used brew to uninstall python3, the problem is solved.

edit flag offensive delete link more


Note that this path issue only seems to be a problem when running Sage for the first time. You should be able to reinstall python3 again with homebrew and use Sage without any problem (until you upgrade versions).

j.c. gravatar imagej.c. ( 2018-06-16 18:51:28 +0200 )edit

answered 2018-06-11 07:38:03 +0200

You need to copy the SageMath directory to somewhere on your hard drive – you can't just run ./sage from within the directory in the virtual drive that you get when you open up the dmg file. Once you've copied it somewhere and run ./sage, you should see

Rewriting paths for your new installation directory

This might take a few minutes but only has to be done once.

followed by lots of messages like

patching /Users/palmieri/Desktop/SageMath/build/make/Makefile-auto
patching /Users/palmieri/Desktop/SageMath/config.status

At this point, you won't be able to move the SageMath folder – its location has been burned in during the patching process – so pick a good location. (You can always copy a fresh SageMath folder from the dmg file, if you want to start over.)

edit flag offensive delete link more


Given the path shown in the post /Users/jing/tools/SageMath/sage I don't think that the OP is trying to run sage from within the dmg file.

j.c. gravatar imagej.c. ( 2018-06-11 11:01:37 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-06-10 17:23:32 +0200

Seen: 1,571 times

Last updated: Jul 09 '18