LC_
LC_

Reputation: 71

QT_API environment variable

I use formlayout and I'm finally transitioning to PyQt5. formlayout is failing to import on:

ImportError: formlayout requires PyQt4, PyQt5 or PySide

It looks like the issue is that my QT_API environment variable isn't set and the module defaults to PyQt4. I could set the environment variable to PyQt5, but I go back and forth between Anaconda environments with PyQt4 and PyQt5 so I would rather not have to manually set that each time. Am I missing something? How is that environment variable normally set?

It seems like the module could attempt to import either version without looking at the QT_API but I suspect I'm missing the intent.

I'm using python 2.7.13, pyqt 5.6.0 and formlayout 1.1.0.

Upvotes: 0

Views: 4910

Answers (1)

LC_
LC_

Reputation: 71

Based on feedback from ekhumoro and eyllanesc, and issue 87 and 88, I think there are a few options:

  1. Assign the QT_API environment variably globally.

  2. Assign the variable on a per-project basis using import os os.environ["QT_API"] = "pyqt5"

  3. Fork formlayout and "fix" the dependency check logic.

Upvotes: 5

Related Questions