Real estate can be a great investment if you know what you're doing and you're doing it for cash flow rather than for capital appreciation. When it comes to capital appreciation, real estate is pretty awful. Even over long periods of time, at best, you're looking at compounding in the 3-5% range. When even a monkey throwing darts can expect a 7-9% return in equities, that's not very attractive. The key to success comes in when you learn how to use real estate as a cash flow generating investment. If you can buy a house at $30k with 25% down, put in less than $10k in repairs, and then lease it for $750/mo, then you're blowing the doors off of any stock portfolio. But you need to know what you're doing in order to accomplish that. Far more often, I have clients coming to me who paid $80k cash for a house that needs $10k in repairs and is only worth $60k, and it might get $650/mo in rent. They think they've done good because they have no mortgage payment, and I'm just shaking my head and trying to explain to them that a 3.25% mortgage is practically free money, and they could have bought 3 better investment properties for the same capital outlay and beaten Warren Buffett's returns in the process.
If you're going to invest in real estate beyond buying your own place to live, you really need to know what you're doing, or hire a professional with lots of experience. I've seen way too many people burned. Hell, I see new ones practically every week.