Ask Your Question

sagemath 9.0 and sagemath 9.3 on my computer crash

asked 2022-05-20 04:29:57 +0200

licheng gravatar image

updated 2022-05-21 08:59:51 +0200

I've been using Sagemath on my computer (windows 10) for a long time, but today I found that sagemath Notebook9.0 or 9.3 all crash. I looked at the following information returned by sagemathshell. It doesn't seem normal. I don't know how to solve it. Even if I reinstalled it, it didn't work.

sagemath 9.2 notebook:

Could not find platform independent libraries <prefix>Could not find platform dependent libraries <exec_prefix>Consider setting $PYTHONHOME to <prefix>[ :<exec_prefix>]

Could not find platform independent libraries <prefix>Could not find platform dependent libraries <exec_prefix>Consider setting $PYTHONHOME to <prefix>[ :<exec_prefix>] Fatal Python error: initfsencoding: Unable to get the locale encodingModuleNotFoundError : No module named 'encodings ' Current thread oxe000000800018040(most recent call first): [main] python3 1975 cygwin_exception: : open_stackdumpfile: Dumping stacktrace to python3.stackdump

[main] python3 1975 cygwin_exception: : open_stackdumpfile: Dumping stacktrace to python3.stackdump


*Don't forget to exit when you are done. Beware:

  • Do not do anything with other copies of Sage on your system. * Do not use this for installing Sage packages using "sage -i" or for
    running "make" at Sage's root directory. These should be done
    outside the Sage shell.

Bypassing shell configuration files...

Note: SAGE_ROOT=/opt/sagemath-9.3

(sage-sh) asus@LAPTOP-PVHBSM6R:~$*

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2022-05-20 18:25:16 +0200

ortollj gravatar image

updated 2022-05-23 06:55:01 +0200

Hi @licheng I will give you the advice to rather do the installation of SageMath under W10 with WSL2 Ubuntu 20.04, follow the instructions below. this will allow you to have 2 shortcuts on your W10 desktop one for Jupyter notebook and the other for Jupyter Lab. Sandy Scott site look also here: Additional Information

image description

I add a summary of the commands to install SageMath with Jupyter notebook only, it's just a simple extraction of the commands from Sandy Scott's site (without Jupyter Lab) below:

edited 2022/05/23

sudo apt update
sudo apt upgrade

sudo apt-get install  bc binutils bzip2 ca-certificates cliquer cmake curl ecl eclib-tools fflas-ffpack flintqs g++ g++ gcc gcc gengetopt gfan gfortran glpk-utils gmp-ecm lcalc libatomic-ops-dev libboost-dev libbraiding-dev libbrial-dev libbrial-groebner-dev libbz2-dev libcdd-dev libcdd-tools libcliquer-dev libcurl4-openssl-dev libec-dev libecm-dev libffi-dev libflint-arb-dev libflint-dev libfreetype6-dev libgc-dev libgd-dev libgf2x-dev libgiac-dev libgivaro-dev libglpk-dev libgmp-dev libgsl-dev libhomfly-dev libiml-dev liblfunction-dev liblrcalc-dev liblzma-dev libm4rie-dev libmpc-dev libmpfi-dev libmpfr-dev libncurses5-dev libntl-dev libopenblas-dev libpari-dev libpcre3-dev libplanarity-dev libppl-dev libprimesieve-dev libpython3-dev libqhull-dev libreadline-dev librw-dev libsingular4-dev libsqlite3-dev libssl-dev libsuitesparse-dev libsymmetrica2-dev libz-dev libzmq3-dev libzn-poly-dev m4 make nauty openssl palp pari-doc pari-elldata pari-galdata pari-galpol pari-gp2c pari-seadata patch perl pkg-config planarity ppl-dev python3 python3 python3-distutils r-base-dev r-cran-lattice singular sqlite3 sympow tachyon tar tox xcas xz-utils xz-utils

cd ~
tar xvf sage-9.5.tar.gz

cd sage-9.5

nano ~/.bashrc # add this line below at the end of bashrc
alias sage=~/sage-9.5/sage

Close ubuntu then reopen it.

nano ~/ contents below:
cd /mnt/c/Documents\ and\ Settings/UserW10
/home/UserLinux/sage-9.5/sage --notebook

chmod ug+x


this below is needed for the desktop shorcut
# where ubuntu.exe is located (for me Ubuntu2004.exe not Ubuntu.exe!):
edit flag offensive delete link more


the only disadvantage of this method is that the make command can take a very long time, for example 6 hours on one of my old PCs and less than 3 hours on my new PC!.

ortollj gravatar imageortollj ( 2022-05-20 18:31:45 +0200 )edit

Thank you for your kind advice. Recent lagging updates to Sagemath for Windows have made me worry about not offering a Windows version of Sagemath in the future.

licheng gravatar imagelicheng ( 2022-05-21 04:15:27 +0200 )edit

where the sage files are located with ubuntu20.04 WSL2 :


where ubuntu.exe is located (for me Ubuntu2004.exe !):

ortollj gravatar imageortollj ( 2022-05-21 19:06:46 +0200 )edit
ortollj gravatar imageortollj ( 2022-05-23 07:03:23 +0200 )edit

you can speed up the make , I have 16 cores so I use make -j32 and the make only lasted half an hour !. as @slelievre told me in this post

ortollj gravatar imageortollj ( 2022-12-10 13:32:29 +0200 )edit

answered 2023-05-06 04:27:45 +0200

licheng gravatar image

updated 2023-05-06 04:42:20 +0200

A late reply, I found that the issue was due to my computer having cygwin installed, which caused a conflict. I encountered the same problem when installing the windows version of Gap as well.

This problem is probably due to using incompatible versions of the cygwin DLL.

We just need to copy the files from cygwin to the corresponding folders (...\SageMath 9.3\runtime\bin) in Sagemath (possibly replacing some files). Considering that Sagemath might not provide Windows binary files in the future, this method is only applicable to sage 9.3 or earlier.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2022-05-20 04:29:57 +0200

Seen: 709 times

Last updated: May 06 '23