ModuleNotFoundError: No module named 'sage'

78 views
Skip to first unread message

ph h

unread,
Apr 28, 2022, 6:57:58 PM4/28/22
to sage-devel
Dear All,

SageMath with "Refactor&Source" was successfully configured and built:

[...].
[sagetex-3.5] Successfully installed sagetex-3.5
[sagetex-3.5] Removing old SageTex version(s)
[sagetex-3.5]
[sagetex-3.5] real      0m15.837s
[sagetex-3.5] user      0m8.516s
[sagetex-3.5] sys       0m4.234s
[sagetex-3.5] Copying package files from temporary location /home/hph/sage-9.6/git/rc2/sage.mod2.make/local/var/lib/sage/venv-python3.10/var/tmp/sage/build/sagetex-3.5/inst to /home/hph/sage-9.6/git/rc2/sage.mod2.make/local/var/lib/sage/venv-python3.10
[sagetex-3.5] Successfully installed sagetex-3.5
[sagetex-3.5] Deleting temporary build directory
[sagetex-3.5] /home/hph/sage-9.6/git/rc2/sage.mod2.make/local/var/lib/sage/venv-python3.10/var/tmp/sage/build/sagetex-3.5
[sagetex-3.5] Finished installing sagetex-3.5
make[2]: Leaving directory '/home/hph/sage-9.6/git/rc2/sage.mod2.make/build/make'

real    991m34.004s
user    523m2.375s
sys     169m30.563s
Sage build/upgrade complete!
make[1]: Leaving directory '/home/hph/sage-9.6/git/rc2/sage.mod2.make'

However, when sage was run, it failed with:

~/sage-9.6/git/rc2/sage.mod2.make$ ./sage
Traceback (most recent call last):
  File "/home/hph/sage-9.6/git/rc2/sage.mod2.make/src/bin/sage-ipython", line 9, in <module>
    from sage.misc.banner import banner
ModuleNotFoundError: No module named 'sage'
~/sage-9.6/git/rc2/sage.mod2.make$

Something missing or broken?

"sage --sdist" now still produces (and overwrting!!! existing) $SAGE_ROOT/tmp/sage-9.6.rc2. It now fails with (instead of "no rule" as before the build):

env SAGE_INSTALL_FETCH_ONLY=yes make --no-print-directory -B SAGERUNTIME= \
        alabaster appdirs appnope arb argcomplete argon2_cffi attrs babel backcall beautifulsoup4 beniget bleach boost_cropped brial bzip2 cddlib certifi cffi charset_normalizer cliquer cmake combinatorial_designs conway_polynomials cppy curl cvxopt cycler cypari cysignals cython dateutil decorator defusedxml distlib docutils ecl eclib ecm elliptic_curves entrypoints fflas_ffpack filelock flint flintqs flit_core fonttools fplll fpylll freetype gap gast gc gcc gengetopt gf2x gfan gfortran giac givaro glpk gmp gmpy2 graphs gsl html5lib iconv idna imagesize iml importlib_metadata importlib_resources ipykernel ipython ipython_genutils ipywidgets jedi jinja2 jmol jsonschema jupyter_client jupyter_core jupyter_jsmol jupyter_sphinx jupyterlab_pygments kiwisolver lcalc libatomic_ops libbraiding libffi libgd libhomfly libpng linbox lrcalc lrcalc_python m4ri m4rie markupsafe mathjax matplotlib matplotlib_inline maxima memory_allocator mistune mpc mpfi mpfr mpmath nauty nbclient nbconvert nbformat ncurses nest_asyncio networkx notebook ntl numpy openblas openssl packaging palp pandocfilters pari pari_galdata pari_seadata_small parso patch pcre pexpect pickleshare pillow pip pkgconf pkgconfig planarity platformdirs pluggy ply polytopes_db ppl pplpy pplpy_doc primecount primecountpy primesieve prometheus_client prompt_toolkit ptyprocess py pybind11 pycparser pycygwin pygments pyparsing pyrsistent python3 pythran pytz pyzmq qhull r readline requests rpy2 rw sagenb_export sagetex scipy send2trash setuptools setuptools_scm setuptools_scm_git_archive setuptools_wheel simplegeneric singular six snowballstemmer soupsieve sphinx sphinxcontrib_applehelp sphinxcontrib_devhelp sphinxcontrib_htmlhelp sphinxcontrib_jsmath sphinxcontrib_qthelp sphinxcontrib_serializinghtml sphinxcontrib_websupport sqlite suitesparse symmetrica sympow sympy tachyon terminado testpath threejs toml tomli tornado tox traitlets typing_extensions tzlocal urllib3 vcversioner virtualenv wcwidth webencodings wheel widgetsnbextension xz zeromq zipp zlib zn_poly
/usr/bin/python3 /home/hph/sage-9.6/git/rc2/sage.mod2.make/build/bin/sage-venv "/var/lib/sage/venv-python3.10"
Traceback (most recent call last):
Traceback (most recent call last):
  File "/home/hph/sage-9.6/git/rc2/sage.mod2.make/build/bin/sage-venv", line 53, in <module>
    c = b.ensure_directories(options.env_dir)
  File "/usr/lib/python3.10/venv/__init__.py", line 116, in ensure_directories
    create_if_needed(env_dir)
  File "/usr/lib/python3.10/venv/__init__.py", line 105, in create_if_needed
    os.makedirs(d)
  File "/usr/lib/python3.10/os.py", line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.10/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/lib/sage'
make[1]: *** [Makefile:2489: /var/lib/sage/venv-python3.10/pyvenv.cfg] Error 1
make: *** [Makefile:2534: download-for-sdist] Error 2

~/sage-9.6/git/rc2/sage.mod2.make$ ls -l /var/lib/sage
ls: cannot access '/var/lib/sage': No such file or directory

Should this be "/home/hph/sage-9.6/git/rc2/sage.mod2.make/local/var/lib/sage" instead:

~/sage-9.6/git/rc2/sage.mod2.make$ ls -l /home/hph/sage-9.6/git/rc2/sage.mod2.make/local/var/lib/sage
total 0
drwxrwxrwx 1 hph hph 4096 Apr 28 16:47 installed
drwxrwxrwx 1 hph hph 4096 Apr 28 05:00 scripts
drwxrwxrwx 1 hph hph 4096 Apr 28 17:06 venv-python3.10

Your help is much appreciated.

Please find attached "config.log" and "installation.log" in a 7z file

Regards,

phiho


ModuleNotFoundError.7z

Matthias Koeppe

unread,
Apr 28, 2022, 7:41:11 PM4/28/22
to sage-devel
We cannot debug branches for you that we cannot see. Open a ticket, push a branch, ask questions there.

ph h

unread,
May 1, 2022, 1:59:59 AM5/1/22
to sage-...@googlegroups.com
Dear All,

> We cannot debug branches for you that we cannot see. 

This is so true, it is hard enough to debug one's own code in  a big system like SageMath, let alone the invisible one.
It was hoped that the pattern of this bug is well known to the experienced SageMath developers.

Please find below the list of files involved. 
Please beware that the code is still unclean with these ad hoc exports:

export MAKE=make
export SAGE_SRC=$SAGE_ROOT/src

SAGE_SRC_BIN=$SAGE_SRC/bin
SAGE_BUILD_BIN=$SAGE_ROOT/build/bin
export PATH=$PATH:$SAGE_SRC_BIN:$SAGE_BUILD_BIN

 
It is suspected that some critical exports are still missing. Some paths are missing? Any ideas 

$SAGE_ROOT:
  • sage.sage.dot      (factored out from original 'sage')
  • sage.sage.mod      (sources 'sage.src.bin.resolvelinks.dot', see below, and 'sage.sage.dot')

$SAGE_ROOT/src/bin:
  • sage.src.bin.resolvelinks.dot         (factored out from  'sage-env')
  • sage.src.bin.sage-env.dot             (factored out from  'sage-env')
  • sage.src.bin.sage-env.mod             (sources 'sage.src.bin.resolvelinks.dot' and 'sage.src.bin.sage-env.dot')
  • sage.src.bin.sage.dot                 (factored out from original 'sage')
  • sage.src.bin.sage.mod                 (sources 'sage.src.bin.resolvelinks.dot' and 'sage.src.bin.sage.dot')
  • sage.src.bin.sage-sage-env-common.dot (common between 'sage.src.bin.sage-env.mod' and 'sage.src.bin.sage.mod')

The final frontier is for 'sage.src.bin.sage-sage-env-common.dot'  to be sourced instead of 'Copied&Pasted' . (smiley)

Please help to debug this structure in the context of SageMath architecture.
Hopefully this would serve as a case study for SageMath modularization towards a minimal SageMath?

> Open a ticket, push a branch...
The mechanics of this operation is currently beyond this hitchhiker. When it is needed, she will need help.
(It seems pushing broken code is not a good idea to her. Is there any way for her to request a peer review to see if it is worth a push?)

Thank you so much for your help and your patience is greatly appreciated.

Regards,

phiho


--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/54e8e7ff-c5a1-4003-9ea8-f36745f0cf1en%40googlegroups.com.

John H Palmieri

unread,
May 1, 2022, 12:27:33 PM5/1/22
to sage-devel
You can run "git diff" and save the results in a file, and then post a link to the file. Then others could apply the patch and try it out.

This also seems like a lot of work to eliminate some minor code duplication, in my opinion.

Matthias Koeppe

unread,
May 1, 2022, 12:44:42 PM5/1/22
to sage-devel
On Saturday, April 30, 2022 at 10:59:59 PM UTC-7 hohoa...@gmail.com wrote:
$SAGE_ROOT/src/bin:
  • sage.src.bin.resolvelinks.dot         (factored out from  'sage-env')
  • sage.src.bin.sage-env.dot             (factored out from  'sage-env')
  • sage.src.bin.sage-env.mod             (sources 'sage.src.bin.resolvelinks.dot' and 'sage.src.bin.sage-env.dot')
  • sage.src.bin.sage.dot                 (factored out from original 'sage')
  • sage.src.bin.sage.mod                 (sources 'sage.src.bin.resolvelinks.dot' and 'sage.src.bin.sage.dot')
  • sage.src.bin.sage-sage-env-common.dot (common between 'sage.src.bin.sage-env.mod' and 'sage.src.bin.sage.mod'
Overall, I'm skeptical that adding all of these files is a good idea.
These files would have to be installed -- and would therefore clutter not only this source directory but also the installation directory.
I think the people who maintain distribution packages would not be happy about this.


ph h

unread,
May 2, 2022, 12:34:09 AM5/2/22
to sage-...@googlegroups.com
Hi,

Thank you for your response.

> This also seems like a lot of work to eliminate some minor code duplication
Besides being error prone (in maintaining duplicates), it seems to start small with just 'resolvelinks', then the whole files ('sage', 'sage-env'), then whole directories?
Furthermore, there may be other reasons to follow good practice in software development?

> You can run "git diff" and save the results in a file
This may not work well because there are new files that are not under source control?
Maybe she can just zip it up and send it out when it is a bit cleaner?

Thank you so much for your thoughts and help.

Regards,

phiho


ph h

unread,
May 2, 2022, 12:48:01 AM5/2/22
to sage-...@googlegroups.com
Hi,

"""
Overall, I'm skeptical that adding all of these files is a good idea.
These files would have to be installed -- and would therefore clutter not only this source directory but also the installation directory.
I think the people who maintain distribution packages would not be happy about this.
:::

Well, everything has its price, what is the price for an extensible minimal 'sage'?

All these things seem to be almost working now. A new build just completed, and, hooray:

image.png

Would you please kindly try it out. What do you think of this " /doesnotexist/python3: bad interpreter: No such file or directory"

Thank you for your help.

Regards,

phiho


--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.

Matthias Koeppe

unread,
May 2, 2022, 12:53:27 AM5/2/22
to sage-devel
On Saturday, April 30, 2022 at 10:59:59 PM UTC-7 hohoa...@gmail.com wrote:

> Open a ticket, push a branch...
The mechanics of this operation is currently beyond this hitchhiker. When it is needed, she will need help.
(It seems pushing broken code is not a good idea to her. Is there any way for her to request a peer review to see if it is worth a push?)

Peer review takes place on the ticket, not before. 



Reply all
Reply to author
Forward
0 new messages