If you are a student, then you have, I think, two options. Struggle through the project to help assure your degree. Or drop it, which might require getting a different advisor or even moving to a new institution. Both of those have a downside, and only you can determine which is worse. If you only have a short time to finish your degree, then the first might be preferable. But if it is a long way off, then consider the second (with all of its implications).
The project is the responsibility of the PI, not yourself. So, think about how it meets your goals or fails to do so.
If you are a post doc then you may be stuck, depending on your contract and the need to have a good recommendation from the PI to be able to move on. But do move on as soon as possible.
If you are faculty already then I don't see much downside to just leaving, provided that it is financially feasible.
But, only you can balance the ups and downs of this. Think long term about your career, however, not just about the short term pain.