Q:

Cant install polybar because python-xcbgen is not available

I ran into dependency issue for polybar, I am using Ubuntu20.04. apt-get install gave me the following error:
Package python-xcbgen is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'python-xcbgen' has no installation candidate

Then I tried sudo apt-get install python3-xcbgen, which successfully installed (v 1.14-2). However, polybar installation still complained it couldn't find python-xcbgen. 
I am using Anaconda python so I dont know if it has anything to do with it. 
Please advice. Thanks

A:

Building polybar does not seem to work well with anaconda. The recommended way is to either uninstall it or completely disable it while building polybar.
From the Known Issues polybar wiki page:

Problem: On systems using Anaconda compiling polybar will likely fail
  with one of these error messages:

Missing required python module: xcbgen
ERROR: could not calc required_start_align of Struct "xcb.Setup"
Cairo was not compiled with support for the xcb backend

The general issue is that the libraries and programs provided by
  Anaconda cannot be used to build polybar in many cases.
Fix: The easiest fix is to uninstall Anaconda if you don't need it.
If you can't/don't want to uninstall Anaconda, we need to force
  polybar to not use any resources provided by Anaconda. This can be
  done by temporarily removing any paths that point to anaconda from
  both the $PATH and $PKG_CONFIG_PATH environment variables in the
  terminal before building polybar.
People have reported that conda deactivate does that for you for the
  currently open terminal. If that doesn't work, try doing it manually:
For example if your PATH variable contains:
/home//anaconda2/bin:/home//bin:...:/usr/bin
Remove /home//anaconda2/bin and reexport the variable:
export PATH=/home//bin:...:/usr/bin
Do the same thing for PKG_CONFIG_PATH (though this variable is often
  already empty). Now you should be able to build polybar with either
  the build.sh script or cmake and make. Make sure that you do a clean
  build (redownload all polybar sources).

The last sentence is very important. You must do a clean build. This means deleting the polybar sources that you downloaded and redownloading them.

