путь сборки spark кросс-компилируется с несовместимой версией Scala (2.10.0)

Когда я пытаюсь выполнить код sparksql в scala IDE, я получаю сообщение об ошибке ниже. Может ли кто-нибудь помочь мне разобраться с этим, пожалуйста?

spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
akka-remote_2.10-2.3.11.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
akka-slf4j_2.10-2.3.11.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
breeze_2.10-0.11.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
breeze-macros_2.10-0.11.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
chill_2.10-0.5.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
jackson-module-scala_2.10-2.4.4.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
json4s-ast_2.10-3.2.10.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
json4s-core_2.10-3.2.10.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
json4s-jackson_2.10-3.2.10.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
quasiquotes_2.10-2.0.1.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
scalatest_2.10-2.2.5.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-catalyst_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
spark-core_2.10-1.5.2-tests.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spark-core_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
spark-graphx_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spark-launcher_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.    spark       Unknown Scala Version Problem
spark-mllib_2.10-1.4.0-tests.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-mllib_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
spark-network-common_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spark-network-shuffle_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-sql_2.10-1.4.0.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spark-streaming_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.   spark       Unknown Scala Version Problem
spark-unsafe_2.10-1.5.2.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
spire_2.10-0.7.4.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page. spark       Unknown Scala Version Problem
spire-macros_2.10-0.7.4.jar of spark build path is cross-compiled with an incompatible version of Scala (2.10.0). In case this report is mistaken, this check can be disabled in the compiler preference page.  spark       Unknown Scala Version Problem
The version of scala library found in the build path of spark (2.10.4) is prior to the one provided by scala IDE (2.11.7). Setting a Scala Installation Choice to match.    spark       Unknown Scala Version Problem

person kumar    schedule 29.12.2015    source источник
comment
См. этот похожий, но другой вопрос: версия компилятора scala для каждого проекта maven"> stackoverflow.com/questions/47206997/   -  person javaPlease42    schedule 09.11.2017


Ответы (4)


В вашем проекте вы используете jar-файлы, созданные с помощью разных версий Scala; действительно из лога:

  • Scala IDE использует Scala 2.11.7
  • Apache Spark 1.5.2, построенный на Scala 2.10

Вам нужно выровнять версии банок. На самом деле предварительная сборка Spark 1.5.2 (которую можно загрузить с здесь) была собрана со Scala 2.10 по соображениям совместимости. (см. здесь). На сайте есть примечание:

Примечание. Пользователи Scala 2.11 должны загрузить исходный пакет Spark и выполнить сборку с поддержкой Scala 2.11.

Чтобы решить эту проблему, используйте в своем проекте ту же версию Scala, которая использовалась для сборки Spark.

Я предлагаю попробовать переключиться на Scala 2.10 в вашей Scala IDE, и это решит проблему.

Eclipse + Maven

В моем случае я использую Eclipse со Scala IDE и Maven, поэтому я обновил зависимости Maven следующим образом:

<dependency>
    <groupId>org.scala-lang</groupId>
    <artifactId>scala-library</artifactId>
    <version>2.10.6</version>
</dependency>
<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-core_2.10</artifactId>
    <version>1.5.2</version>
</dependency>

Затем я изменил версию Scala в IDE: щелкните правой кнопкой мыши проект -> Scala -> установить установку Scala или щелкните правой кнопкой мыши контейнер библиотеки Scala -> свойства и выберите Scala 2.10, как показано ниже

Изменить версию Scala в Eclipse IDE

person Donato Pirozzi    schedule 02.01.2016
comment
У Scala-2.10 больше нет планового обслуживания. Есть веская причина вместо этого заставить проект работать со Spark и Scala-2.11. - person Randall Whitman; 05.04.2016
comment
Мне нужно найти способ исправить это автоматически. У меня более 20 проектов в рабочей области, и я не хочу вручную устанавливать версию компилятора Scala для каждого проекта. - person javaPlease42; 09.11.2017
comment
См. этот похожий, но другой вопрос: версия компилятора scala для каждого проекта maven"> stackoverflow.com/questions/47206997/ - person javaPlease42; 09.11.2017

Щелкните правой кнопкой мыши свой проект и выберите Свойства. Выберите Компилятор Scala Нажмите "Использовать настройки проекта" Выберите Установка Scala выберите свою версию Scala, например, 2.11.11.

person Yutong Han    schedule 17.12.2017

У меня была такая же проблема. Как я это решил. Встроенное в Scala Eclipse -> Проект -> Щелкните правой кнопкой мыши -> Проект -> Компилятор Scala -> С правой стороны вы получите список установки Scala -> Здесь выберите пакет Latest 2.10 (динамический).

Я проверил, и это сработало для меня нормально.

  • Бинод Суман
person Binod Suman    schedule 18.03.2018

«-Xsource: 2.11 -Ymacro-expand: none» решило мою проблему, просто обновил правой кнопкой мыши проект -> свойства -> компилятор Scala, дополнительный параметр командной строки, чтобы исправить этот «путь сборки кросс-компилируется с несовместимой версией Scala (2.11.0). Если этот отчет ошибочен, эту проверку можно отключить на странице настроек компилятора».

person Karthik Ramachandran    schedule 01.02.2018