Score:0

sagemath : sage test fail

pk flag

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

$ sage -t test.py
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/control.py", line 358, 
in __init__
    for pkg in list_packages('optional', local=True).values():
  File "/usr/lib/python3/dist-packages/sage/misc/package.py", line 236, in 
list_packages
    for p in os.listdir(SAGE_PKGS):
FileNotFoundError: [Errno 2] No such file or directory: 
'/usr/share/sagemath/build/pkgs'

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.                       │
└────────────────────────────────────────────────────────────────────┘
sage:         

I have found that this issue is in Debian as well according to the following link: https://www.mail-archive.com/[email protected]/msg1686014.html

N0rbert avatar
zw flag
What is `test.py`? Can you share its contents?
manzar avatar
pk flag
for sure. It is the implementation of KYBER algorithm: https://github.com/fvirdia/lwe-on-rsa-copro
manzar avatar
pk flag
for sure. it is the implementation of KYBER algorithm. https://github.com/fvirdia/lwe-on-rsa-copro
N0rbert avatar
zw flag
You can try to adapt [a workaround](https://github.com/sagemath/sage-numerical-backends-coin/blob/master/setup.py#L22) for your case.
manzar avatar
pk flag
Thank you for your response. I have seen this. I will try it. As I said I have seen that this issue is in Debian. It has been said "which gives an error on Debian unstable as of 2019-12-27", How about Ubuntu?
N0rbert avatar
zw flag
I can reproduce this on Ubuntu 20.04.3 LTS.
manzar avatar
pk flag
Thank you for your response. By "I can reproduce this on Ubuntu 20.04.3 LTS" you mean that you have not received any error? Would you please give me more information on how could I run it?
N0rbert avatar
zw flag
I mean that I have seen original "FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/sagemath/build/pkgs'" error on 20.04.3 LTS. Workaround worked partially, but maybe I'm doing something wrong.
manzar avatar
pk flag
Thank you for your time. I will try it. Just to clarify: I should add: # For the tests class SageTest(TestCommand): def run_tests(self): errno = os.system("PYTHONPATH=`pwd` sage -t --force-lib --optional=sage sage_numerical_backends_coin") if errno != 0: sys.exit(1) Or should I replace the value of: sage_numerical_backends_coin?
N0rbert avatar
zw flag
I tried "PYTHONPATH=\`pwd\` sage -t --force-lib --optional=sage test.py"
manzar avatar
pk flag
Thank you for your time. I tried it. I add the following to the test.py: # For the tests class SageTest(TestCommand): def run_tests(self): errno = os.system("PYTHONPATH=`pwd` sage -t --force-lib --optional=sage test.py") if errno != 0: sys.exit(1) but still received that error.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.