neo4j / graph-data-science

Source code for the Neo4j Graph Data Science library of graph algorithms.
https://neo4j.com/docs/graph-data-science/current/
Other
596 stars 157 forks source link

build failed following readme #235

Closed choleraehyq closed 1 year ago

choleraehyq commented 1 year ago

Describe the bug

I followed the readme and tried to run the tests, but an error prompted:

➜  graph-data-science git:(master) ✗ ./gradlew check

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':neo4j-kernel-adapter-5.1:compileJava'.
> Could not resolve all task dependencies for configuration ':neo4j-kernel-adapter-5.1:compileClasspath'.
   > Could not resolve project :neo4j-kernel-adapter-api.
     Required by:
         project :neo4j-kernel-adapter-5.1
      > No matching variant of project :neo4j-kernel-adapter-api was found. The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - Variant 'apiElements' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03 declares an API of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'mainSourceElements' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03 declares a component, and its dependencies declared externally:
              - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them preferably in the form of class files)
                  - Doesn't say anything about its usage (required an API)
          - Variant 'runtimeElements' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'testResultsElementsForTest' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03:
              - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them preferably in the form of class files)
                  - Doesn't say anything about its usage (required an API)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 744ms

I've already installed java 11 and 17 using sdkman

 Temurin       |     | 19           | tem     |            | 19-tem
               |     | 19.0.1       | tem     |            | 19.0.1-tem
               | >>> | 17.0.5       | tem     | installed  | 17.0.5-tem
               |     | 17.0.4.1     | tem     |            | 17.0.4.1-tem
               |     | 11.0.17      | tem     | installed  | 11.0.17-tem
               |     | 11.0.16.1    | tem     |            | 11.0.16.1-tem

To Reproduce

GDS version: master(f3bb3a450258f9a705932d8e1c2e3be423faaa46) Neo4j version: no Operating system: (for example Windows 95/Ubuntu 16.04) macOS 13.0.1

Steps to reproduce the behavior:

Simply run ./gradlew check

Expected behavior

Successfully run tests.

Additional context

No.

vnickolov commented 1 year ago

Hi @choleraehyq thank you for reporting this, if you want to build the project against Neo4j 5.1 you should use (not just have it installed) JDK17, please give it a try and let us know.

choleraehyq commented 1 year ago

@vnickolov Hi, I've already used sdk default java 17.0.5-tem to make JDK 17 default.

➜  graph-data-science git:(master) ✗ java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode)
vnickolov commented 1 year ago

@choleraehyq thank you for the update, I managed to successfully run the above by cleaning the build first

./gradlew clean check

Can you please try that?

choleraehyq commented 1 year ago

@vnickolov Still got the same error.

➜  graph-data-science git:(master) ✗ java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8)
OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode)
➜  graph-data-science git:(master) ✗ ./gradlew clean check

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':neo4j-kernel-adapter-5.1:compileJava'.
> Could not resolve all task dependencies for configuration ':neo4j-kernel-adapter-5.1:compileClasspath'.
   > Could not resolve project :neo4j-kernel-adapter-api.
     Required by:
         project :neo4j-kernel-adapter-5.1
      > No matching variant of project :neo4j-kernel-adapter-api was found. The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - Variant 'apiElements' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03 declares an API of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'mainSourceElements' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03 declares a component, and its dependencies declared externally:
              - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them preferably in the form of class files)
                  - Doesn't say anything about its usage (required an API)
          - Variant 'runtimeElements' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
          - Variant 'testResultsElementsForTest' capability org.neo4j.gds:neo4j-kernel-adapter-api:2.3.0-alpha03:
              - Incompatible because this component declares a component of category 'verification' and the consumer needed a library
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 11)
                  - Doesn't say anything about its elements (required them preferably in the form of class files)
                  - Doesn't say anything about its usage (required an API)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 917ms
FlorentinD commented 1 year ago

Hello @choleraehyq, I could reproduce your error locally and we could also find out the solution.

The problem lies in which Neo4j version we use to build the jar. By default we use Neo4j 4.4.15 which only works with Java 11.

So you have to options: (a) Switch to Java 11 as your selected java version. (b) If you want to build against Neo4j 5.x, you can run the tasks with -Pneo4jVersion=5.2.0 (or any other neo4j version)

Hope this resolves your problem. If you dont mind, I would interested in your use-case for GDS :)

choleraehyq commented 1 year ago

@FlorentinD I tried option a, and it worked! Thank you.

I'm a database developer, trying to learn how to combine complex algorithm computing and database from neo4j. I'm not going to use GDS in production, sorry :-(

FlorentinD commented 1 year ago

Great!

No worries, I was just curios. Good luck then. If you have general questions, I can also recommend the community forum or our discord server :)