Install this plugin: https://github.com/F4-Group/dokku-apt#installation
Create an apt-packages file in the root directory of your repository with the following lines:
Now, commit your new apt-packages file and python-ldap should install successfully.
I also had trouble installing pymssql, and got an error saying "_mssql.c:314:22: fatal error: sqlfront.h: No such file or directory". Similar fix, just add "freetds-dev" to your apt-packages file.