Not yet, though we’ve been trying to do so since at least the 1970s. Fabricating an environment that needs no power other than the sun and is a closed system (where waste gets broken down and reused) is extremely difficult.
One of the first attempts at a CELSS—Controlled Ecological Life Support System—was Bios-3, which was completed by Soviet scientists in Siberia in 1972. The 11,124-square-foot enclosed habitat could support three people. Oxygen was recycled by large pools of algae, and when everything ran right, the system could produce about 85 percent of the air and water its inhabitants required. The longest mission lasted 180 days.