ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 27 Apr 2020 06:24:09 +0200PyCharm for SageMath on Linuxhttps://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/I am looking for an IDE with syntax highlighting, code completion and debugging support to run SageMath 9.0 with preprocessing on (Arch) Linux.
The two most obvious choices seem to be PyCharm and Eclipse, but PyCharm is not able to do `from sage.all import *` even though my `SAGE_ROOT="/usr"` and I am running pycharm from a `sage -sh` as described in https://ask.sagemath.org/question/39742/make-pycharm-recognise-the-sage-python-interpreter/ or https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/.Sun, 19 Apr 2020 12:45:20 +0200https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/Answer by vdelecroix for <p>I am looking for an IDE with syntax highlighting, code completion and debugging support to run SageMath 9.0 with preprocessing on (Arch) Linux.</p>
<p>The two most obvious choices seem to be PyCharm and Eclipse, but PyCharm is not able to do <code>from sage.all import *</code> even though my <code>SAGE_ROOT="/usr"</code> and I am running pycharm from a <code>sage -sh</code>as described in <a href="https://ask.sagemath.org/question/39742/make-pycharm-recognise-the-sage-python-interpreter/">https://ask.sagemath.org/question/397...</a> or <a href="https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/">https://ask.sagemath.org/question/387...</a>.</p>
https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?answer=50861#post-id-50861If you use sage from the package manager (pacman) then don't use `sage -sh`. It is only intended when Sage is installed from source or precompiled binaries from the SageMath website. If the following works in your Python console
>>> from sage.all import *
Then it should just work the same in PyCharm.Sun, 19 Apr 2020 14:41:50 +0200https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?answer=50861#post-id-50861Comment by TK for <p>If you use sage from the package manager (pacman) then don't use <code>sage -sh</code>. It is only intended when Sage is installed from source or precompiled binaries from the SageMath website. If the following works in your Python console</p>
<pre><code>>>> from sage.all import *
</code></pre>
<p>Then it should just work the same in PyCharm.</p>
https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=51049#post-id-51049Ok. Thank you anyway!Mon, 27 Apr 2020 06:24:09 +0200https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=51049#post-id-51049Comment by TK for <p>If you use sage from the package manager (pacman) then don't use <code>sage -sh</code>. It is only intended when Sage is installed from source or precompiled binaries from the SageMath website. If the following works in your Python console</p>
<pre><code>>>> from sage.all import *
</code></pre>
<p>Then it should just work the same in PyCharm.</p>
https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=50945#post-id-50945Only one problem left: How can I use Sage specific syntax (^ instead of **, for example) in PyCharm when not using `sage -sh`?Thu, 23 Apr 2020 09:11:02 +0200https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=50945#post-id-50945Comment by vdelecroix for <p>If you use sage from the package manager (pacman) then don't use <code>sage -sh</code>. It is only intended when Sage is installed from source or precompiled binaries from the SageMath website. If the following works in your Python console</p>
<pre><code>>>> from sage.all import *
</code></pre>
<p>Then it should just work the same in PyCharm.</p>
https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=50946#post-id-50946Indeed. SageMath has an internal preparser (input commands are transformed before being sent to Python, one of them is the substitution `^` -> `**`). I don't think it is possible to plug that in the Python interpreter. But I believe it is doable with IPython. I am not familiar enough with that process to help you more.Thu, 23 Apr 2020 09:27:34 +0200https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=50946#post-id-50946Comment by TK for <p>If you use sage from the package manager (pacman) then don't use <code>sage -sh</code>. It is only intended when Sage is installed from source or precompiled binaries from the SageMath website. If the following works in your Python console</p>
<pre><code>>>> from sage.all import *
</code></pre>
<p>Then it should just work the same in PyCharm.</p>
https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=50862#post-id-50862The problem was that PyCharm used its own python interpreter, not the /usr/bin/python one. I changed it and now it works.Sun, 19 Apr 2020 15:16:29 +0200https://ask.sagemath.org/question/50859/pycharm-for-sagemath-on-linux/?comment=50862#post-id-50862