0
我以前使用conda構建了pyspark環境來打包所有的依賴關係,並在運行時將它們發送到所有節點。以下是我創造環境:壓縮Conda環境打破Audioread的後端(Python/Pyspark)
`conda/bin/conda create -p conda_env --copy -y python=2 \
numpy scipy ffmpeg gcc libsndfile gstreamer pygobject audioread librosa`
`zip -r conda_env.zip conda_env`
然後採購conda_env
和運行pyspark
殼,我可以成功執行:未經環境
`import librosa
y, sr = librosa.load("test.m4a")`
說明來源的錯誤這個腳本結果的ffmpeg/GStreamer的不安裝在我的本地。
將腳本提交給集羣會導致librosa.load
錯誤,該錯誤可追溯到audioread
,指示在壓縮歸檔環境中無法再找到後端(gstreamer或ffmpeg)。堆棧跟蹤低於:
提交:
`PYSPARK_PYTHON=./NODE/conda_env/bin/python spark-submit --verbose \
--conf spark.yarn.appMasterEnv.PYSPARK_PYTHON=./NODE/conda_env/bin/python \
--conf spark.yarn.appMasterEnv.PYTHON_EGG_CACHE=/tmp \
--conf spark.executorEnv.PYTHON_EGG_CACHE=/tmp \
--conf spark.yarn.executor.memoryOverhead=1024 \
--conf spark.hadoop.validateOutputSpecs=false \
--conf spark.driver.cores=5 \
--conf spark.driver.maxResultSize=0 \
--master yarn --deploy-mode cluster --queue production \
--num-executors 20 --executor-cores 5 --executor-memory 40G \
--driver-memory 20G --archives conda_env.zip#NODE \
--jars /data/environments/sqljdbc41.jar \
script.py`
跟蹤:
`Caused by: org.apache.spark.api.python.PythonException: Traceback (most recent call last):
File "/mnt/yarn/usercache/user/appcache/application_1506634200253_39889/container_1506634200253_39889_01_000003/pyspark.zip/pyspark/worker.py", line 172, in main
process()
File "/mnt/yarn/usercache/user/appcache/application_1506634200253_39889/container_1506634200253_39889_01_000003/pyspark.zip/pyspark/worker.py", line 167, in process
serializer.dump_stream(func(split_index, iterator), outfile)
File "/mnt/yarn/usercache/user/appcache/application_1506634200253_39889/container_1506634200253_39889_01_000003/pyspark.zip/pyspark/serializers.py", line 263, in dump_stream
vs = list(itertools.islice(iterator, batch))
File "script.py", line 245, in <lambda>
File "script.py", line 119, in download_audio
File "/mnt/yarn/usercache/user/appcache/application_1506634200253_39889/container_1506634200253_39889_01_000003/NODE/conda_env/lib/python2.7/site-packages/librosa/core/audio.py", line 107, in load
with audioread.audio_open(os.path.realpath(path)) as input_file:
File "/mnt/yarn/usercache/user/appcache/application_1506634200253_39889/container_1506634200253_39889_01_000003/NODE/conda_env/lib/python2.7/site-packages/audioread/__init__.py", line 114, in audio_open
raise NoBackendError()
NoBackendError`
我的問題是:我怎麼能打包此存檔,以便librosa(真的audioread)是目前能找到的後端並加載.m4a文件?