Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Python 3.12 #932

Closed
gujunhk opened this issue Oct 23, 2023 · 6 comments · Fixed by #1065
Closed

Support for Python 3.12 #932

gujunhk opened this issue Oct 23, 2023 · 6 comments · Fixed by #1065

Comments

@gujunhk
Copy link

gujunhk commented Oct 23, 2023

"distutils" has been removed in Python 3.12 and Mathics3 will throw an error that no module named 'disutils'.

Officially support is needed.

@rocky
Copy link
Member

rocky commented Oct 23, 2023

Thanks for the report. Is this something you would be interested in working on?

(I imagine this kind of thing does not require much special knowledge of the code, but is more of a general programming administration kind of thing.)

@mmatera
Copy link
Contributor

mmatera commented Jan 26, 2024

#978 starts with this work. The main problem is an undocumented change in how the recursion limit is fixed.

@Masterxilo
Copy link

Here's some other error that already appears with python 3.10:

pip install mathics
$ mathics
Traceback (most recent call last):
  File "/home/ubuntu/.local/bin/mathics", line 5, in <module>
    from mathics.main import main
  File "/home/ubuntu/.local/lib/python3.10/site-packages/mathics/__init__.py", line 10, in <module>
    import sympy
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/__init__.py", line 49, in <module>
    from .polys import *
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/polys/__init__.py", line 5, in <module>
    from . import polytools
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/polys/polytools.py", line 19, in <module>
    from sympy.polys.polyclasses import DMP
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/polys/polyclasses.py", line 104, in <module>
    from sympy.polys.euclidtools import (
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/polys/euclidtools.py", line 41, in <module>
    from sympy.polys.galoistools import (
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/polys/galoistools.py", line 14, in <module>
    from sympy.ntheory import factorint
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/ntheory/__init__.py", line 20, in <module>
    from .egyptian_fraction import egyptian_fraction
  File "/home/ubuntu/.local/lib/python3.10/site-packages/sympy/ntheory/egyptian_fraction.py", line 6, in <module>
    from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib/python3.10/fractions.py)

https://stackoverflow.com/questions/66174862/import-error-cant-import-name-gcd-from-fractions

@rocky
Copy link
Member

rocky commented Jul 20, 2024

Here's some other error that already appears with python 3.10:

pip install mathics

mathics is the older version. It is no longer maintained; mathics3 is the newer version, but we haven't put out a new release for it in a while. (This has been on my mind and will probably do soonish.)

So in the meantime install from source code:

$ cd Mathics3/mathics-core
$ pip install -e . 
pip install -e . 
Obtaining file:///tmp/Mathics3/mathics-core
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
...

$ mathics
mathics
/tmp/Mathics3/mathics-core/mathics/builtin/files_io/importexport.py:3: SyntaxWarning: invalid escape sequence '\M'
  """

Mathics 7.0.0dev0
on CPython 3.12.3 (main, May  6 2024, 11:37:55) [GCC 13.2.0]
using SymPy 1.13.1, mpmath 1.3.0, numpy 1.26.4, cython Not installed

Copyright (C) 2011-2023 The Mathics Team.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
See the documentation for the full license.

Quit by evaluating Quit[] or by pressing CONTROL-D.

In[1]:= 1+2
1+2
Out[1]= 3

@tueda
Copy link

tueda commented Aug 10, 2024

I tried a fresh installation of version 7.0.0 and encountered the following messages (the following log was with Python 3.10 but the same with Python 3.12):

pip install mathics3
mathics
No module named 'packaging'
    Not able to load mathics.builtin.numbers.numbertheory. Check your installation.
    mathics.builtin loads from /home/tueda/tmp/.venv/lib/python3.10/site-packages/mathics/core/load

    Not able to load mathics.builtin.scipy_utils.integrators. Check your installation.
    mathics.builtin loads from /home/tueda/tmp/.venv/lib/python3.10/site-packages/mathics/core/load

    Not able to load mathics.builtin.scipy_utils.optimizers. Check your installation.
    mathics.builtin loads from /home/tueda/tmp/.venv/lib/python3.10/site-packages/mathics/core/load

Mathics 7.0.0
on CPython 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]
using SymPy 1.12.1, mpmath 1.3.0, numpy 1.26.4, cython Not installed

Copyright (C) 2011-2024 The Mathics Team.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
See the documentation for the full license.

Quit by evaluating Quit[] or by pressing CONTROL-D.

In[1]:=

For the message No module named 'packaging'; Not able to load mathics.builtin.numbers.numbertheory, I indeed found that packaging was missing. Installing it via pip removed that message (but the other two messages remain). It appears that packaging is missing from the dependency list.

@mmatera
Copy link
Contributor

mmatera commented Aug 10, 2024

I tried a fresh installation of version 7.0.0 and encountered the following messages (the following log was with Python 3.10 but the same with Python 3.12):

This dependency was included recently to determine which version of Sympy is installed in the system. This was needed due to recent changes in the Sympy API. For some reason, the CI didn't detect a problem with this (I thought packaging was in the standard library). Adding the package as a dependency should solve the issue.

rocky pushed a commit that referenced this issue Aug 11, 2024
This should fix #932. For some reason, CI does not see any difference,
but it doesn't hurt to add it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants