Ask Your Question
1

Problems with modules after installation

asked 2021-01-11 09:55:55 +0200

Sam Mattheus gravatar image

updated 2021-01-11 13:19:29 +0200

FrédéricC gravatar image

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 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?

edit retag flag offensive close merge delete

Comments

There 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.

FrédéricC gravatar imageFrédéricC ( 2021-01-11 10:31:05 +0200 )edit

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 2021-01-11 18:41:05 +0200 )edit

I 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.

slelievre gravatar imageslelievre ( 2021-01-11 18:42:27 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2021-01-11 10:32:27 +0200

FrédéricC gravatar image

Just in case, you may like to use sage: from sage.graphs.all import *

edit flag offensive delete link more

Comments

Ah, 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.

Sam Mattheus gravatar imageSam Mattheus ( 2021-01-11 13:29:34 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-01-11 09:55:55 +0200

Seen: 58 times

Last updated: Jan 11