1

I am just starting with Kotlin and Intellij Idea. I managed to create a project for a console application and run a program with a few lines of code. I wanted my program to read a dataframe and tried to install the package dataframe but could not do it.

Following the author's instructions I added

implementation 'org.jetbrains.kotlinx:dataframe:0.8.1'

to the dependencies section of the file build.gradle.kts. That did not work. I added parentheses and replaced the single quotes with double quotes:

implementation("org.jetbrains.kotlinx:dataframe:0.8.1")

Then I got the following message:

warning: default scripting plugin is disabled: The provided plugin org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar is not compatible with this version of compiler
error: unable to evaluate script, no scripting plugin loaded

Any suggestions will be greatly appreciated. This is well over my head. but could not

Soldalma
  • 4,636
  • 3
  • 25
  • 38

1 Answers1

3

The second one you listed, implementation("org.jetbrains.kotlinx:dataframe:0.8.1"), is the correct syntax to use in Gradle's Kotlin DSL.

The error points to an issue with the Kotlin compiler version you're using. Want to try setting that to the latest version? Here's a thread on how to do that.

davidmerrick
  • 1,027
  • 1
  • 10
  • 17
  • I have Kotlin compiler version 1.7.21, Language version and API version both Latest stable (1.7) and Target JVM version 18. I tried changing all these settings in a variety of ways and always got the same error message. I see a message on the Kotlin Compiler page: Following modules override project settings: Progam4.main, Program4.test. – Soldalma Nov 22 '22 at 23:11
  • Progress: following @davidmerrick's advice I was able to add the two lines: ```implementation("com.github.holgerbrandl:krangl:0.18.4") implementation("org.jetbrains.kotlinx:dataframe:0.8.1")``` to `build.gradle.kts` and have the program run without errors. However, when I add code that uses one of the two packages I get `unresolved reference: DataFrame` or similar. Maybe I need a command `using MyPackage` or similar, like in other languages. – Soldalma Nov 22 '22 at 23:33
  • Sometimes, you need to force a refresh of Gradle dependencies. You can do that with this: https://www.jetbrains.com/idea/guide/tutorials/working-with-gradle/gradle-dependencies/#:~:text=We%20can%20do%20this%20by,O%20(Windows%2FLinux) – davidmerrick Nov 22 '22 at 23:39
  • I managed to make it run code from the dataframe package. Things that helped were 1) closing IntelliJ Idea and reopening it, and 2) deleting manually a folder after getting a message the IDE could not delete it, 3) add the line ```import org.jetbrains.kotlinx.dataframe.api.*``` (oddly `krangl` did not need a similar statement. – Soldalma Nov 23 '22 at 00:03