Summary: | The sage backend does not starts with sage 6.7 | ||
---|---|---|---|
Product: | [Applications] cantor | Reporter: | Nuno <npinhao> |
Component: | sage-backend | Assignee: | Alexander Rieder <alexanderrieder> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | C.Scharnagl, dns_hmpf, filipe, jackdyson31, marcus.behrendt.86, mathcals, matpen, m_louis30 |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Kubuntu | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/cantor/6586a64bc5ae9d385be68b8500aa6b273aab0c79 | Version Fixed In: | 16.04 |
Sentry Crash Report: | |||
Attachments: | Fixes bug 348128 using non-capturing regex groups. |
Description
Nuno
2015-05-23 07:35:19 UTC
Not 100% sure if it is the same problem, but it sounds similar. With sage 6.6 (provided via the aims ppa) upon initializing a new sage session through cantor a window with "Initializing Session" starts and stays until manually closed. The worksheet stays blank. I tried with the following path settings for sage in cantor: /usr/bin/sage /usr/bin/sagemath /usr/lib/sagemath/sage (the former one link to this one) ~$ cantor --version Qt: 4.8.6 KDE Development Platform: 4.14.2 Cantor: 0.5 ~$ apt-cache policy cantor-backend-sage cantor-backend-sage: Installed: 4:4.14.2-0ubuntu1~ubuntu14.04~ppa1 Candidate: 4:4.14.2-0ubuntu1~ubuntu14.04~ppa1 Version table: *** 4:4.14.2-0ubuntu1~ubuntu14.04~ppa1 0 500 http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu/ trusty/main amd64 Packages 100 /var/lib/dpkg/status […] ~$ apt-cache policy sagemath-upstream-binary sagemath-upstream-binary: Installed: 6.7ppa10revert6.6.aims6-2 Candidate: 6.7ppa10revert6.6.aims6-2 Version table: *** 6.7ppa10revert6.6.aims6-2 0 500 http://ppa.launchpad.net/aims/sagemath/ubuntu/ trusty/main amd64 Packages 100 /var/lib/dpkg/status I get the same behaviour as Dirk Sarpe on Arch Linux, with SageMath version 6.9 and Cantor 0.6. From the command line output, Sage gets started, but Cantor doesn't see it. The last line printed to the terminal is: tmp path: "/home/<me>/.sage/temp/<localhost's name>/<some number>" I don't know whether it comes from SageMath or from Cantor itself. Before that, the "sage:" prompt gets printed with its escape characters escaped (QByteArray dump?) Same behaviour on Ubuntu 15.10 with Cantor 0.6 and sage backend installed via repo, and sage 6.9 installed via aims ppa. Sage works fine when used from command line and via notebook. Also Cantor works well with Maxima backend. When run from terminal, the output is similar to the one reported here: https://forum.kde.org/viewtopic.php?f=21&t=126679 A fix to this bug is going to be committed soon! Git commit 5d185d21431a989055ab4a1501584dbb3ea17842 by Filipe Saraiva, on behalf of Fernando Teles. Committed on 06/02/2016 at 19:38. Pushed by filipesaraiva into branch 'master'. After version 6.5, Sage changed its name to SageMath. So, Cantor supports to newer versions was broken. I changed a string to resolve this issue. FIXED-IN: 16.04 CLOSES: D903 DONE: T1029 CCMAIL: fernandotalves@gmail.com M +1 -1 src/backends/sage/sagesession.cpp http://commits.kde.org/cantor/5d185d21431a989055ab4a1501584dbb3ea17842 Thank you for this fix, you rock ! Hi Fillipe and Fernando, Thank you so much for sorting this out - I have just one ask : I use Ubuntu LTS 14.04 running the excellent KDE desktop. I have (and am locked at) Cantor 0.5. Would be possible to rebuild Cantor 0.5 with this small change and post it as a legacy update for LTS 14.04 ? - it would make a BIG BIG difference to so many of us who use it (I can't upgrade without spending days reorganizing). Cantor makes open mathematics a professional tool for researchwork, so thanks a lot for this great piece of software, Jack Hi Jack, I dont know if the guys will be able to backport the fix, and how long it is going to take. However, you can build a custom version for yourself very easily in the meantime. Here some instructions on how to go about it (run these in the terminal): #make a temporary directory mkdir /tmp/cantor cd /tmp/cantor #download the source of your currently installed cantor package sudo apt-get install debian-keyring sudo apt-get source cantor #the above will create a subdirectory called "cantor-version-number-something" #in there you will find the directory "src" (i cant test right now, so you might have to look for it) #find and edit the file "src/backends/sage/sagesession.cpp" according to the submitted patch #which you can find here: https://quickgit.kde.org/?p=cantor.git&a=commitdiff&h=5d185d21431a989055ab4a1501584dbb3ea17842&hp=ad75e06d3b4317ab45e1b84419b9abb8e33ad6fa #this patch is very simple: you only have to ad "+(|Math)" right after "Sage" on the right line #the "right line" is 194 for the latest cantor, but it might be some lines up or down in your version #now rebuild the package sudo apt-get install dpkg-dev sudo apt-get install build-dep cantor cd "cantor-version-something" dpkg-buildpackage -b -us -uc cd .. #you should now have some debian packages #install the sage backend with sudo dpkg -i cantor-backend-sage*.deb Once again, this is just the temporary workaround that I used until the change will show up in the official Ubuntu repositories. Good luck! Matteo Created attachment 97084 [details] Fixes bug 348128 using non-capturing regex groups. Btw, I spotted a problem in the proposed patch. The current fix uses "(|Math)" to identify a regular expression group that might or might not match "Math". Unfortunately, this is a capturing group, so the QRegExp object will capture "Math". Later on in the code, the captured text are used to identify the current version of Sage. The fix thus interferes with this procedure. The solution I propose (see attachment) uses non-capturing groups to achieve the same result. Extract of command line output with the current patch (using Sage 6.9): [...] found version: ("SageMath Version 6.9", "Math", "6", "9") using an old version of sage: 0 . 6 . Using the old init command [...] AttributeError Traceback (most recent call last) <ipython-input-11-4afd552cec94> in <module>() ----> 1 __CANTOR_IPYTHON_SHELL__.autoindent=False [...] Using the patch I propose: [...] found version: ("SageMath Version 6.9", "6", "9") using the current set of commands [...] Please see attachment. Hi Matteo! Thankyou so much for taking the time to sort that out so nicely. I will start working on it as soon as get a moment. I'll post back what happens here for any observations and results. One small thing - will the new compiled version support both prior and post 6.5 sage additions ? Jack Hi Jack! Yes, although I only tested it with Sage 6.9, the patch should work fine with prior versions. If it does not, feel free to post your observations here and someone will definitely look into the issue. However, do note my second comment that I posted yesterday. In my opinion the original patch is not correct, and with Sage gives error on init. Although it "seems" to work anyway, it might have more subtle implications. My advice is to wait for the decision of the core developers in this regard (I am just a regular user). (In reply to jackdyson31 from comment #7) > Hi Fillipe and Fernando, > > Thank you so much for sorting this out - I have just one ask : > > I use Ubuntu LTS 14.04 running the excellent KDE desktop. I have (and am > locked at) Cantor 0.5. Would be possible to rebuild Cantor 0.5 with this > small change and post it as a legacy update for LTS 14.04 ? - it would make > a BIG BIG difference to so many of us who use it (I can't upgrade without > spending days reorganizing). > Hello jackdyson31, unfortunately you will need to compile Cantor to use this fix. Currently the KDE Applications available in Ubuntu 14.04 official repository is 4.13 version, a very old release. > > Cantor makes open mathematics a professional tool for researchwork, so > thanks a lot for this great piece of software, > Thank you! We love to hear positive feedback! (In reply to matpen from comment #10) > Btw, I spotted a problem in the proposed patch. > > The current fix uses "(|Math)" to identify a regular expression group that > might or might not match "Math". Unfortunately, this is a capturing group, > so the QRegExp object will capture "Math". Later on in the code, the > captured text are used to identify the current version of Sage. The fix thus > interferes with this procedure. > > The solution I propose (see attachment) uses non-capturing groups to achieve > the same result. > Extract of command line output with the current patch (using Sage 6.9): > [...] > found version: ("SageMath Version 6.9", "Math", "6", "9") > using an old version of sage: 0 . 6 . Using the old init command > [...] > AttributeError Traceback (most recent call last) > <ipython-input-11-4afd552cec94> in <module>() > ----> 1 __CANTOR_IPYTHON_SHELL__.autoindent=False > [...] > > Using the patch I propose: > [...] > found version: ("SageMath Version 6.9", "6", "9") > using the current set of commands > [...] > > Please see attachment. Thank you matpen, your approach is better for solve this bug. If you have developer account, could you to commit and push it? If not I can to do it for you. > Thank you matpen, your approach is better for solve this bug. If you have
> developer account, could you to commit and push it? If not I can to do it
> for you.
Sorry Filipe, I do not have a developer account... It would be great if you could take over the tast of pushing the patch.
Thank you!
Git commit 6586a64bc5ae9d385be68b8500aa6b273aab0c79 by Filipe Saraiva. Committed on 09/02/2016 at 16:51. Pushed by filipesaraiva into branch 'master'. Improve the fix using non-capturing groups Thanks matpen@dnet.it! CCMAIL: matpen@dnet.it M +1 -1 src/backends/sage/sagesession.cpp http://commits.kde.org/cantor/6586a64bc5ae9d385be68b8500aa6b273aab0c79 Dear Matteo and Filipe, worked like a charm :-D, sage 7 fires up like it never went out out of fashion on Cantor 4.13 many thanks again!!!! Jack PS can I post the .deb somewhere for other fellows in my predicament? PS @Matteo : sudo apt-get install build-dep cantor --> sudo apt-get build-dep cantor (just in case some other chap tries his hand at it) Jack, If you want to share your .deb, the best way would be to set up your own ppa... but I cannot help you with this, since I never tried. Thank you for spotting my mistype... as I said, I could not test on a real machine when I was writing. So good to have a fix for later reference. I am repeating the updated instructions below, including the updated patch for ease of reference: Instructions to patch cantor to fix this bug, starting from the source of the official cantor package (run these commands in a terminal): #make a temporary directory mkdir /tmp/cantor cd /tmp/cantor #download the source of your currently installed cantor package sudo apt-get install debian-keyring sudo apt-get source cantor #the above will create a subdirectory called "cantor-version-number-something" #in there you will find the directory "src" (i cant test right now, so you might have to look for it) #find and edit the file "src/backends/sage/sagesession.cpp" according to the submitted patch #which you can find here: https://quickgit.kde.org/?p=cantor.git&a=commitdiff&h=6586a64bc5ae9d385be68b8500aa6b273aab0c79&hp=a94da3288f3cda78f9574aa2a7d753f4f70b5db0 #this patch is very simple: you only have to add "(?:Math)?" right after "Sage" on the right line #the "right line" is 197 for the latest cantor, but it might be some lines up or down in your version #now rebuild the package sudo apt-get install dpkg-dev sudo apt-get build-dep cantor cd "cantor-version-something" dpkg-buildpackage -b -us -uc cd .. #you should now have some debian packages #install the sage backend with sudo dpkg -i cantor-backend-sage*.deb Note that these instructions are only useful until the fix for this package will show up in the Ubuntu repositories (or if you are running an old version of cantor which will not be updated). Regards Mat Evening Mat, Cheers for the really great and easy to follow instructions which work like a treat for Cantor 0.5 4.13 - I just hacked them and did the same update on Cantor 0.5, 4.14.3 from Kubuntu Backports (anyone interested in how that happens, get in touch with me and I'll fill you in) No problems for the typo - just said it to help less experienced guys. One other small thing I did: //QRegExp versionExp("Sage\\s+Version\\s+(\\d+)\\.(\\d+)"); QRegExp versionExp("Sage(?:Math)?\\s+Version\\s+(\\d+)\\.(\\d+)"); which is different to the one proposed for the latest version of Cantor (0.6). This fix is a bit of a life saver! Jack PS Having run sage 7.0, 6.10, 6.9 etc in the rebuilt version, sadly the latex output is disabled (if you try show(x^2) for example it just dumps a string), sage 7.0 on Cantor 0.5 is a HUGE improvement and very powerful. I had the same problem on ubuntu 14.04, and to save the trouble of rebuilding Cantor I created the following shell script and set it as Cantor's sage path: echo "┌────────────────────────────────────────────────────────────────────┐" echo "│ Sage Version 6.8, Release Date: 2015-07-26 │" sage "$@" @mathcals@outlook.com absolutely brilliant solution, should work out on other versions too - if you have kubuntu backports installed then doing a rebuild is a nightmare. Many thanks ! I still have the same problem with Cantor 0.6 in Kubuntu 16.04 :-( Expected, because Kubuntu 16.04 only has KDE Applications 15.12. Please use a newer version, or use backport PPAs. (In reply to Christoph Feck from comment #24) > Expected, because Kubuntu 16.04 only has KDE Applications 15.12. Please use > a newer version, or use backport PPAs. Oh okay, thank you for you help. @christopher this might be useful (and a lot better): https://github.com/sagemathinc/smc/tree/master/src/dev/docker regards, Jack |