Albanian national Edmond Kovaci was sleeping on a mattress at the property in Marley Terrace, Beeston, when officers gained entry on February 1 this year, Leeds Crown Court was told.
There were 117 mature cannabis plants and 65 younger plants growing in three bedrooms and two downstairs rooms. Other equipment including lights, transformers and a watering system had also been set up.
The court heard the estimated street value of the two crops ranged from £57,390 to £191,300, depending on the quantities in which the drugs were to have been sold.
During a police interview, Kovaci said he had been brought to the UK by two Polish men who claimed he would be able to get work in the construction industry.
He said that when he arrived, he was instead told that he owed them £20,000 and must pay off the debt by acting as the gardener for the cannabis farm.
The 30-year-old told officers that he had been there for three months and the £100 found on him was the only money he had been given since his arrival.
But the court heard the Crown Prosecution Service did not accept all aspects of his account, with a receipt found on his phone showing a payment of £481 sent back to Albania last year.
There were also a number of images which appeared to show him out socialising, despite claims that he was threatened with a knife when he tried to leave the property to visit cousins in London.
Kovaci, of no fixed address, initially denied producing cannabis but later changed his plea when a judge invited his defence team to reconsider the strength of evidence against him.
Neil Ronan mitigating said Kovaci had been working all the while he was in the UK to send money back to pay off debts for healthcare in northern Albania.
He said he had not seen his two-year-old daughter for around nine months, causing "an ache in his heart that is much worse than the confinement to his cell" at HMP Leeds where he has been held on remand since his arrest.
The judge, Mr Recorder Ben Cox QC, said: "Because of the seriousness of your offence, there must be a prison sentence. The shortest I can give in all the circumstances, consistent with my public duty, is one of eight months imprisonment."
He also ordered the destruction of the drugs and equipment found, as well as the forfeiture of the £100 found on Kovaci when he was arrested.