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
mathics crashes with KeyError: 'System`MakeBoxes' #1169
Comments
TL;DR remove all mathics packages before installing first.
then check that everything is gone including what is in I will guess that you have a mixture of mathics installed using I see above In the short term there are going to be API mismatches as we try to reorganize things. In theory the package versioning should catch this. In practice things are a bit too complex and mistakes in the past have been made (which can't be fixed if you have those installed). Therefore it is best to delete old versions before installing a newer or different version. |
Sorry for the confusion. I didn't have any Mathics versions installed before installing via pip. I'm fairly sure that there is no mixture of mathics versions on my machine.
Here is the log output when building mathics
|
Well, I am at a loss here. I have uninstalled and installed from the released sources with Python 3.8.8 and I don't get what you see. Let's start out with :
When you run Python 3.8.8 on that file alone: I can get this kind of failure if I remove Other than that, my recommendation is to use the docker images, or the condaforge images if PyPI isn't working out. One other thing to note. |
Sorry for the late reply Just to understand it better, what is the preferred way to install the dev version locally? Running
which is expected I guess, since I'm not going to run that with superuser permissions. This is why I used pip with the |
I guess that confirms that when you ran (I should mention that in a number of the earlier reports while having some details haven't had enough details. Decades ago Richard Stallman wrote something really good about how to report a bug. See for exmple. https://www.gnu.org/software/gnats/doc/gnats-4.1.999/html_node/Helpful-hints.html)
I don't know that there is an "offical" way. Personally I use pyenv: Finally, I should mention that interestingly I got that same exact "Key Error" message the other day. But what was going on there was that one of the python modules under bultins had some stray characters I inadvertently added, so some of the builtin modules didn't load. There was no error given in module loading - modules get discovered in the filesystem and are loaded automatically without having an explicit "import" of fixed file filenames. So instead of a Python syntax error message, instead I got this error. Generalizing from this, if one of the "builtin" modules is mismatched in source code (it might be valid Python in some context but not valid from the context from which it was loaded though) then you can get this error. |
This makes me think that it would be a good idea to add some checks on the mechanism of loading builtin modules, at least to show a warning when a module is not loaded, or mismatch the version. |
Yep, and it might already - I was in a rush so I didn't have time to investigate. It is just that this is what thought was probably going on. |
I really don't know what "old code from somwhere" is being picked up here, but if the problem |
@vsht, we have been doing a huge refactory of the project, so several pieces that used to be in someplace, now are in other places. When you download and install the code several times, often it happens that different (incompatible) versions coexist in your system. It can happen then that the Python interpreter gets confused, and load parts of incompatible libraries at a time, without a warning. We hope before the next release we are going to be able to handle this kind of issue. |
@mmatera That's fine, I'll figure something out. At least I can now run Mathics in a virtual Ubuntu machine, but I'm still confused I've just tried to load our FeynCalc package into Mathics, which resulted into a crash :). Now I see that it's because the I guess a lot of those missing functions could be acutally implemented using the existing WL routines already available in Mathics. |
Actually, we are working on that. If you have a list of missing symbols needed for that package, please let us know as a new issue. |
If I find some time, I'll try to write a small "bootstrap" package to load the main package. Would be cool to have |
This is a part of a broader problem I would like to see fixed. See: #1130 Also, overall I would like to see more packages like FeynCalc able to use Mathics. At some point I'd like to start a list registry somehwere of packages we can use. And maybe even hook into http://packagedata.net Unfortunately, almost always we just don't have enough done yet. So thanks for undertaking this! And thanks for not giving up on us just yet. |
If there is a way you can allow me to login to that computer, I'll debug the setup to see what's wrong some weekend. You can contact me privately at rocky@gnu.org and and/or add this public key to to an authorized_keys file to allow ssh access.
|
Hi, I've got the exactly same issue trying to install Mathics into Sage via
So it obviously is not just relateted to Fedora 32. Is there already a known workaround? |
What we have come to learn is that this message generally indicates that one of the Python builtin modules failed to load. And there are many reasons a there are reasons why Python might not be able to import a module (which is what is in fact what is going on underneath). In #1175 @mmatera improved error messaging when things fail to load. So if you can try with a development version we might be able to see more information about what went wrong here. In not too long a time, we should have another release out. Going in the other direction, going back a version to 1.1.1 (asssuming you were installing Mathics 2.0.0) might work since life was simpler then. |
If you still need to debug this: The issue is reproducible on Ubuntu systems, as well (for example LinuxMint 19.1). Especially you can have a look at it using the Sage development Docker image
It will drop you in a bash shell where you can run Sage 9.3.beta8 (just type BTW: The background for my attempts comes from a question I was asked last week when I talked about Sage in a knot theorists seminary at the University of Regensburg. One classical software package for knot theorists is the Mathematica package KnotTheory. The question was, if it can be used inside Sage, as well. This reminded me in your Talk on the Sage Days 110. I must confess that I have absolutely no experiences with Mathematica since I haven't access to a licensed system, right now. So I have no idea if it is realistic to have this package running on Mathics. After the problem I reported here, I tried to read the package into Mathics using your Docker image
Are these just minor problems, or is there no chance? |
I will have a look at this, to see the problem. I am not familiarized with the loading mechanism in sage. However, if it uses MathicsSession, the problem could be there: this is a recently implemented feature, and it could have several new bugs. I will check it out.
|
@soehms I installed sage from docker as you suggested but instead of the last released version of Mathics3 (2.0.0) I used the github version like this:
So now we get more information about what is going wrong:
So now the question is why do we get this inside the docker environment? Some other miscellaneous remarks. First of all, when you install the latest version of Mathics3, you are just getting the core library and the most miniimal CLI script, whereas in version 1.1.1 you also the web GUI. In the sage docker image this seems to be preferred because the sage docker image doesn't have the OS support to run mysql and that is needed in the Django interface for it to save its data. If you want to get the maximum number of add-ons installed (which will of course be the hardest since it requires all dependencies) then pip install Second, I as mentioned in the Sage talk, I am (still) very interested in integrating better with Sage. So would like to see this work inside the docker image. It might mean beefing up the docker image in sage, or in the Mathics-omnibus project which builds its own docker image to include a version of sage (or both). Another way to interact might be to add sage as a pymathics module so that inside Mathics we could
|
I think that I've found a solution. First of all, thanks to @mmatera for implementing a debugging output
Now I certainly do have the mpmath library installed, but Fedora ships version 1.1.0, which is apparently insufficient for Mathics.
which forced pip to fetch mpmath 1.2.0. After that I finally was able to load Mathics on Fedora! Yay! |
@vsht This is great! I will change the minimum dependency for mpmath as suggested above. |
Improve installation on Fedora and sage's docker environment. Fixes #1169 (again)
@soehms using mmpath>=1.2.0 (or the current github master) should allow you to use mathics inside of the sage docker container as well. (Or at least it worked for me.) |
Many thanks! BTW, speaking of running FeynCalc on Mathics, it seems that Mathics doesn't support the https://reference.wolfram.com/language/ref/Read.html
Here is a short example
This part is needed in the package loader code which essentially reads definitions from many different files and puts them into the FeynCalc context. PS Probably I should better create a separate issue for FeynCalc on Mathics where one can discuss other things missing and possible workarounds. |
Ok, then I'll continue there. |
It seems that I need more advice to be successful, as well. In the Docker container of Sage I invoked the installation of Mathics in exactly the same way, as you did. According to the messages mpmath 1.1.0 has been upgraded to 1.2.1. But the bug still shows:
Indeed, the attribute
What did I do wrong? What else should I do?
Once the Docker version is up and running I'll try running Mathics on my own Sage installs and checking these things out
That sounds interesting. I am not a core developer of Sage (I am contributing to Sage just since 2018 in my leisure-time), but I appreciate everything that improves the interaction between open source CAS. As soon as I'll be able to learn more about Mathics (and Wolfram Language), I will see how I can support this. From the viewpoint of Sage an interface to Mathics in a similar way as for example to Gap or Singular could be a good enhancement, too. If this will successfully enable integration of functionality from packages written in Wolfram Language such at the mentioned |
I can't spend time on this today, but it is clear that this is a Sage and mpmath interaction problem. If you go into the Python 3.9 from the docker container and import mpmath you won't have a problem:
And if you look at
I am not sure what the I'd ask on Sage to get more understanding of what's up and what should be done. |
|
@soehms In commit f81d0c5 the problems Mathics was having using sage mpmath from inside sage should be addressed. So if you run |
Yes, it works! Great, then I can check it out next week! Many thanks! |
FYI: I made a start to have such an interface realized (see Trac Ticket #31778). I'll be waiting for your comments in that Trac ticket before I will announce it on sage-devel. |
As I wrote in https://trac.sagemath.org/ticket/31778#comment:3 :
|
Thanks for your immediate answer and the offer to help. But please, just call me Sebastian! I just started a sage-devel thread about this! |
Hi,
I apologize if I overlooked something, but on my system (Fedora 32) upon compiling Mathics
from git via
pip3 install -e . --user
, runningmathics
leads to the following errorThe same happens if I install mathics directly via pip using
which is what I initially did. Am I doing something wrong?
Cheers,
Vladyslav
The text was updated successfully, but these errors were encountered: