1 | initial version |
I can reproduce with - SageMath 9.8 from conda-forge in Ubuntu 22.04. - Firefox installed as a "snap"
Arguably the problem is from Firefox rather than SageMath, as
Two ways around this
Example.
My Firefox is installed using apt install firefox
, which installed it as a "snap":
$ dpkg-query --list firefox
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-=================-============-==============================================
ii firefox 1:1snap1-0ubuntu2 amd64 Transitional package - firefox -> firefox snap
Version of Sage and Python:
sage: print("{}, Python {}.{}.{}".format(version(), *sys.version_info[:3]))
SageMath version 9.8, Release Date: 2023-02-11, Python 3.10.8
Declare "symbolic ring" variables:
sage: x, y = SR.var('x, y')
Define 3d plot:
sage: p = plot3d(x*y^3, (-1, 1), (-1, 1))
Try to view:
sage: p
For me this launches a Firefox tab which tries to access a temporary file and complains:
File not found
Firefox can’t find the file at /tmp/tmp58e2me0a/tmp_68ciixtz.html.
- Check the file name for capitalization or other typing errors.
- Check to see if the file was moved, renamed or deleted.
The problem seems to be that Firefox installed as a "snap"
refuses to open local files in /tmp
.
Save the plot to an html file and open that file:
sage: p.save("myplot.html")
sage: !open myplot.html
That works well for me.
2 | No.2 Revision |
I can reproduce with
- with
Arguably the problem is from Firefox rather than SageMath, as
What happens is:
/tmp then asks your browser to open it
/tmpTwo Three ways around thisthis (including the one suggested by @John Palmieri):
TMPDIR
environment variable set to some directory inside your home directoryExample.
My If Firefox is installed using apt install firefox
, which it might have been installed it as a "snap":
$ dpkg-query --list firefox
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-=================-============-==============================================
ii firefox 1:1snap1-0ubuntu2 amd64 Transitional package - firefox -> firefox snap
$ snap list | grep firefox
firefox 112.0.2-1 2605 latest/stable/… mozilla** -
Version of Sage and Python:Here is what happens in that situation.
Start Sage:
sage: print("{}, Python {}.{}.{}".format(version(), *sys.version_info[:3]))
$ conda activate sage
$ sage
SageMath version 9.8, Release Date: 2023-02-11, released 2023-02-11. Python 3.10.8
3.10.8.
Declare "symbolic ring" variables:variables, define plot, and try to view it
sage: x, y = SR.var('x, y')
Define 3d plot:
sage: p = plot3d(x*y^3, (-1, 1), (-1, 1))
Try to view:
sage: p
For me this launches a Firefox tab which tries to access a temporary file and complains:
File not found
Firefox can’t find the file at /tmp/tmp58e2me0a/tmp_68ciixtz.html.
- Check the file name for capitalization or other typing errors.
- Check to see if the file was moved, renamed or deleted.
The problem seems to be is that Firefox installed as a "snap"
refuses "snap" is set not to open local files in /tmp
.
Save Things work if Sage starts with TMPDIR
set to a subdirectory of the user's home directory.
I created a tmp directory in my home directory:
$ mkdir -p $HOME/tmp
Then things work if I start Sage with this command:
$ TMPDIR=$HOME/tmp sage
or with these two commands:
$ export TMPDIR=$HOME/tmp
$ sage
The "export" command can be included in a file that is run each time a shell is started.
For example,~/.bashrc
if using bash, or ~/.zshrc
if using zsh.
If Sage was started without setting TMPDIR
, we can save the plot to an html file and open that file:
sage: p.save("myplot.html")
sage: !open myplot.html
That works well for me.