Skip to content
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

Py4JException when calling Keanu methods in python #375

Closed
johannespetrat opened this issue Nov 29, 2018 · 2 comments
Closed

Py4JException when calling Keanu methods in python #375

johannespetrat opened this issue Nov 29, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@johannespetrat
Copy link
Contributor

Describe the bug
I can import keanu-python, but Py4J throws an error whenever I call a keanu method.
Stacktrace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/johannespetrat/anaconda2/envs/py37/lib/python3.7/site-packages/keanu/vertex/generated.py", line 162, in ConstantDouble
    return Double(context.jvm_view().ConstantDoubleVertex, constant)
  File "/Users/johannespetrat/anaconda2/envs/py37/lib/python3.7/site-packages/keanu/vertex/base.py", line 21, in __init__
    val = ctor(*(Vertex.__parse_args(args)))
  File "/Users/johannespetrat/anaconda2/envs/py37/lib/python3.7/site-packages/py4j/java_gateway.py", line 1554, in __call__
    answer, self._gateway_client, None, self._fqn)
  File "/Users/johannespetrat/anaconda2/envs/py37/lib/python3.7/site-packages/py4j/protocol.py", line 332, in get_return_value
    format(target_id, ".", name, value))
py4j.protocol.Py4JError: An error occurred while calling None.io.improbable.keanu.vertices.dbl.nonprobabilistic.ConstantDoubleVertex. Trace:
py4j.Py4JException: Constructor io.improbable.keanu.vertices.dbl.nonprobabilistic.ConstantDoubleVertex([class io.improbable.keanu.vertices.dbl.nonprobabilistic.ConstantDoubleVertex]) does not exist
	at py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:179)
	at py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:196)
	at py4j.Gateway.invoke(Gateway.java:237)
	at py4j.commands.ConstructorCommand.invokeConstructor(ConstructorCommand.java:80)
	at py4j.commands.ConstructorCommand.execute(ConstructorCommand.java:69)
	at py4j.GatewayConnection.run(GatewayConnection.java:238)
	at java.lang.Thread.run(Thread.java:748)

To Reproduce
Steps to reproduce the behaviour:

  1. Create a conda environment with python 3.7.0
  2. Run pip install keanu
  3. Open the python shell
  4. Run import keanu
  5. Run keanu.vertext.ConstantDouble(1.)

Expected behavior
This should create a ConstantDoubleVertex.

Desktop (please complete the following information):

  • OS: MacOS High Sierra
  • Python 3.7.0
  • Anaconda 4.4.10
@johannespetrat johannespetrat added the bug Something isn't working label Nov 29, 2018
@migwellian
Copy link
Contributor

Hi Johannes, it works when you use Const instead of ConstDouble (the double type is inferred). We'll look into why it fails with ConstDouble and make a fix.

@johannespetrat
Copy link
Contributor Author

Cool, thanks a lot for clarifying this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants