I think it will someday be possible to use the ocean to create electricity through thermal energy. However I agree that you have to go deep into the ocean, and that gets expensive and difficult to install and to maintain.
If you are talking about using ocean thermal energy for power, this refers to using the difference between the temperatures of deep water (cold) and shallower water (warmer) to run an engine that would create electricity.
This is a fairly complicated process and is not much used today because it is hard to generate enough power to make up for the cost of the apparatus.
You could copy and paste the following link to learn more:
The ocean thermal energy is that energy which is get by converting the solar energy trapped by the ocean into usable energy.
For this energy to be operational, a temperature difference between the water at the surface and water at depths, up to 2 km, has to exist. The value of this difference of temeprature has to be of more than 293 K.