I saved a pre-trained model from spark-nlp, then I'm trying to run a Python script in Pycharm with anaconda env:
Model_path = "./xxx"
model = PipelineModel.load(Model_path)
But I got the following error:
(I tried with pyspark 2.4.4 & spark-nlp2.4.4, and pyspark 2.4.4 & spark-nlp2.5.4)
Got the same error:
21/02/05 13:31:21 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).
Traceback (most recent call last):
File "C:/Users/xxxx/xxxxx.py", line 381, in <module>
model = PipelineModel.load(Model_path)
File "C:Usersxxxxxxxxanaconda3envspython3.7libsite-packagespysparkmlutil.py", line 362, in load
return cls.read().load(path)
File "C:Users\xxxxxxxxanaconda3envspython3.7libsite-packagespysparkmlpipeline.py", line 242, in load
return JavaMLReader(self.cls).load(path)
File "C:Usersxxxxxxxxanaconda3envspython3.7libsite-packagespysparkmlutil.py", line 300, in load
java_obj = self._jread.load(path)
File "C:Usersxxxxxxxxanaconda3envspython3.7libsite-packagespy4jjava_gateway.py", line 1257, in __call__
answer, self.gateway_client, self.target_id, self.name)
File "C:Usersxxxxxxxxanaconda3envspython3.7libsite-packagespysparksqlutils.py", line 63, in deco
return f(*a, **kw)
File "C:Usersxxxxxxxxanaconda3envspython3.7libsite-packagespy4jprotocol.py", line 328, in get_return_value
format(target_id, ".", name), value)
py4j.protocol.Py4JJavaError: An error occurred while calling o314.load.
: java.lang.ClassNotFoundException: com.johnsnowlabs.nlp.DocumentAssembler
I'm new to pyspark and spark-nlp, might someone be able to help please?
question from:
https://stackoverflow.com/questions/66064423/java-lang-classnotfoundexception-com-johnsnowlabs-nlp-documentassembler-spark-i 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…