Deductions & credits

There are two different choices. 1) The first year choice, 2) the choice to be treated as resident aliens for the entire year (in this case one of the spouses must be a resident alien at the end of the year).
Once you meet the substantial presence test in 2018, you can make the first years choice. That would change the residency starting date from January 2018 to October 2017. That would make you a dual status alien for the entire year 2017, but a resident alien at the end. Because of that, you can then make the choice, together with your spouse (this choice can only be made by married aliens), to be treated as resident aliens for the entire year. That choice will continue until revoked or you both are nonresident aliens again (for example after moving back).
To meet the test in 2018, you count all days in 2018 plus 1/3 the days of the year before plus 1/6 of the year before that. SO for example, you were in the US from October, that's roughly 90 days. That would count as 30 days in 2018, so you need another 153 days of presence in 2018 to be a resident alien. I would recommend filing an extension for the 2017 return, that will give you enough time to qualify. You will need to apply for an ITIN for your spouse together with the return.