The raid, which involved more than seven police officers, was in Sydney Road on Saturday, September 19.
Police also said they discovered a suspected victim of modern slavery.
It comes as a result of tip-offs from members of the public, according to a Facebook post from police.
The post continued: ‘It has been a busy weekend for the Gosport East Neighbourhood team but what a result.
‘The team acted on information provided by the community and located and dismantled a cannabis factory.
‘Not only have we taken these drugs from streets we have also safeguarded persons we believe may be subject to modern day slavery.’
One resident, who has lived in Sydney Road for the last nine months and asked not to be named, said it was a ‘shock and surprise’ to discover a drugs factory had been operating in the residential road.
She said: ‘We had no idea that was going on.
‘We knew someone was in there, but we never saw them.
‘The police were there all day and night – but I couldn’t see what they were doing.
‘It’s usually a quiet area.’
A 17-year-old boy was arrested on suspicion of producing a class B drug, according to a spokesman from Hampshire Constabulary.
The spokesman said: ‘(The boy) has since been released under investigation.
‘One individual suspected of being a potential modern slavery victim was safeguarded, however (we) won’t be releasing further details in relation to them.’