I downloaded U8g2 from the library but still this error occurs.
First try reinstalling the library. Remove the folder under Documents/Arduino/libraries. Then reinstall it via Tools > Libraries.
If that does not work do a few checks:
Check your Preferences (File > Preferences). What is the sketchbook location? With the Windows Explorer, browse to that folder. Does it contain a folder "libraries"? Go into that folder. Does it contain a folder "U8g2"? Does it look like this?:
Next, in the Arduino IDE, choose Tools > Libraries from the menu. Type "U8g2" in the search field and hit Enter. Is the library installed?:
You can also Google for similar problems..
Post your answers here. Also, please let us know here if you solved: how you did this. It can be of help to others.