Search code examples
pythonpyqt4

PyQt4 Error ValueError: PyCapsule_GetPointer called with incorrect name only in debug mode


When I run my program (using visual studio code) in debug mode I get the above mentioned error.

PyQt4 Error ValueError: PyCapsule_GetPointer called with incorrect name

However when I run the code without debugging, also via visual studio code Everything works fine.

When I googled I found this question but there is no mention of debug vs normal mode and therefore I do not directly see the connection.

I use anaconda to control my environments.


Solution

  • I was having the same issue, while I'm not sure if this is the best solution, what worked for me was to uninstall all of my python packages and reinstall everything.

    To get all of your packages

    pip freeze > requirements.txt
    

    Remove them all at once

    pip uninstall -r requirements.txt -y
    

    Or remove one by one (This might be better because you can pick and choose which to uninstall if you want)

    pip uninstall -r requirements.txt
    

    Then reinstall PyQt4 using the .whl file and whatever other packages you need again.

    This might be overkill, but it worked for me. I had both PyQt4 and PyQt5 installed as well as PyQt5-sip. The issue might be coming from having both the 4 and 5 packages installed? I'm not sure since I didn't try removing the PyQt5 and seeing if that fixed anything.