Energy density is completely ignored when talking about why fossil fuel is so popular. You can transport it anywhere cheaply, store it, and it can output when you need it in any condition.
Solar panels themselves lead to ton of pollution when they are scrapped and often abandoned once they are installed leading ton of ecological problems for wilderness.