This is usually caused by incorrect permissions in the wp-content folder, as WordPress needs to create a temporary folder to put the files when downloaded, before install.
Rather than using 777 permissions to allow WordPress to create the correct folder, and then having to reverse the permissions and potentially creating a security hole, we will put a temporary folder outside of the install directory. In other words, find the root folder and go up a directory. As we are now outside of the public directory, we can now create a folder called ‘temp’ with 777 permissions and not create a security hole.
Once you have done this, open up the wp-config.php file in the root directory and add the following at the bottom.
define('WP_TEMP_DIR', ABSPATH . '/../temp/');