Is it possible to run composer install automatically during the installation of a plugin.

I’ve been trying for a while now to automatically have composer install dependencies during the installation of a plugin, but this seems impossible. Can anyone tell me how to achieve this?