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, 11 Jan 2021 18:42:27 +0100Problems with modules after installationhttps://ask.sagemath.org/question/55231/problems-with-modules-after-installation/Hello everyone,
I have installed Sage on Ubuntu 16.04 from the pre-built tarball binary exactly as described in the installation guide
but I am left with some newbie questions.
After browsing the web for several hours, I still cannot manage to get the module graphs up and running in the terminal. First I couldn't even import graphs, but after running
`sage --pip install graphs` in terminal I can do
sage: import graphs
without ModuleNotFound error, but the command
sage: G = graphs.EmptyGraph()
leads to
AttributeError: module 'graphs' has no attribute 'EmptyGraph'
Moreover, I'd like to add a new package ([sage-drg](https://github.com/jaanos/sage-drg) by Janos Vidali, which I cannot link) but it remains unclear on how to do this. Where do I unpack the zip? How do I let Sage know where to find this package? Is this even possible if I didn't built from source?Mon, 11 Jan 2021 09:55:55 +0100https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/Comment by FrédéricC for <p>Hello everyone,</p>
<p>I have installed Sage on Ubuntu 16.04 from the pre-built tarball binary exactly as described in the installation guide
but I am left with some newbie questions.</p>
<p>After browsing the web for several hours, I still cannot manage to get the module graphs up and running in the terminal. First I couldn't even import graphs, but after running
<code>sage --pip install graphs</code> in terminal I can do</p>
<pre><code>sage: import graphs
</code></pre>
<p>without ModuleNotFound error, but the command</p>
<pre><code>sage: G = graphs.EmptyGraph()
</code></pre>
<p>leads to</p>
<pre><code>AttributeError: module 'graphs' has no attribute 'EmptyGraph'
</code></pre>
<p>Moreover, I'd like to add a new package (<a href="https://github.com/jaanos/sage-drg">sage-drg</a> by Janos Vidali, which I cannot link) but it remains unclear on how to do this. Where do I unpack the zip? How do I let Sage know where to find this package? Is this even possible if I didn't built from source?</p>
https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55232#post-id-55232There is no need to install any package, as graphs are included in sage itself. You have probably installed https://pypi.org/project/graphs/ which has nothing to do with sage.Mon, 11 Jan 2021 10:31:05 +0100https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55232#post-id-55232Comment by slelievre for <p>Hello everyone,</p>
<p>I have installed Sage on Ubuntu 16.04 from the pre-built tarball binary exactly as described in the installation guide
but I am left with some newbie questions.</p>
<p>After browsing the web for several hours, I still cannot manage to get the module graphs up and running in the terminal. First I couldn't even import graphs, but after running
<code>sage --pip install graphs</code> in terminal I can do</p>
<pre><code>sage: import graphs
</code></pre>
<p>without ModuleNotFound error, but the command</p>
<pre><code>sage: G = graphs.EmptyGraph()
</code></pre>
<p>leads to</p>
<pre><code>AttributeError: module 'graphs' has no attribute 'EmptyGraph'
</code></pre>
<p>Moreover, I'd like to add a new package (<a href="https://github.com/jaanos/sage-drg">sage-drg</a> by Janos Vidali, which I cannot link) but it remains unclear on how to do this. Where do I unpack the zip? How do I let Sage know where to find this package? Is this even possible if I didn't built from source?</p>
https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55240#post-id-55240Welcome to Ask Sage! Thank you for your question!Mon, 11 Jan 2021 18:41:05 +0100https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55240#post-id-55240Comment by slelievre for <p>Hello everyone,</p>
<p>I have installed Sage on Ubuntu 16.04 from the pre-built tarball binary exactly as described in the installation guide
but I am left with some newbie questions.</p>
<p>After browsing the web for several hours, I still cannot manage to get the module graphs up and running in the terminal. First I couldn't even import graphs, but after running
<code>sage --pip install graphs</code> in terminal I can do</p>
<pre><code>sage: import graphs
</code></pre>
<p>without ModuleNotFound error, but the command</p>
<pre><code>sage: G = graphs.EmptyGraph()
</code></pre>
<p>leads to</p>
<pre><code>AttributeError: module 'graphs' has no attribute 'EmptyGraph'
</code></pre>
<p>Moreover, I'd like to add a new package (<a href="https://github.com/jaanos/sage-drg">sage-drg</a> by Janos Vidali, which I cannot link) but it remains unclear on how to do this. Where do I unpack the zip? How do I let Sage know where to find this package? Is this even possible if I didn't built from source?</p>
https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55241#post-id-55241I changed @FrédéricC's comment to an answer so you can accept it to mark the question as solved.
This is done by clicking the "checkmark" button by the answer.Mon, 11 Jan 2021 18:42:27 +0100https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55241#post-id-55241Answer by FrédéricC for <p>Hello everyone,</p>
<p>I have installed Sage on Ubuntu 16.04 from the pre-built tarball binary exactly as described in the installation guide
but I am left with some newbie questions.</p>
<p>After browsing the web for several hours, I still cannot manage to get the module graphs up and running in the terminal. First I couldn't even import graphs, but after running
<code>sage --pip install graphs</code> in terminal I can do</p>
<pre><code>sage: import graphs
</code></pre>
<p>without ModuleNotFound error, but the command</p>
<pre><code>sage: G = graphs.EmptyGraph()
</code></pre>
<p>leads to</p>
<pre><code>AttributeError: module 'graphs' has no attribute 'EmptyGraph'
</code></pre>
<p>Moreover, I'd like to add a new package (<a href="https://github.com/jaanos/sage-drg">sage-drg</a> by Janos Vidali, which I cannot link) but it remains unclear on how to do this. Where do I unpack the zip? How do I let Sage know where to find this package? Is this even possible if I didn't built from source?</p>
https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?answer=55233#post-id-55233Just in case, you may like to use `sage: from sage.graphs.all import * `Mon, 11 Jan 2021 10:32:27 +0100https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?answer=55233#post-id-55233Comment by Sam Mattheus for <p>Just in case, you may like to use <code>sage: from sage.graphs.all import *</code></p>
https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55234#post-id-55234Ah, that does seem to work, many thanks! I fiddled with the all.py file to see if I can load the module automatically, but it seems that this command was already in there. So after executing this command once, now it seems to work every time upon restarting.
Eventually I also found the answer to my second question: apparently the relevant folder is the build/pkgs folder. After putting the files in, I can import whatever I need, using the same command.Mon, 11 Jan 2021 13:29:34 +0100https://ask.sagemath.org/question/55231/problems-with-modules-after-installation/?comment=55234#post-id-55234