【问题标题】:How to specify a python version in a Databricks Cluster如何在 Databricks 集群中指定 python 版本
【发布时间】:2021-08-16 13:57:59
【问题描述】:

我正在尝试在 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 ?

谢谢!

【问题讨论】:

    标签: python installation databricks


    【解决方案1】:

    这样的东西应该在初始化脚本中起作用:

    #!/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,您可以尝试使用该版本。

    【讨论】:

      猜你喜欢
      • 2022-08-03
      • 1970-01-01
      • 2020-02-29
      • 2020-07-31
      • 1970-01-01
      • 2020-03-03
      • 1970-01-01
      • 2020-07-19
      • 2019-11-30
      相关资源
      最近更新 更多