polybar: Failed to build: Missing required python module: xcbgen

Build Process

git clone https://github.com/polybar/polybar/; cd polybar; ./build.sh

  • Output of git describe --tags: 3.4.0-14-g5a309f0

Build Log

http://ix.io/1WCE

Environment:

Linux 5.3.1-arch1-1-ARCH x86_64

Additional context

I think this is related to the discontinuation of python2 and it’s interference with xcb-proto package. I tried manually editing lib/xpp/CMakeLists.txt from python 2.7 to python 3.7 with no luck. I also have pyenv installed which could be messing everything up further.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

sudo apt install python3-xcbgen fixed it for me!

Yeah, then it’s definitely pyenv. Try running pyenv global system in the terminal before you run cmake.

None of the above methods worked for me. However, I managed to get it working by symlinking my xcbgen folder from an earlier python version.

I’m not sure why but xcbgen only exists in my python3.9 folder so I though it must be looking only in the python3.10

-- Searching for xcbgen with /usr/bin/python3
-- Searching for xcbgen with python3
-- Searching for xcbgen with python
-- Searching for xcbgen with python2
-- Searching for xcbgen with python2.7

/usr/lib/python3.9/site-packages/xcbgen -> /usr/lib/python3.10/site-packages

Just in case anyone has a similar issue

Did you clean the build directory before you did this? Seems like it is still invoking a pyenv version of shphinx-build. I recommend completely deleting the build directory before every try.

Since you are using arch, you can also use the aur package. Of course this would run into the same installation issues but arch provides an easy way to compile packages in a clean chroot. Install the devtools package and try this:

git clone https://aur.archlinux.org/polybar.git/
cd polybar
extra-x86_64-build

EDIT: You can of course also try to install all python dependencies (python-sphinx and xcbgen) via pyenv so that they are found during compilation. Though this can run into some problems depending on the python version (for example conda has issues).