Ask Your Question

sagemath : sage test fail

asked 2021-11-27 22:20:15 +0200

manzar gravatar image

updated 2022-09-01 08:19:37 +0200

FrédéricC gravatar image

I got the following error while running the sage -t command.

$ sage -t
Traceback (most recent call last):
  File "/usr/share/sagemath/bin/sage-runtests", line 178, in <module>
    DC = DocTestController(options, args)
  File "/usr/lib/python3/dist-packages/sage/doctest/", line 358, 
in __init__
    for pkg in list_packages('optional', local=True).values():
  File "/usr/lib/python3/dist-packages/sage/misc/", line 236, in 
    for p in os.listdir(SAGE_PKGS):
FileNotFoundError: [Errno 2] No such file or directory: 

I attached the following information about the version:

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04

Python 3.8.10

$ sage
│ SageMath version 9.0, Release Date: 2020-01-01                     │
│ Using Python 3.8.10. Type "help()" for help.                       │
edit retag flag offensive close merge delete


Welcome to Ask Sage! Thank you for your question.

slelievre gravatar imageslelievre ( 2021-11-28 01:54:37 +0200 )edit

How did you install Sage?

What are you trying to test?

slelievre gravatar imageslelievre ( 2021-11-28 01:54:48 +0200 )edit

I install Sage by Linux Package Manager : sudo apt install sagemath . It is the implementation of KYBER algorithm:

manzar gravatar imagemanzar ( 2021-11-28 07:31:41 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2021-11-28 13:55:35 +0200

eric_g gravatar image

updated 2021-11-29 14:44:20 +0200

The Ubuntu package sagemathdoes not offer all the functionalities for advanced use of SageMath, like testing or installing additional packages. I would therefore suggest that you install SageMath in your home directory by downloading the binary image for Ubuntu 20.04 from Simply do

sudo apt-get install python-is-python3
tar jxvf sage-9.4-Ubuntu_20.04-x86_64.tar.bz2
cd SageMath
./sage -n jupyter

Then ./sage -t should work from the directory SageMath. As a bonus, you'll get the latest version of Sage (9.4), while the Ubuntu package is only 9.0.

edit flag offensive delete link more

answered 2021-12-02 05:44:44 +0200

manzar gravatar image

Thank you for your time and thank you for your response. I have tested this solution. It does not work for me. still get errors.

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

1 follower


Asked: 2021-11-27 22:20:15 +0200

Seen: 305 times

Last updated: Dec 02 '21