Leeds Crown Court heard officers from West Yorkshire Police made the discovery as they executed a search warrant at a house on Crosby View, Holbeck, on August 6 this year.
A total of 51 plants were found growing in rooms on four floors of the property.
Carmel Pearson, prosecuting, said Phan Hao was arrested at the house.
The property was equipped with lighting, ducting and ventilation equipment.
Industrial fertiliser and weighing scales were also recovered from the property.
Hao, 36, was arrested and told officers he had been taken to the house against his will after arriving in the UK from Vietnam.
The defendant also claimed he did not know that they were cannabis plants.
Hao, of no fixed address, pleaded guilty to producing cannabis.
James Holding, mitigating, said: "He previously owned a fish farm in Vietnam but lost everything due to a storm and was in debt to the bank."
Mr Holding said his client then borrowed money from loan sharks.
He added: "He was then under pressure from those he borrowed money from.
"He left the country through fear of reprisals."
The barrister said Hoa entered the UK a few months before he was arrested for the offence.
Sentencing, Judge Simon Batiste said: "This offence was committed soon after your arrival in the UK.
"In my judgement, proper punishment can only be achieved by the imposition of an immediate custodial sentence."
The judge warned Hao it is likely that the Home Offence will seek to deport him after he is released from custody.