Emmanuel Akinrinoye, 19, admitted having the class B drug in Southsea on November 20.
Portsmouth magistrates imposed a six-month conditional discharge.
He must pay a £20 victim surcharge with £85 prosecution costs.
A single bag of cannabis was forfeited and destroyed.