Run command “composer install” when activating wordpress plugin

This is not how this should work. You should not be stunning shell commands from a plugin. The proper way to do this is to install dependencies before bundling for distribution.