簡體   English   中英

如何在 Databricks 集群中指定 python 版本

[英]How to specify a python version in a Databricks Cluster

我正在嘗試在 Databricks 集群上安裝一個輪子。 不幸的是,這個輪子有要求:

python_requires='==3.6.8'

在 Databricks Clusters 上,使用的是 3.7.3 版本,因此輪子的安裝失敗。 如何在這些集群上安裝較低的 python 版本?

我嘗試了什么:

切換到 anaconda 支持的集群,並在 init 腳本中創建具有特定版本的 virtualenv --> 這會遇到一個錯誤,導致集群無法啟動(基於此https://docs.databricks.com/runtime/mlruntime。 html )。

是否有另一種方法來設置可在集群的所有節點上使用的 virtualenv?

謝謝!


更新

所以我嘗試了接下來的事情:

我創建了一個初始化腳本:

#!/bin/bash
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
tar xvf Python-3.6.8.tgz
ls
pwd
cd Python-3.6.8
ls
pwd
./configure --enable-optimizations --enable-shared
make -j8
sudo make altinstall
python3.6

在集群上安裝 Python 3.6.8(這需要很長時間)。

初始化腳本失敗-->這里是錯誤日志:

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[1]: [clean] Error 1 (ignored)
Executing <Task finished coro=<CoroutineTests.test_async_def_wrapped.<locals>.start() done, defined at /Python-3.6.8/Lib/test/test_asyncio/test_pep492.py:150> result=None created at /Python-3.6.8/Lib/asyncio/base_events.py:463> took 0.168 seconds
stty: 'standard input': Inappropriate ioctl for device
/Python-3.6.8/Modules/expat/xmlparse.c: In function ‘appendAttributeValue’:
/Python-3.6.8/Modules/expat/xmlparse.c:5577:40: warning: array subscript is above array bounds [-Warray-bounds]
           if (!poolAppendChar(pool, buf[i]))
                                        ^
/Python-3.6.8/Modules/expat/xmlparse.c:545:27: note: in definition of macro ‘poolAppendChar’
    : ((*((pool)->ptr)++ = c), 1))
                           ^
/Python-3.6.8/Modules/expat/xmlparse.c:5577:40: warning: array subscript is above array bounds [-Warray-bounds]
           if (!poolAppendChar(pool, buf[i]))
                                        ^
/Python-3.6.8/Modules/expat/xmlparse.c:545:27: note: in definition of macro ‘poolAppendChar’
    : ((*((pool)->ptr)++ = c), 1))
                           ^
python3.6: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory

tar 的解包和加載工作正常,但是在第二個 ls/pwd 之后發生了錯誤。 到目前為止,通常 python 安裝在“某處”。 如何重定向,所以它將安裝在 /databricks/python3/bin/python 中?

謝謝!

像這樣的東西應該在初始化腳本中工作:

#!/bin/bash
sudo wget https://repo.continuum.io/archive/Anaconda3-5.3.0-Linux-x86_64.sh
sudo bash Anaconda3-5.2.0-Linux-x86_64.sh -b -p /anaconda3
echo "PYSPARK_PYTHON=/anaconda3/bin/python3" >> /databricks/spark/conf/spark-env.sh

DBR 5.5 也應該有 Python 3.6,您可以嘗試使用該版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM