Skip to content

Commit d4ff738

Browse files
authored
Add explicit warning if cython is not available in setup.py (#37953)
1 parent f7c280c commit d4ff738

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

sdks/python/setup.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ def cythonize(*args, **kwargs):
138138
e.include_dirs.append(numpy.get_include())
139139
return extensions
140140
except ImportError:
141+
warnings.warn(
142+
"Cython not found, cython extensions will not be generated. " \
143+
"To use cythonized extensions, pip install cython and run " \
144+
"python setup.py build_ext --inplace"
145+
)
141146
cythonize = lambda *args, **kwargs: []
142147

143148
# [BEAM-8181] pyarrow cannot be installed on 32-bit Windows platforms.
@@ -169,7 +174,7 @@ def cythonize(*args, **kwargs):
169174
'langchain',
170175
'sentence-transformers>=2.2.2',
171176
'skl2onnx',
172-
'pyod>=0.7.6', # 0.7.5 crashes setuptools
177+
'pyod>=0.7.6', # 0.7.5 crashes setuptools
173178
'tensorflow',
174179
# tensorflow transitive dep, lower versions not compatible with Python3.10+
175180
'absl-py>=0.12.0',
@@ -541,8 +546,7 @@ def get_portability_package_data():
541546
'datatable',
542547
# tensorflow-transform requires dill, but doesn't set dill as a
543548
# hard requirement in setup.py.
544-
'dill',
545-
# match tft extra.
549+
'dill', # match tft extra.
546550
'tensorflow_transform>=1.14.0,<1.15.0',
547551
# TFT->TFX-BSL require pandas 1.x, which is not compatible
548552
# with numpy 2.x
@@ -556,7 +560,7 @@ def get_portability_package_data():
556560
# 'xgboost<2.0', # https://github.com/apache/beam/issues/31252
557561
] + ml_base,
558562
'p310_ml_test': [
559-
'datatable',
563+
'datatable',
560564
] + ml_base,
561565
'p312_ml_test': [
562566
'datatable',
@@ -597,8 +601,7 @@ def get_portability_package_data():
597601
# https://docs.google.com/document/d/1c84Gc-cZRCfrU8f7kWGsNR2o8oSRjCM-dGHO9KvPWPw/edit?usp=sharing
598602
'torch': ['torch>=1.9.0,<2.8.0'],
599603
'tensorflow': [
600-
'tensorflow>=2.12rc1,<2.21',
601-
# tensorflow transitive dep
604+
'tensorflow>=2.12rc1,<2.21', # tensorflow transitive dep
602605
'absl-py>=0.12.0'
603606
],
604607
'transformers': [
@@ -609,8 +612,7 @@ def get_portability_package_data():
609612
'ml_cpu': [
610613
'tensorflow>=2.12.0',
611614
'torch==2.8.0+cpu',
612-
'transformers>=4.28.0,<4.56.0',
613-
# tensorflow transient dep
615+
'transformers>=4.28.0,<4.56.0', # tensorflow transient dep
614616
'absl-py>=0.12.0'
615617
],
616618
'redis': ['redis>=5.0.0,<6'],
@@ -630,8 +632,7 @@ def get_portability_package_data():
630632
'tensorflow==2.11.0',
631633
'tf2onnx==1.13.0',
632634
'skl2onnx==1.13',
633-
'transformers==4.25.1',
634-
# tensorflow transient dep
635+
'transformers==4.25.1', # tensorflow transient dep
635636
'absl-py>=0.12.0'
636637
],
637638
'xgboost': ['xgboost>=1.6.0,<2.1.3', 'datatable==1.0.0'],

0 commit comments

Comments
 (0)