Despite all the attention that renewable energy companies get, having operations in the renewable energy space alone does not make a stock a buy. In fact, several renewable energy companies are struggling just to stay profitable.

Let's discuss two renewable energy stocks that look attractive right now, and one that's best avoided.

Enphase Energy: Buy

Enphase Energy's (ENPH -2.15%) microinverters improved the way in which DC (direct current) produced by solar panels gets converted into AC (alternating current) for end use. Coupled with the company's batteries and easy-to-use energy management platform, Enphase Energy's offerings improve the performance and reliability of a solar installation. The company's innovative products have found a growing demand over time. This gets reflected in the consistent growth in Enphase Energy's revenue over years.

ENPH Revenue (Quarterly) Chart

ENPH Revenue (Quarterly) data by YCharts

Moreover, the company generates a strong margin on its sales. It targets 20% operating income, excluding stock-based compensation expense. Enphase Energy has managed to maintain stable net profits, despite significant investments in growth.

With the expected growth in solar energy demand in the coming decades, Enphase Energy has a long growth runway.

Engineers Working On Solar Farm Installation.

Image source: Getty Images.

Clearway Energy: Buy

Clearway Energy (CWEN 0.94%) owns over 5,000 megawatts of wind and solar generation projects in the U.S. On Wednesday, TotalEnergies (TTE -0.91%) acquired 50% of Clearway Energy Group -- the parent company of Clearway Energy -- for $1.6 billion cash and a nearly 50% interest in a TotalEnergies' subsidiary, which holds a 51% stake in SunPower.

Backing by a strong sponsor like TotalEnergies bodes well for Clearway Energy's long-term growth. TotalEnergies is investing heavily in renewable energy, and has a deep experience in energy markets. The transaction values Clearway Energy stock at $35.1 per share.

CWEN Revenue (TTM) Chart

CWEN Revenue (TTM) data by YCharts

Clearway Energy has been growing its revenue steadily over the years. The stock offers an attractive dividend yield of 4.1% as of this writing.

Plug Power: Avoid

Plug Power (PLUG -1.80%) is a leading provider of hydrogen fuel cells in the electric-mobility segment. The company has long focused on the materials handling business, providing fuel cells for use in forklifts. It is now expanding its offerings in the electric vehicles and backup power markets, as well as developing its green hydrogen and electrolyzers business.

The biggest issue with Plug Power relates to its profitability.

PLUG Revenue (TTM) Chart

PLUG Revenue (TTM) data by YCharts

As the chart shows, Plug Power is not yet profitable, although it has been in business for more than two decades. On the contrary, the company's losses have deepened lately.

Hydrogen electric vehicles could be a key growth area for Plug Power. However, while some automakers have shifted their focus fully to battery electric vehicles -- instead of hydrogen-powered ones -- those that are still investing in hydrogen are largely developing fuel cells in-house. Overall, there is intense competition in the segment, even as the demand for fuel cells is not panning out in the way some were expecting.

In short, until Plug Power shows a clear path to profitability, this stock is best avoided.