From: Chris <rea...@po...> - 2004-10-01 21:23:44
|
My system is set up so that when I am logged into root (via su) the root user cannot access the X display. I like this behavior but it means that I cannot install matplotlib as the root user (I can use sudo) because setup.py wants to import pygtk and wxPython both of which try to connect to the X display. It seems to me that it is unnecessary to connect to the display to compile the matplotlib extensions, rather the import gtk command exists to test to see if the pygtk package is installed. If I am wrong then this does not matter. I thought that the build procedure would be more robust is it was not necessary to import the whole pygtk and wxPython packages in order to test for their presence. Is there a standard way to test for the presence of a package without actually importing it? I know that I could temporarily export a display for the root user - but I don't want to and I don't think it should be necessary if it is not required. I have been thinking about ways to test for packages without importing them. Would it be possible to test for the offending packges by importing subpackages that do not connect to the X server? For example in the case of pygtk 'gobject' can be imported successfully when no X display is available. (This works on my system because pygtk-2.0 is part of the python path - I did not put it there so I assume that is standard - if not this procedure would require that the appropriate directory was appended to then removed from the python path.) The disadvantages that I can see are that it would make the build procedure dependant on the naming of subpackages within a package and it would not actually check for a working installation just the presence of a certain package. I guess it depends how great the demand is to be able to install matplotlib from an environment that does not have a X display. Cheers Chris |