ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 17 Jul 2015 11:32:58 -0500ImportError: No module named RealDistributionhttp://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/ I'm fairly new to sage, so this may be a dumb question. On the web interface the following code
T=RealDistribution('gaussian',.5)
runs without issue, however on my local machine, sage throws a not defined error
NameError: name 'RealDistribution' is not defined
I found this strange because it worked fine on the web interface and is almost a line strait from the manual, but I thought that maybe just something wasn't importing or something like that, so I tried the following import statements, but to no avail.
import sage.all
import sage.gsl.probability_distribution.RealDistribution
My questions are: why does it work on the online sagemath but not on my local machine, and what can I do to make it work?Fri, 17 Jul 2015 10:25:43 -0500http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/Comment by tmonteil for <p>I'm fairly new to sage, so this may be a dumb question. On the web interface the following code</p>
<pre><code>T=RealDistribution('gaussian',.5)
</code></pre>
<p>runs without issue, however on my local machine, sage throws a not defined error</p>
<pre><code>NameError: name 'RealDistribution' is not defined
</code></pre>
<p>I found this strange because it worked fine on the web interface and is almost a line strait from the manual, but I thought that maybe just something wasn't importing or something like that, so I tried the following import statements, but to no avail.</p>
<pre><code>import sage.all
import sage.gsl.probability_distribution.RealDistribution
</code></pre>
<p>My questions are: why does it work on the online sagemath but not on my local machine, and what can I do to make it work?</p>
http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28597#post-id-28597OK, i edited my answer accordingly, please tell us if it worked.Fri, 17 Jul 2015 11:32:58 -0500http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28597#post-id-28597Comment by schnip for <p>I'm fairly new to sage, so this may be a dumb question. On the web interface the following code</p>
<pre><code>T=RealDistribution('gaussian',.5)
</code></pre>
<p>runs without issue, however on my local machine, sage throws a not defined error</p>
<pre><code>NameError: name 'RealDistribution' is not defined
</code></pre>
<p>I found this strange because it worked fine on the web interface and is almost a line strait from the manual, but I thought that maybe just something wasn't importing or something like that, so I tried the following import statements, but to no avail.</p>
<pre><code>import sage.all
import sage.gsl.probability_distribution.RealDistribution
</code></pre>
<p>My questions are: why does it work on the online sagemath but not on my local machine, and what can I do to make it work?</p>
http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28596#post-id-28596Command line. I didn't think about doing it in notebook, and so I just went and tested that and it worked, but running it from the command line would be preferable.Fri, 17 Jul 2015 10:42:38 -0500http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28596#post-id-28596Comment by tmonteil for <p>I'm fairly new to sage, so this may be a dumb question. On the web interface the following code</p>
<pre><code>T=RealDistribution('gaussian',.5)
</code></pre>
<p>runs without issue, however on my local machine, sage throws a not defined error</p>
<pre><code>NameError: name 'RealDistribution' is not defined
</code></pre>
<p>I found this strange because it worked fine on the web interface and is almost a line strait from the manual, but I thought that maybe just something wasn't importing or something like that, so I tried the following import statements, but to no avail.</p>
<pre><code>import sage.all
import sage.gsl.probability_distribution.RealDistribution
</code></pre>
<p>My questions are: why does it work on the online sagemath but not on my local machine, and what can I do to make it work?</p>
http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28594#post-id-28594Do you want to use the Sage notebook or the command line ?Fri, 17 Jul 2015 10:38:20 -0500http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28594#post-id-28594Comment by schnip for <p>I'm fairly new to sage, so this may be a dumb question. On the web interface the following code</p>
<pre><code>T=RealDistribution('gaussian',.5)
</code></pre>
<p>runs without issue, however on my local machine, sage throws a not defined error</p>
<pre><code>NameError: name 'RealDistribution' is not defined
</code></pre>
<p>I found this strange because it worked fine on the web interface and is almost a line strait from the manual, but I thought that maybe just something wasn't importing or something like that, so I tried the following import statements, but to no avail.</p>
<pre><code>import sage.all
import sage.gsl.probability_distribution.RealDistribution
</code></pre>
<p>My questions are: why does it work on the online sagemath but not on my local machine, and what can I do to make it work?</p>
http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28592#post-id-28592I had the code saved in a file and then ran the file with
sage NEES.sagews
For sage version, I have the current one off of the apt repos, which appears to be 6.7. My OS is a 64-bit Linux Mint 17.Fri, 17 Jul 2015 10:32:33 -0500http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28592#post-id-28592Comment by tmonteil for <p>I'm fairly new to sage, so this may be a dumb question. On the web interface the following code</p>
<pre><code>T=RealDistribution('gaussian',.5)
</code></pre>
<p>runs without issue, however on my local machine, sage throws a not defined error</p>
<pre><code>NameError: name 'RealDistribution' is not defined
</code></pre>
<p>I found this strange because it worked fine on the web interface and is almost a line strait from the manual, but I thought that maybe just something wasn't importing or something like that, so I tried the following import statements, but to no avail.</p>
<pre><code>import sage.all
import sage.gsl.probability_distribution.RealDistribution
</code></pre>
<p>My questions are: why does it work on the online sagemath but not on my local machine, and what can I do to make it work?</p>
http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28591#post-id-28591This should work without problem (i just tested it). How did you launch Sage on your local machine ? Which version ? Which OS ?Fri, 17 Jul 2015 10:27:36 -0500http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?comment=28591#post-id-28591Answer by tmonteil for <p>I'm fairly new to sage, so this may be a dumb question. On the web interface the following code</p>
<pre><code>T=RealDistribution('gaussian',.5)
</code></pre>
<p>runs without issue, however on my local machine, sage throws a not defined error</p>
<pre><code>NameError: name 'RealDistribution' is not defined
</code></pre>
<p>I found this strange because it worked fine on the web interface and is almost a line strait from the manual, but I thought that maybe just something wasn't importing or something like that, so I tried the following import statements, but to no avail.</p>
<pre><code>import sage.all
import sage.gsl.probability_distribution.RealDistribution
</code></pre>
<p>My questions are: why does it work on the online sagemath but not on my local machine, and what can I do to make it work?</p>
http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?answer=28595#post-id-28595The `.sagews` format is specific to sagemathcloud, so you have to save your worksheet in another format, like `.sws` or `.rst` if possible. Or you can save it as plain text and copy the contents by hand on your local notebook.
To launch the Sage notebook, you should run the following command from a terminal:
sage -n
If you want to run your worksheet from the command line, you should copy its content into a text file whose name has a `.sage` extension, as if it was a Python file (with the exception that it will be preparsed), and from the command line, run:
sage: %runfile your_file.sage
Fri, 17 Jul 2015 10:40:01 -0500http://ask.sagemath.org/question/28590/importerror-no-module-named-realdistribution/?answer=28595#post-id-28595