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.Fri, 08 Sep 2017 20:23:47 +0200How i use sage with pycharm in Ubuntuhttps://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/ Can anyone please guide me how can i use sage on pycharm.
I'm working on .ipynb files which have some sage command for plotting and mathematics, I want to use them on pycharm, if someone has idea then please share Thu, 07 Sep 2017 15:53:08 +0200https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/Answer by dan_fulea for <p>Can anyone please guide me how can i use sage on pycharm.
I'm working on .ipynb files which have some sage command for plotting and mathematics, I want to use them on pycharm, if someone has idea then please share </p>
https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?answer=38754#post-id-38754(For my taste, eclipse is the better IDE for developing code. There can be very many projects in it... The following is taken from the recommended path to start sage inside eclipse. Well my taste is not changed right in this second, but give me some more...)
The beautiful dark themes and the light interface of pycharm, dedicated to python, made me give it one more serious try. I cannot remember if there are any special configuration steps i did some months ago, but pycharm+sage work today without special effort. Here are the steps just done to run a simple piece of code. This is not really ubuntu, but manjaro, which is not far away, the same should apply in most linux operating systems.
1. Open a terminal and type `sage -sh` in it to get the sage environment. For me:
[dan@k7 ~]$ which pycharm
/usr/bin/pycharm
[dan@k7 ~]$ sage -sh
Starting subshell with Sage environment variables set. Don't forget
to exit when you are done. Beware:
* Do not do anything with other copies of Sage on your system.
* Do not use this for installing Sage packages using "sage -i" or for
running "make" at Sage's root directory. These should be done
outside the Sage shell.
Bypassing shell configuration files...
Note: SAGE_ROOT=/usr
2. From this shell with the `(sage-sh)` prompter start pycharm:
(sage-sh) dan@k7:~$ pycharm &
[1] 30437
3. Inside my pycharm there is now a test file named `test012.py` containing some lines of code from various areas of interest.
from sage.all import *
F = GF(2)
print F
R = PolynomialRing( F, name='X' )
print R
G = GL(3,F)
print G.order()
E = EllipticCurve( GF(2**53), [1,0,0,0,1] )
print "ORDER %s for %s" % ( E.order().factor(), E )
Only the first line is important, `from sage.all import *`. The rest is the test. Results in the pycharm console:
/usr/bin/python2.7 /home/dan/PycharmProjects/test_01/test_012.py
Finite Field of size 2
Univariate Polynomial Ring in X over Finite Field of size 2 (using NTL)
168
ORDER 2^2 * 107 * 21044858204113 for Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in z53 of size 2^53
Process finished with exit code 0
Hope it also works for you like a charm, enjoy!Fri, 08 Sep 2017 03:28:41 +0200https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?answer=38754#post-id-38754Comment by siddiqui.902003 for <p>(For my taste, eclipse is the better IDE for developing code. There can be very many projects in it... The following is taken from the recommended path to start sage inside eclipse. Well my taste is not changed right in this second, but give me some more...)</p>
<p>The beautiful dark themes and the light interface of pycharm, dedicated to python, made me give it one more serious try. I cannot remember if there are any special configuration steps i did some months ago, but pycharm+sage work today without special effort. Here are the steps just done to run a simple piece of code. This is not really ubuntu, but manjaro, which is not far away, the same should apply in most linux operating systems.</p>
<ol>
<li><p>Open a terminal and type <code>sage -sh</code> in it to get the sage environment. For me:</p>
<pre><code>[dan@k7 ~]$ which pycharm
/usr/bin/pycharm
[dan@k7 ~]$ sage -sh
Starting subshell with Sage environment variables set. Don't forget
to exit when you are done. Beware:
* Do not do anything with other copies of Sage on your system.
* Do not use this for installing Sage packages using "sage -i" or for
running "make" at Sage's root directory. These should be done
outside the Sage shell.
Bypassing shell configuration files...
Note: SAGE_ROOT=/usr
</code></pre></li>
<li><p>From this shell with the <code>(sage-sh)</code> prompter start pycharm:</p>
<pre><code>(sage-sh) dan@k7:~$ pycharm &
[1] 30437
</code></pre></li>
<li><p>Inside my pycharm there is now a test file named <code>test012.py</code> containing some lines of code from various areas of interest.</p>
<pre><code>from sage.all import *
F = GF(2)
print F
R = PolynomialRing( F, name='X' )
print R
G = GL(3,F)
print G.order()
E = EllipticCurve( GF(2**53), [1,0,0,0,1] )
print "ORDER %s for %s" % ( E.order().factor(), E )
</code></pre>
<p>Only the first line is important, <code>from sage.all import *</code>. The rest is the test. Results in the pycharm console:</p>
<pre><code>/usr/bin/python2.7 /home/dan/PycharmProjects/test_01/test_012.py
Finite Field of size 2
Univariate Polynomial Ring in X over Finite Field of size 2 (using NTL)
168
ORDER 2^2 * 107 * 21044858204113 for Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in z53 of size 2^53
Process finished with exit code 0
</code></pre></li>
</ol>
<p>Hope it also works for you like a charm, enjoy!</p>
https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?comment=38757#post-id-38757@ dan_fulea Thank you for your reply.
I downloaded the sagemath but but i'm unable to creat shell and this command is not working for me.
sage -sh
can you please explain how i can do this...
to start sage i have to go inside sage folder and with ./sage, sage will work on terminal but not on pycharm.
Please share your idea.
Thank youFri, 08 Sep 2017 09:40:04 +0200https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?comment=38757#post-id-38757Comment by dan_fulea for <p>(For my taste, eclipse is the better IDE for developing code. There can be very many projects in it... The following is taken from the recommended path to start sage inside eclipse. Well my taste is not changed right in this second, but give me some more...)</p>
<p>The beautiful dark themes and the light interface of pycharm, dedicated to python, made me give it one more serious try. I cannot remember if there are any special configuration steps i did some months ago, but pycharm+sage work today without special effort. Here are the steps just done to run a simple piece of code. This is not really ubuntu, but manjaro, which is not far away, the same should apply in most linux operating systems.</p>
<ol>
<li><p>Open a terminal and type <code>sage -sh</code> in it to get the sage environment. For me:</p>
<pre><code>[dan@k7 ~]$ which pycharm
/usr/bin/pycharm
[dan@k7 ~]$ sage -sh
Starting subshell with Sage environment variables set. Don't forget
to exit when you are done. Beware:
* Do not do anything with other copies of Sage on your system.
* Do not use this for installing Sage packages using "sage -i" or for
running "make" at Sage's root directory. These should be done
outside the Sage shell.
Bypassing shell configuration files...
Note: SAGE_ROOT=/usr
</code></pre></li>
<li><p>From this shell with the <code>(sage-sh)</code> prompter start pycharm:</p>
<pre><code>(sage-sh) dan@k7:~$ pycharm &
[1] 30437
</code></pre></li>
<li><p>Inside my pycharm there is now a test file named <code>test012.py</code> containing some lines of code from various areas of interest.</p>
<pre><code>from sage.all import *
F = GF(2)
print F
R = PolynomialRing( F, name='X' )
print R
G = GL(3,F)
print G.order()
E = EllipticCurve( GF(2**53), [1,0,0,0,1] )
print "ORDER %s for %s" % ( E.order().factor(), E )
</code></pre>
<p>Only the first line is important, <code>from sage.all import *</code>. The rest is the test. Results in the pycharm console:</p>
<pre><code>/usr/bin/python2.7 /home/dan/PycharmProjects/test_01/test_012.py
Finite Field of size 2
Univariate Polynomial Ring in X over Finite Field of size 2 (using NTL)
168
ORDER 2^2 * 107 * 21044858204113 for Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in z53 of size 2^53
Process finished with exit code 0
</code></pre></li>
</ol>
<p>Hope it also works for you like a charm, enjoy!</p>
https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?comment=38763#post-id-38763The steps are as follows:
- Inside ubuntu start a terminal.
- In the terminal type `sage -sh` - This command will set some environment variables, these are now valid for the terminal, and for the processes started from it. Make sure `sage` is in the path, else the "long path to sage" has to be used with the -sh option.
- In the terminal we have now the needed sage settings. Type in it `pycharm &` . Again, pycharm should be installed and in the path.
- pycharm opens, make a project file, inside a py-file, and the difference between a usual python run/debug and a sage run/debug is minimal, just make sure to put the line `from sage.all import *` at the beginning of the py-file containing sage code.
In case something is unclear, do not hesitate to ask!Fri, 08 Sep 2017 20:23:47 +0200https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?comment=38763#post-id-38763Comment by siddiqui.902003 for <p>(For my taste, eclipse is the better IDE for developing code. There can be very many projects in it... The following is taken from the recommended path to start sage inside eclipse. Well my taste is not changed right in this second, but give me some more...)</p>
<p>The beautiful dark themes and the light interface of pycharm, dedicated to python, made me give it one more serious try. I cannot remember if there are any special configuration steps i did some months ago, but pycharm+sage work today without special effort. Here are the steps just done to run a simple piece of code. This is not really ubuntu, but manjaro, which is not far away, the same should apply in most linux operating systems.</p>
<ol>
<li><p>Open a terminal and type <code>sage -sh</code> in it to get the sage environment. For me:</p>
<pre><code>[dan@k7 ~]$ which pycharm
/usr/bin/pycharm
[dan@k7 ~]$ sage -sh
Starting subshell with Sage environment variables set. Don't forget
to exit when you are done. Beware:
* Do not do anything with other copies of Sage on your system.
* Do not use this for installing Sage packages using "sage -i" or for
running "make" at Sage's root directory. These should be done
outside the Sage shell.
Bypassing shell configuration files...
Note: SAGE_ROOT=/usr
</code></pre></li>
<li><p>From this shell with the <code>(sage-sh)</code> prompter start pycharm:</p>
<pre><code>(sage-sh) dan@k7:~$ pycharm &
[1] 30437
</code></pre></li>
<li><p>Inside my pycharm there is now a test file named <code>test012.py</code> containing some lines of code from various areas of interest.</p>
<pre><code>from sage.all import *
F = GF(2)
print F
R = PolynomialRing( F, name='X' )
print R
G = GL(3,F)
print G.order()
E = EllipticCurve( GF(2**53), [1,0,0,0,1] )
print "ORDER %s for %s" % ( E.order().factor(), E )
</code></pre>
<p>Only the first line is important, <code>from sage.all import *</code>. The rest is the test. Results in the pycharm console:</p>
<pre><code>/usr/bin/python2.7 /home/dan/PycharmProjects/test_01/test_012.py
Finite Field of size 2
Univariate Polynomial Ring in X over Finite Field of size 2 (using NTL)
168
ORDER 2^2 * 107 * 21044858204113 for Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field in z53 of size 2^53
Process finished with exit code 0
</code></pre></li>
</ol>
<p>Hope it also works for you like a charm, enjoy!</p>
https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?comment=38756#post-id-38756@ dan_fulea Thank you for your reply.
I downloaded the sagemath but but i'm unable to creat shell and this command is not working for me.
sage -sh
can you please explain how i can do this...
to start sage i have to go inside sage folder and with ./sage, sage will work on terminal but not on pycharm.
Please share your idea.
Thank you.Fri, 08 Sep 2017 09:39:08 +0200https://ask.sagemath.org/question/38750/how-i-use-sage-with-pycharm-in-ubuntu/?comment=38756#post-id-38756