From 816f623dd8ffc530e617928eeac67821cd6c3075 Mon Sep 17 00:00:00 2001 From: Marko Toplak Date: Fri, 10 Sep 2021 14:20:06 +0200 Subject: [PATCH] setup.py: do not overwrite conda's PyQt5 The PyQt5 dependency conflicts with conda, where the same package is called pyqt. Installing pyqt5 inside a conda environment that already contains pyqt may be catastrophic. Removing the dependency makes pip installation into conda environments safer; such installations frequently occur when users install an add-on not available in the conda repos that requires a newer version of Orange. The same issue appears when Anaconda users try to update Orange with the Add-on dialog box. Or when someone who installed Orange with conda downloads the master branch and does "pip install -e .". Orange added the PyQt5 dependency about a year ago to make pip installations friendlier. Unfortunately, that caused more problems than it fixed. This commit modifies setup.py to only installs PyQt5 in a conda environment if PyQt5 could not be imported. I presume this is safe. --- requirements-gui.txt | 2 -- requirements-pyqt.txt | 2 ++ setup.py | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 requirements-pyqt.txt diff --git a/requirements-gui.txt b/requirements-gui.txt index 0eb8d96df49..ba664128b4a 100644 --- a/requirements-gui.txt +++ b/requirements-gui.txt @@ -1,8 +1,6 @@ orange-canvas-core>=0.1.21,<0.2a orange-widget-base>=4.13.0 -PyQt5>=5.12,!=5.15.1 # 5.15.1 skipped because of QTBUG-87057 - affects select columns -PyQtWebEngine>=5.12 AnyQt>=0.0.11 pyqtgraph>=0.11.1 diff --git a/requirements-pyqt.txt b/requirements-pyqt.txt new file mode 100644 index 00000000000..d5d33de1c55 --- /dev/null +++ b/requirements-pyqt.txt @@ -0,0 +1,2 @@ +PyQt5>=5.12,!=5.15.1 # 5.15.1 skipped because of QTBUG-87057 - affects select columns +PyQtWebEngine>=5.12 \ No newline at end of file diff --git a/setup.py b/setup.py index b56fdbcda7d..ae38552b5ef 100755 --- a/setup.py +++ b/setup.py @@ -34,6 +34,13 @@ except ImportError: have_cython = False +try: + import PyQt5.QtCore # pylint: disable=unused-import + have_pyqt5 = True +except ImportError: + have_pyqt5 = False + +is_conda = os.path.exists(os.path.join(sys.prefix, 'conda-meta')) NAME = 'Orange3' @@ -78,6 +85,12 @@ requirements = ['requirements-core.txt', 'requirements-gui.txt'] +# pyqt5 is named pyqt5 on pypi and pyqt on conda +# due to possible conflicts, skip the pyqt5 requirement in conda environments +# that already have pyqt +if not (is_conda and have_pyqt5): + requirements.append('requirements-pyqt.txt') + INSTALL_REQUIRES = sorted(set( line.partition('#')[0].strip() for file in (os.path.join(os.path.dirname(__file__), file)