Skip to content

Commit 959786b

Browse files
committed
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.
1 parent 53e2640 commit 959786b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

requirements-gui.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
orange-canvas-core>=0.1.21,<0.2a
22
orange-widget-base>=4.13.0
33

4-
PyQt5>=5.12,!=5.15.1 # 5.15.1 skipped because of QTBUG-87057 - affects select columns
5-
PyQtWebEngine>=5.12
64
AnyQt>=0.0.11
75

86
pyqtgraph>=0.11.1

requirements-pyqt.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PyQt5>=5.12,!=5.15.1 # 5.15.1 skipped because of QTBUG-87057 - affects select columns
2+
PyQtWebEngine>=5.12

setup.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
except ImportError:
3535
have_cython = False
3636

37+
try:
38+
import PyQt5.QtCore
39+
have_pyqt5 = True
40+
except ImportError:
41+
have_pyqt5 = False
42+
43+
is_conda = os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
3744

3845
NAME = 'Orange3'
3946

@@ -78,6 +85,12 @@
7885

7986
requirements = ['requirements-core.txt', 'requirements-gui.txt']
8087

88+
# pyqt5 is named pyqt5 on pypi and pyqt on conda
89+
# due to possible conflicts, skip the pyqt5 requirement in conda environments
90+
# that already have pyqt
91+
if not (is_conda and have_pyqt5):
92+
requirements.append('requirements-pyqt.txt')
93+
8194
INSTALL_REQUIRES = sorted(set(
8295
line.partition('#')[0].strip()
8396
for file in (os.path.join(os.path.dirname(__file__), file)

0 commit comments

Comments
 (0)