-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get 'JavaPackage' object is not callable
error when instantiating annotators
#575
Comments
Hi, how did you install or use Spark NLP? |
1/ I followed this tutorial https://medium.com/big-data-engineering/how-to-install-apache-spark-2-x-in-your-pc-e2047246ffc3
|
If you want to use Python, I suggest the following:
pip install pyspark==2.4.3
pip install spark-nlp==2.1.0
import sparknlp
spark = sparknlp.start()
print("Spark NLP version")
sparknlp.version()
print("Apache Spark version")
spark.version This should start SparkSession with Spark NLP included. Then you can run the next just for testing purpose as an example: from sparknlp.pretrained import PretrainedPipeline
pipeline = PretrainedPipeline('recognize_entities_dl', 'en')
result = pipeline.annotate('Harry Potter is a great movie')
print(result['entities']) If you still receive any Java-related error then it's about how you installing Apache Spark and Java 8 on Windows. You should ask/search in Apache Spark communities. |
tnx maziyar.
2/ I can still replace the 3/ I can also run 4/ When running your code in an isolated python console, it fails on the Anything else I could try, before I "should ask/search in Apache Spark communities"? tnx in advance |
If this works in Python, Jupyter, and PySpark, I think you should follow this with PyCharm community and check your settings for Conda or Java on Windows. I’m afraid this is not Spark NLP related. |
@nj-dsg I had this same issue and what solved my problem (and I didn't see anyone mention it here) was parametrizing the package for PySpark and spark-submit in the command line: |
I get a
'JavaPackage' object is not callable
when I try to instantiate a pyspark NLP-related class like: DocumentAssembler() or Finisher().Instantiating other classes like Pipeline() works fine.
Also, I do not get the above error, when running in a jupyter notebook. the error is raised when running in other python consoles. I installed pyspark on my windows 10, as in https://medium.com/big-data-engineering/how-to-install-apache-spark-2-x-in-your-pc-e2047246ffc3
and I also completed the tutorial in https://changhsinlee.com/install-pyspark-windows-jupyter/
here is my code:
I read that there's a spark-nlp.jar file that's important in this process, but I don't have it anywhere on my machine.
Any ideas?
tnx in advance
Description
Expected Behavior
instantiate a class
Current Behavior
Error:
'JavaPackage' object is not callable
Possible Solution
Steps to Reproduce
I installed pyspark on my windows 10, as in https://medium.com/big-data-engineering/how-to-install-apache-spark-2-x-in-your-pc-e2047246ffc3
and I also completed the tutorial in https://changhsinlee.com/install-pyspark-windows-jupyter/
then I installed
pip install pyspark, spark-nlp
here is my code:
Context
Your Environment
python 3
java 1.8
The text was updated successfully, but these errors were encountered: