Skip to content

Commit 07678cc

Browse files
authored
More robust shared pyspark ml param import (#1796)
* deprecate pkg-resources * more robust import of _shared_pyspark_ml_param
1 parent 1751c7d commit 07678cc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

johnsnowlabs/nlp.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@
4141

4242

4343
if try_import_lib("pyspark"):
44-
import pyspark.ml.param.shared as _shared_pyspark_ml_param
44+
try:
45+
import pyspark.ml.param.shared as _shared_pyspark_ml_param
46+
except Exception as e:
47+
try:
48+
from pyspark.ml.param import shared as _shared_pyspark_ml_param
49+
except Exception as e:
50+
_shared_pyspark_ml_param = None
51+
4552
import pyspark.sql as SQL
4653
import pyspark.sql.functions as F
4754
import pyspark.sql.types as T

0 commit comments

Comments
 (0)