I've worked as both a developer and author for a couple decades, so I've seen this a few times myself.
It isn't clear to me whether this is a personal project or a work project. (I'm hoping with nothing done after 6 months, it's a personal project, but it might just be a minor item on a gargantuan corporate to-do list.)
I agree with those who've advised "changing things up" a bit. Exercise and/or play a musical instrument. If you already do, pick something new to try, where you have to learn a new motor skill. You'll get to use your brain in a different way. I recommend fire staff twirling (without the fire of course, at least to start) or juggling. Both of these require intense focus, like that required for coding, but it's a different context. Learning a musical instrument works for a lot of people, but didn't work for me; staff twirling on the other hand is just magic, for what it does for my concentration and, through the process of learning new tricks, determination and sense of forward motion.
I also agree with, find a buddy you can discuss this with on a regular basis. Maybe more than one buddy (a UI guy, and an algorithms, or database, or framework guy depending on what your project involves). This is probably easier to do for a personal project than for a work project unless you are on great terms with a coworker; most workplaces I've seen lately are very busy. It provides accountability plus, as another poster pointed out, that all-too-important voice of reason when you're stuck on a winding road and someone can point out the straight line you've missed. If this is a personal project and you think you have The Next Big Internet Idea and you don't want to cut someone else in, well, you either get it done or you don't. Your choice. If you don't do it, someone else will, and they might already be working on it indepedent of you. If it's a personal project, maybe you can farm part of it out to someone else to get it started? Even if it's The Next Big Idea and you don't want to talk about, maybe you can talk about PART of it without giving away the whole thing? If you have a sorta-technical-but-not-really friend, they can be good to bounce ideas off of -- if you can explain things in a way that they understand, then that is feedback to you that YOU understand.
If this is a personal project, for gods sake, LEAVE THE HOUSE! Take your notebook to the nearest coffee shop, shared-workspace office, pub, or wherever. I find that having life going on around me shuts off random thoughts that get in the way of getting things done sometimes. It sounds like you've already tried the reverse (alone, quiet), but if you haven't, try that, too. The "leave the house" strategy is particularly good, for me, for more rote-type activities, like keying in database schema that can be a bit repetitive and don't require much creative thought. For creative thought, I like to go hide, and often take breaks every couple of hours to keep myself fresh.
If this is a work project, change up your environment somehow. While working as a contractor a few years ago, I was doing a project involving several layers of components in multiple languages (ajax, server-side stuff, glue scripts, random on-the-fly generated script, build and verification tools). Debubgging it was not straightforward, complete with conferences with devs responsible for other components when there was an issue whose cause was not readily apparent. Although we were supposed to be butts-in-seats visible every hour we were on the clock, my management trusted me and I just sent them a note saying, "I'm going to go hide and get this done. I will be on premises, so technically still within the rules, but won't be on email, won't be easy to find and will have working code before Monday. If you absolutely need to know where I am, call my cell phone." As I recall, they had working code the Thursday before that Monday. Once I went into "war" mode, made things NOT like business as usual by finding another place to work for a couple days, laser focus and professional pride took over, and that was that. I changed the rules a bit to rules that would actually WORK given our time constraint, grabbing a copy of the others' code, and making my own changes to it because it was often faster to locate and fix the bug myself, than to convince the person who owned the code that it had an issue. Under less urgent circumstances, it's better to have that dialogue, because I had been doing a bit of useful education by letting folks puzzle over what was wrong with their code, but in this case, we were too close to due date and that tradeoff was necessary. I sent the changes required in others' components back to them for review, and everything got checked in before Monday.
As others have pointed out, changing your choice of beverage may be useful as well. If caffeine works, try that. If beer's what puts you in more of a coding frame of mind, go for it (but not on the clock if your employer doesn't sanction it!). Microsoft used to have beer bashes once or twice a month on Friday afternoons. You'd think many people went home after them. You'd be partially right. But many people stuck around and went back to work, refreshed and in a different frame of mind -- yeee ha, the manager is gone, all the PMs are gone, it's time for us to get things done! I wouldn't recommend that strategy for live updates to amazon.com or modifying the software in your homemade aircraft, of course.
Good luck.