Skip to content

'JavaPackage' object is not callable when importing bigdl layers #2729

@raphaelrbr

Description

@raphaelrbr

I am having trouble importing bigdl keras layers
from bigdl.nn.keras.layer import Input, Dense, merge, Convolution1D, MaxPooling1D, Reshape, Flatten

I am receiving

TypeErrorTraceback (most recent call last)
<ipython-input-5-06f013d33c29> in <module>()
----> 1 from bigdl.nn.keras.layer import Input, Dense, merge, Convolution1D, MaxPooling1D, Reshape, Flatten

/opt/anaconda2/lib/python2.7/site-packages/bigdl/nn/keras/__init__.py in <module>()
     16 from bigdl.util.common import *
     17 
---> 18 init_engine()
     19 redire_spark_logs()
     20 show_bigdl_info_logs()

/opt/anaconda2/lib/python2.7/site-packages/bigdl/util/common.pyc in init_engine(bigdl_type)
    415 
    416 def init_engine(bigdl_type="float"):
--> 417     callBigDlFunc(bigdl_type, "initEngine")
    418     # Spark context is supposed to have been created when init_engine is called
    419     get_spark_context()._jvm.org.apache.spark.bigdl.api.python.BigDLSerDe.initialize()

/opt/anaconda2/lib/python2.7/site-packages/bigdl/util/common.pyc in callBigDlFunc(bigdl_type, name, *args)
    577     gateway = _get_gateway()
    578     error = Exception("Cannot find function: %s" % name)
--> 579     for jinvoker in JavaCreator.instance(bigdl_type, gateway).value:
    580         # hasattr(jinvoker, name) always return true here,
    581         # so you need to invoke the method to check if it exist or not

/opt/anaconda2/lib/python2.7/site-packages/bigdl/util/common.pyc in instance(cls, bigdl_type, *args)
     54             with cls._lock:
     55                 if not cls._instance:
---> 56                     cls._instance = cls(bigdl_type, *args)
     57         return cls._instance
     58 

/opt/anaconda2/lib/python2.7/site-packages/bigdl/util/common.pyc in __init__(self, bigdl_type, gateway)
     91             jclass = getattr(gateway.jvm, creator_class)
     92             if bigdl_type == "float":
---> 93                 self.value.append(getattr(jclass, "ofFloat")())
     94             elif bigdl_type == "double":
     95                 self.value.append(getattr(jclass, "ofDouble")())

TypeError: 'JavaPackage' object is not callable

I've been reading about this issue and thinking if maybe is a environment variable problem, but i'm not having sucess debugging this.

I tried to set BIGDL_JAR variable as a system environment variable but didn't work.

Someone can help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions