# Trying to include tensorflow library in my ES plugin and getting the following error

**URL:** <https://discuss.elastic.co/t/trying-to-include-tensorflow-library-in-my-es-plugin-and-getting-the-following-error/300735>\
**Category:** Elasticsearch\
**Created:** [March 25, 2022, 10:05pm UTC](https://discuss.elastic.co/t/trying-to-include-tensorflow-library-in-my-es-plugin-and-getting-the-following-error/300735 "2022-03-25T22:05:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashwin91kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashwin91kumar/32/98900_2.png) [@ashwin91kumar](https://discuss.elastic.co/u/ashwin91kumar)\
**Post date:** [March 25, 2022, 10:05pm UTC](https://discuss.elastic.co/t/trying-to-include-tensorflow-library-in-my-es-plugin-and-getting-the-following-error/300735/1 "2022-03-25T22:05:01Z")

</div>

```auto
#8 6.878 -> Rolled back file:///plugins/plugin.zip
#8 6.878 Exception in thread "main" java.lang.IllegalStateException: codebase property already set: codebase.tensorflow-core-api -> file:/usr/share/elasticsearch/plugins/.installing-7277063629313084784/tensorflow-core-api-0.4.0.jar, cannot set to file:/usr/share/elasticsearch/plugins/.installing-7277063629313084784/tensorflow-core-api-0.4.0-linux-x86_64.jar
#8 6.879 at org.elasticsearch.bootstrap.PolicyUtil.readPolicy(PolicyUtil.java:268)
#8 6.879 at org.elasticsearch.bootstrap.PolicyUtil.readPolicyInfo(PolicyUtil.java:333)
#8 6.879 at org.elasticsearch.bootstrap.PolicyUtil.getPluginPolicyInfo(PolicyUtil.java:370)
#8 6.879 at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:889)
#8 6.879 at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245)
#8 6.879 at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:88)
#8 6.879 at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
#8 6.879 at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
#8 6.879 at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
#8 6.879 at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
#8 6.879 at org.elasticsearch.cli.Command.main(Command.java:77)
#8 6.879 at org.elasticsearch.plugins.cli.PluginCli.main(PluginCli.java:36)
#8 ERROR: executor failed running [/bin/sh -c elasticsearch-plugin install --batch file:///plugins/selection-es-rescore-plugin.zip]: exit code: 1

```

I'm trying to add the following dependency for my plugin:

```auto
 implementation( group: 'org.tensorflow', name: 'tensorflow-core-platform', version: '0.4.0')

```

I am getting the above exception. Can anyone help to resolve this?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 28, 2022, 8:33am UTC](https://discuss.elastic.co/t/trying-to-include-tensorflow-library-in-my-es-plugin-and-getting-the-following-error/300735/2 "2022-03-28T08:33:19Z")

</div>

Can you share the policy file of that plugin along with the output of `unzip -l` of the packaged plugin?

---

<div class="post-metadata">

**Author:** ![ashwin91kumar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashwin91kumar/32/98900_2.png) [@ashwin91kumar](https://discuss.elastic.co/u/ashwin91kumar)\
**Post date:** [March 28, 2022, 4:36pm UTC](https://discuss.elastic.co/t/trying-to-include-tensorflow-library-in-my-es-plugin-and-getting-the-following-error/300735/3 "2022-03-28T16:36:35Z")

</div>

Hi @spinscale ,  
This is the contents of policy file:

```auto
grant {
    permission java.io.FilePermission "/app/models/saved_model/*", "read";
    permission java.lang.RuntimePermission "getClassLoader";
    permission java.lang.RuntimePermission "setContextClassLoader";
    permission java.lang.RuntimePermission "accessDeclaredMembers";
    permission java.util.PropertyPermission "*", "read, write";
};

```

This is the output of the unzip -l:

```auto
  Length Date Time Name
--------- ---------- ----- ----
     1705 03-25-2022 15:07 plugin-descriptor.properties
    57096 03-25-2022 15:07 es-rescore-plugin.jar
     2371 03-25-2022 10:23 tensorflow-core-platform-0.4.0.jar
  8039455 03-25-2022 10:23 tensorflow-core-api-0.4.0.jar
101410625 03-25-2022 10:23 tensorflow-core-api-0.4.0-linux-x86_64.jar
101594815 03-25-2022 10:23 tensorflow-core-api-0.4.0-macosx-x86_64.jar
 58567796 03-25-2022 10:23 tensorflow-core-api-0.4.0-windows-x86_64.jar
   487566 03-25-2022 10:23 javacpp-1.5.6.jar
    25611 03-25-2022 10:23 javacpp-1.5.6-linux-x86_64.jar
    21901 03-25-2022 10:23 javacpp-1.5.6-macosx-x86_64.jar
  1305252 03-25-2022 10:23 javacpp-1.5.6-windows-x86_64.jar
  1635823 03-25-2022 10:23 protobuf-java-3.9.2.jar
   229133 03-15-2022 10:23 ndarray-0.3.3.jar
      503 03-25-2022 14:58 plugin-security.policy
--------- -------
273379652 14 files

```

TIA

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 29, 2022, 8:13am UTC](https://discuss.elastic.co/t/trying-to-include-tensorflow-library-in-my-es-plugin-and-getting-the-following-error/300735/4 "2022-03-29T08:13:59Z")

</div>

Hey,

so I think there might be an issue with the platform specific jars, so that `tensorflow-core-api-0.4.0.jar` and `tensorflow-core-api-0.4.0-linux-x86_64.jar` are both summarized as `tensorflow-core-api` and thus the plugin installer thinks this is a duplicate.

Can you open an issue for this in [Issues · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues)

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 26, 2022, 8:14am UTC](https://discuss.elastic.co/t/trying-to-include-tensorflow-library-in-my-es-plugin-and-getting-the-following-error/300735/5 "2022-04-26T08:14:43Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
