在Palantir Foundry中使用GraphFrames时Gradle构建报错求助
问题
我想在Palantir Foundry代码仓库中结合PySpark使用GraphFrames包。根据官方文档指引,已将graphframes包加入待安装的conda库列表,但还需在Spark会话初始化时安装服务端jar。于是我修改了transforms-python/build.gradle文件,添加了相关配置:
// DO NOT MODIFY THIS FILE buildscript { repositories { maven { credentials { username '' password project.transformsBearerToken } authentication { basic(BasicAuthentication) } url project.transformsMavenProxyRepoUri } } dependencies { classpath "com.palantir.transforms:transforms-gradle-plugin:${transformsVersion}" } } apply plugin: 'com.palantir.transforms-defaults' dependencies { condaJars 'graphframes:graphframes:0.8.1-spark3.0-s_2.12' }
保存修改并重新加载页面后,出现代码辅助错误:
FAILURE: Build failed with an exception. * Where: Build file '/scratch/standalone/1c8fbb49-de4d-4c21-8081-47c92748189a/code-assist/contents/build.gradle' line: 24 * What went wrong: A problem occurred evaluating root project 'feature-generation'. > Could not find method condaJars() for arguments [graphframes:graphframes:0.8.1-spark3.0-s_2.12] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. * Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
报错原因及解决方法
报错原因
condaJars并非Foundry transforms-gradle-plugin支持的依赖配置项,当前版本插件中不存在该方法,Gradle无法识别此配置,因此触发构建失败。
解决步骤
- 替换依赖配置项:将
condaJars改为插件支持的sparkJars,修改build.gradle的dependencies块:
dependencies { sparkJars 'graphframes:graphframes:0.8.1-spark3.0-s_2.12' }
- 确认conda依赖配置:确保
environment.yml中已添加对应版本的graphframes conda包:
name: transforms-python channels: - conda-forge dependencies: - python=3.8 - graphframes=0.8.1
完成上述修改后,重新加载代码仓库,代码辅助与构建即可正常运行。
内容的提问来源于stack exchange,提问作者Grigory Sharkov
相关产品推荐
相关产品推荐

