Ask Your Question
1

Problems with modules after installation

asked 4 years ago

Sam Mattheus gravatar image

updated 4 years ago

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?

Preview: (hide)

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 ( 4 years ago )

Welcome to Ask Sage! Thank you for your question!

slelievre gravatar imageslelievre ( 4 years ago )

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 ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

FrédéricC gravatar image

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

Preview: (hide)
link

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 ( 4 years ago )

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: 4 years ago

Seen: 306 times

Last updated: Jan 11 '21