Cannot partition internal drive to install bootcamp because of APFS/High Sierra

If your disk has been converted/formatted to use APFS, and you use Time Machine partitioning will typically fail because Time Machine made local APFS snapshots.

You can see the snapshots created with the command (use Terminal to enter it):

tmutil listlocalsnapshots /

If you see some, run the following command:

tmutil thinlocalsnapshots / 9999999999999

This last command will delete all the local snapshots.

Now run the Bootcamp assistant again, this time partitioning the disk should succeed.