gpt4 book ai didi

docker - 在Dockerfile中安装pyspark

转载 作者:行者123 更新时间:2023-12-02 19:23:07 24 4
gpt4 key购买 nike

我有一个Dockerfile如下

FROM python:3.7

RUN apt-get update
RUN apt-get install default-jdk -y

COPY requirements.txt ./
RUN pip install -r requirements.txt

我在GitLab上的CI管道中使用了它,并且工作正常。

但是,最近它已停止工作。我尚未更新 requirements.txt文件,所以这可能是因为 default-jdk已更改吗?

我应该如何更新我的Dockerfile,以便它现在可以正确安装pyspark?

编辑

错误示例:
/usr/local/lib/python3.7/site-packages/pyspark/rdd.py:824: in collect
port = self.ctx._jvm.PythonRDD.collectAndServe(self._jrdd.rdd())
/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py:1160: in __call__
answer, self.gateway_client, self.target_id, self.name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

answer = 'xro1291'
gateway_client = <py4j.java_gateway.GatewayClient object at 0x7f6490c2a350>
target_id = 'z:org.apache.spark.api.python.PythonRDD', name = 'collectAndServe'

def get_return_value(answer, gateway_client, target_id=None, name=None):
"""Converts an answer received from the Java gateway into a Python object.

For example, string representation of integers are converted to Python
integer, string representation of objects are converted to JavaObject
instances, etc.

:param answer: the string returned by the Java gateway
:param gateway_client: the gateway client used to communicate with the Java
Gateway. Only necessary if the answer is a reference (e.g., object,
list, map)
:param target_id: the name of the object from which the answer comes from
(e.g., *object1* in `object1.hello()`). Optional.
:param name: the name of the member from which the answer comes from
(e.g., *hello* in `object1.hello()`). Optional.
"""
if is_error(answer)[0]:
if len(answer) > 1:
type = answer[1]
value = OUTPUT_CONVERTER[type](answer[2:], gateway_client)
if answer[1] == REFERENCE_TYPE:
raise Py4JJavaError(
"An error occurred while calling {0}{1}{2}.\n".
> format(target_id, ".", name), value)
E py4j.protocol.Py4JJavaError: An error occurred while calling z:org.apache.spark.api.python.PythonRDD.collectAndServe.
E : java.lang.IllegalArgumentException
E at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
E at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
E at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
E at org.apache.spark.util.ClosureCleaner$.getClassReader(ClosureCleaner.scala:46)
E at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:449)
E at org.apache.spark.util.FieldAccessFinder$$anon$3$$anonfun$visitMethodInsn$2.apply(ClosureCleaner.scala:432)
E at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:733)
E at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
E at scala.collection.mutable.HashMap$$anon$1$$anonfun$foreach$2.apply(HashMap.scala:103)
E at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:230)
E at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:40)
E at scala.collection.mutable.HashMap$$anon$1.foreach(HashMap.scala:103)
E at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:732)
E at org.apache.spark.util.FieldAccessFinder$$anon$3.visitMethodInsn(ClosureCleaner.scala:432)
E at org.apache.xbean.asm5.ClassReader.a(Unknown Source)
E at org.apache.xbean.asm5.ClassReader.b(Unknown Source)
E at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
E at org.apache.xbean.asm5.ClassReader.accept(Unknown Source)
E at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:262)
E at org.apache.spark.util.ClosureCleaner$$anonfun$org$apache$spark$util$ClosureCleaner$$clean$14.apply(ClosureCleaner.scala:261)
E at scala.collection.immutable.List.foreach(List.scala:381)
E at org.apache.spark.util.ClosureCleaner$.org$apache$spark$util$ClosureCleaner$$clean(ClosureCleaner.scala:261)
E at org.apache.spark.util.ClosureCleaner$.clean(ClosureCleaner.scala:159)
E at org.apache.spark.SparkContext.clean(SparkContext.scala:2292)
E at org.apache.spark.SparkContext.runJob(SparkContext.scala:2066)
E at org.apache.spark.SparkContext.runJob(SparkContext.scala:2092)
E at org.apache.spark.rdd.RDD$$anonfun$collect$1.apply(RDD.scala:939)
E at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
E at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
E at org.apache.spark.rdd.RDD.withScope(RDD.scala:363)
E at org.apache.spark.rdd.RDD.collect(RDD.scala:938)
E at org.apache.spark.api.python.PythonRDD$.collectAndServe(PythonRDD.scala:153)
E at org.apache.spark.api.python.PythonRDD.collectAndServe(PythonRDD.scala)
E at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
E at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
E at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
E at java.base/java.lang.reflect.Method.invoke(Method.java:566)
E at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
E at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
E at py4j.Gateway.invoke(Gateway.java:282)
E at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
E at py4j.commands.CallCommand.execute(CallCommand.java:79)
E at py4j.GatewayConnection.run(GatewayConnection.java:214)
E at java.base/java.lang.Thread.run(Thread.java:834)

/usr/local/lib/python3.7/site-packages/py4j/protocol.py:320: Py4JJavaError

最佳答案

将基本图像更改为python:3.7-stretch对我有用

关于docker - 在Dockerfile中安装pyspark,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58283180/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com