From no real programming experience, I taught myself Python in 2014, and spent 2015 learning Java. For many of those months, I treated it as a second job. Come home from work, strap on some headphones, open up the Python Docs or eventually the Java API reference, and go to town for anywhere from four to six hours.
I suffer from severe depression, known since I was a child, diagnosed officially in my 20s. I also suffer from generalized anxiety, and thus I have a very low tolerance for stress. It turned out, treating my learning as an every day second job (plus weekends) was not particularly healthy in combination with my psychological problems. I developed an incredible amount of anxiety, and seeing the smarmy, disingenuously complex answers to beginner questions on StackExchange/Overflow only added to the sense of total despair I would feel when I came upon a programming problem for which I could not find a suitable, ready answer.
However, in all of my despair, in all of my horror and anxiety, contemplation of suicide, hysterical sobbing, and every other bit of psychological drama my brain could cook up, I have never, NOT ONCE, come across a programming problem I could not eventually understand and solve. Sometimes all it took was a good night’s sleep. Other times, it took months of additional learning while I attacked a different problem for which the solution was more apparent. As long as you work at it, you will always continue to get better. Never give up on yourself.
IANAD, and these are not depression cures. If you suffer from or think you might suffer from clinical depression, please seek professional help.