Ask Your Question

rc's profile - activity

2018-11-13 00:48:03 +0100 received badge  Notable Question (source)
2018-11-13 00:48:03 +0100 received badge  Famous Question (source)
2017-04-06 10:08:27 +0100 received badge  Notable Question (source)
2015-01-14 14:09:11 +0100 received badge  Popular Question (source)
2015-01-13 21:58:22 +0100 received badge  Taxonomist
2014-08-31 20:04:49 +0100 asked a question problem installing pygraphviz in sage 6.2

I'm trying to install the python package pygraphviz in sage 6.2 through the following procedure.

sage -i dot2tex
sage -i graphviz
sage -sh <<< "easy_install --verbose pip"
sage -sh <<< "pip --verbose install pygraphviz"

The first three commands are successful. The last one, however, outputs the following. Any help will be appreciated. Thanks.

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=/home/soft/sage/sage-6.2-i686-Linux
Traceback (most recent call last):
  File "/home/soft/sage/sage-6.2-i686-Linux/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/setuptools-2.0.1-py2.7.egg/", line 352, in load_entry_point
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/setuptools-2.0.1-py2.7.egg/", line 2295, in load_entry_point
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/setuptools-2.0.1-py2.7.egg/", line 2009, in load
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/", line 10, in <module>
    from pip.util import get_installed_distributions, get_prog
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/", line 15, in <module>
    from pip.locations import site_packages, running_under_virtualenv, virtualenv_no_global
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/", line 96, in <module>
    build_prefix = _get_build_prefix()
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/", line 65, in _get_build_prefix
  File "/home/soft/sage/sage-6.2-i686-Linux/local/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/", line 60, in __get_username
    return pwd.getpwuid(os.geteuid()).pw_name
KeyError: 'getpwuid(): uid not found: 2006'
Exited Sage subshell.
2014-02-05 10:31:47 +0100 received badge  Popular Question (source)
2012-01-22 01:09:34 +0100 received badge  Student (source)
2012-01-21 09:11:40 +0100 received badge  Supporter (source)
2012-01-21 09:11:35 +0100 marked best answer can't use networkx.read_dot()

Have you installed the optional package

If not this command won't work.

Run the command sage -i dot2tex-2.8.7-2 to install it.

You can find a list of optional packages at


Sorry I posted that without trying it out just by looking at the manual, but I managed to solve the problem. Here are the steps I did to make it run.


install optional package dot2tex


install optional package graphviz from the same page (


At the terminal type

$sage -sh

$easy_install pygraphviz

That way I was able to run a simple pygraphviz example.

2012-01-21 09:11:35 +0100 received badge  Scholar (source)
2012-01-21 09:08:47 +0100 commented answer can't use networkx.read_dot()

It did! Thanks a lot! Where should I have looked in order figure this?

2012-01-20 08:53:44 +0100 commented answer can't use networkx.read_dot()

I did not have dot2tex installed. Now I have but the situation is unchanged: same error message. Thanks for the ready answer anyway!

2012-01-19 18:36:09 +0100 asked a question can't use networkx.read_dot()

When trying the following

import networkx

I get

ImportError                               Traceback (most recent call last)

/home/bla/tmp/<ipython console> in <module>()

/local/usr/share/sage/local/lib/python/networkx/drawing/nx_agraph.pyc in read_dot(path)
    197     except ImportError:
    198         raise ImportError, \
--> 199           "read_dot() requires pygraphviz:"
    200     A=pygraphviz.AGraph(file=path)
    201     return from_agraph(A)

ImportError: read_dot() requires pygraphviz:

It seems that I'm missing something really simple here. After a fair time browsing the documentation, however, I couldn't find what :(

Thanks in advance.