Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

SageMath Console not displaying the "sage:" prompt #58

Open
Weierstrash opened this issue Mar 17, 2021 · 22 comments
Open

SageMath Console not displaying the "sage:" prompt #58

Weierstrash opened this issue Mar 17, 2021 · 22 comments

Comments

@Weierstrash
Copy link

I recently downloaded version 9.2 SageMath for my windows 10 laptop. However, when I try to open the SageMath console, it doesn't display the "sage:" prompt and is stuck on the following screen:
Screenshot (13)

Can someone tell me what's going on?

@Weierstrash
Copy link
Author

update: I've waited for an hour and it's still not showing the prompt :(

@embray
Copy link
Contributor

embray commented Mar 17, 2021

@Weierstrash Some antivirus programs interfere with Sage. Do you have any running?

@Weierstrash
Copy link
Author

@Weierstrash Some antivirus programs interfere with Sage. Do you have any running?

thanks for the reply. I had avast running but I disabled it. The issue still persists. Should I completely uninstall the antivirus?

@Weierstrash
Copy link
Author

update: I've completely uninstalled the antivirus and restarted my laptop; the issue still persists.

@embray
Copy link
Contributor

embray commented Mar 22, 2021

@Weierstrash You don't need to fully remove or even disable your antivirus. Avast has been a problem in the past with quarantining false positives from Sage. You can read these instructions on how to add a directory to be excluded from Avast's scans, and should apply it to the directory where Sage is installed (typically something like C:\Users\YourUsername\AppData\Local\Sagemath 9.2 I think).

Chances are it deleted/quarantined some files, so the best thing to do is add an exclusion, then re-install Sage.

@Weierstrash
Copy link
Author

This is what I did: I completely uninstalled the antivirus, then re-installed sage. Unfortunately, the issue still persists.

@embray
Copy link
Contributor

embray commented Mar 22, 2021

That is bizarre. Did you have a previous Sage version that you were already using previously?

If you run the "Sage Shell" shortcut does the shell prompt come up? If so, what happens if you run sage from there?

@Weierstrash
Copy link
Author

I'm installing sage for the first time on my laptop. When I run the "Sage Shell", the prompt doesn't show up. The same happens when I try to open "Sage Notebook Server". I just hope I don't have to reinstall windows to fix this :(

@embray
Copy link
Contributor

embray commented Mar 23, 2021

I just hope I don't have to reinstall windows to fix this

Well, no, don't do that. But that the shell prompt doesn't even come up suggests the problem is with something beyond sage.

If you just install plain cygwin by itself, are you able to launch the cygwin shell? (Sage for Windows is really just a distribution of Cygwin with Sage included).

@Weierstrash
Copy link
Author

I'll try doing that. Meanwhile, I think the following observation might be of some use: when I try to close "SageMath 9.2", the following prompt shows up
Screenshot (16)

@embray
Copy link
Contributor

embray commented Aug 25, 2021

I don't think so--that's normal as far as I can tell.

@guraltsev
Copy link

guraltsev commented Oct 10, 2021

I am having the same problem and I have just the plain windows defender antivirus on Windows 10. When I run SageMath it opens a window and nothing happens. The only thing that can shed light on this might be the following lines from the task manager that shows that ccache is hard at work...

image

image

@embray
Copy link
Contributor

embray commented Oct 11, 2021

@guraltsev Thank you for the insight. That's very strange. I'm not sure why ccache would be running at all. It would have to be because something is calling gcc (to which ccache is linked), but I'm not sure why anything would be doing that during startup.

If you run the "SageMath Shell" shortcut (I think it's called) which just opens a bash shell, can you see if there's a ccache directory in your home directory?

$ ls ~/.ccache

And if so, try deleting that and see if helps anything:

$ rm -rf ~/.ccache

@guraltsev
Copy link

I removed the .ccache directory in my home c:\Users\guraltsev\ (I am on Windows). Then I reinstalled SageMath 9.3 that I had removed.

I ran SageMath 9.3 Shell desktop shortcut and this is the result for the first 5 min:

image

The .ccache directory has been created and contains:

guraltsev@Cauchy:~/.ccache$ ls -laR
.:
total 25
drwxrwxr-x+ 1 guraltsev None  0 Oct 11 14:34 ./
drwxr-x---+ 1 guraltsev None  0 Oct 11 14:34 ../
drwxrwxr-x+ 1 guraltsev None  0 Oct 11 14:34 2/
-rw-rw-r--+ 1 guraltsev None 16 Oct 11 14:34 ccache.conf

./2:
total 0
drwxrwxr-x+ 1 guraltsev None 0 Oct 11 14:34 ./
drwxrwxr-x+ 1 guraltsev None 0 Oct 11 14:34 ../

with the only nonempty file having the contents:

guraltsev@Cauchy:~/.ccache$ cat ccache.conf
max_size = 4.0G

The information for the ccache process is as follows:
image

Attempting to close the shell gives this:

image

So it does seem that ```gcc`` is running, as you supposed.

Let me know if I can provide you with any other information.

@guraltsev
Copy link

Also, some other things about my Windows 10 installation:

I do not have cygwin installed (though I think I did some time ago and it worked).

I have msys2 installed and it works perfectly.

I tried disabling Windows defender (antivirus) and nothing changes.

@guraltsev
Copy link

I just tried the same thing on a different windows machine and the problem is the same.

To be fair, though, the configurations of the two machines are similar (not identical).

@embray
Copy link
Contributor

embray commented Oct 14, 2021

@guraltsev Ah, your sleuthing at least reveals why the heck gcc is being run at all, which was confusing me. It happens during setup of the Sage shell environment, in a line that runs gcc -print-prog-name=as.

That does not explain why gcc is freezing, especially on such a trivial command.

What happens if, after launching the shell, you hit Ctrl-C a couple times? Do you get a shell prompt? If so, what happens when you run gcc -print-prog-name=as at the shell?

@guraltsev
Copy link

Ctrl-C just closes the window.

@embray
Copy link
Contributor

embray commented Oct 18, 2021

@guraltsev What if you run mintty directly?

@guraltsev
Copy link

So, I launched the mintty sage by running the same command as in the sage shortcut:

"C:\Users\guraltsev\tools\SageMath 9.3\runtime\bin\mintty.exe" -t 'SageMath 9.3 Shell' /bin/bash  --login

This gives me a tty prompt

image

When running

gcc -print-prog-name=as

it gives the output

/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/as.exe

Now, if I enable xtrace in bash and run /opt/sagemath-9.3/sage -sh 2>err.log
I get the trace that I am attaching.
err.log

@embray
Copy link
Contributor

embray commented Oct 20, 2021

I think the problem definitely seems related to ccache for some reason.

What if you set the environment variable:

export CCACHE_DISABLE=1

and then run

/opt/sagemath-9.3/sage

?

@guraltsev
Copy link

guraltsev commented Oct 22, 2021

It works! So, now what?

Edit:

I realize that the original might have come off as rude. I wanted to say that with your suggestion of export CCACHE_DISABLE=1 the program works like it should. What should one do now. I have temporarily solved by just modifying the shortcut making it

'export CCACHE_DISABLE=1 ; /opt/sagemath-9.3/sage --notebook jupyter'

(for e.g. the sage notebook).

Please let me know if I can further debug and provide information about my system to troubleshoot the issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants