Skip to content

PyQt5 and pandas #16322

Closed
Closed
@dibgerge

Description

@dibgerge

I just updated my conda installation to Pandas 0.20.1, and it does not load anymore since it depends on PyQt4 which was updated to PyQt5.

To make Pandas 0.20.1 load with PyQt5, I have to modify a function within the pandas.io.clipboard.clipboards module as follows:

Modified function within pandas.io.clipboard.clipboards

def init_qt_clipboard():
    # $DISPLAY should exist
    from PyQt5.QtWidgets import QApplication

    # use the global instance if it exists
    app = QApplication.instance() or QApplication([])

    def copy_qt(text):
        cb = app.clipboard()
        cb.setText(text)

    def paste_qt():
        cb = app.clipboard()
        return text_type(cb.text())

    return copy_qt, paste_qt

Problem description

The current behavior requires PyQt4 by default, even if it is not needed to be used, which was giving me the error when import pandas:

ImportError: No module named 'PyQt4.QtGui'.

Changing the module as described above solved the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions