Search code examples
pythonlinuxcompiz

Python setup does not find correctly installed module using pkg-config


First off, I do not know python. I think that's why I am having a problem. I am trying to build compiz from source but am stuck at building the simple-ccsm. The setup of simple-ccsm is using python and a setup.py. While installing, it complains :

Package compiz was not found in the pkg-config search path.
Perhaps you should add the directory containing 'compiz.pc'
to the PKG_CONFIG_PATH environment variable
No package 'compiz' was found

Now, the PKG_CONFIG_PATH does point to the correct folder. What's more, pkg-config can also find compiz correctly:

pkg-config --libs compiz

It does install simple-ccsm but, when I run it, simple-ccsm fails complaining

ImportError: No module named compizconfig

I have installed all the required dependencies for simple-ccsm ( including compizconfig-python bindings which seems to give the above error generelly) So, I would like to ask the python experts, how do I guide python to look in the correct place. I am guessing it's somehow not looking in the correct directory.


Solution

  • To guide Python to the right place, you may need to tinker with PYTHONPATH: (Editing because link is broken).

    PYTHONPATH sets the search path for importing python modules:
    
    PYTHONPATH Augment the default search path for module files. The format is 
    the same as the shell’s PATH: one or more directory pathnames separated by 
    os.pathsep (e.g. colons on Unix or semicolons on Windows). Non-existent 
    directories are silently ignored.
    
    In addition to normal directories, individual PYTHONPATH entries may refer 
    to zipfiles containing pure Python modules (in either source or compiled 
    form). Extension modules cannot be imported from zipfiles.
    
    The default search path is installation dependent, but generally begins with 
    prefix/lib/pythonversion (see PYTHONHOME above). It is always appended to 
    PYTHONPATH.
    
    An additional directory will be inserted in the search path in front of 
    PYTHONPATH as described above under Interface options. The search path can 
    be manipulated from within a Python program as the variable sys.path.
    

    To set the variable, either specify it when you run your python script:

    PYTHONPATH=/blah/whatever/ python somescript.py somecommand

    Or export it to your Bash environment:

    export PYTHONPATH=/blah/whatever/