title: Azure Databricks cluster init script - install python wheel
body: <p>I have a python script that mounts a storage account in databricks and then installs a wheel from the storage account. I am trying to run it as a cluster init script but it keeps failing. My script is of the form:</p>
  
  <pre><code>#/databricks/python/bin/python
  mount_point = "/mnt/...."
  configs = {....}
  source = "...."
  if not any(mount.mountPoint == mount_point for mount in dbutils.fs.mounts()):
    dbutils.fs.mount(source = source, mount_point = mount_point, extra_configs = configs)
  dbutils.library.install("dbfs:/mnt/.....")
  dbutils.library.restartPython()
  </code></pre>
  
  <p>It works when I run it in directly in a notebook but if I save to a file called <code>dbfs:/databricks/init_scripts/datalakes/init.py</code> and use it as cluster init script, the cluster fails to start and the error message says that the init script has a non-zero exit status. I've checked the logs and it appears that it is running as bash instead of python:</p>
  
  <pre><code>bash: line 1: mount_point: command not found
  </code></pre>
  
  <p>I have tried running the python script from a bash script called init.bash containing this one line:</p>
  
  <pre><code>/databricks/python/bin/python "dbfs:/databricks/init_scripts/datalakes/init.py"
  </code></pre>
  
  <p>Then the cluster using init.bash fails to start, with the logs saying it can't find the python file:</p>
  
  <pre><code>/databricks/python/bin/python: can't open file 'dbfs:/databricks/init_scripts/datalakes/init.py': [Errno 2] No such file or directory
  </code></pre>
  
  <p>Can anyone tell me how I could get this working please?</p>
  
  <p>Related question: <a href="https://stackoverflow.com/questions/61080018/azure-databricks-cluster-init-script-install-wheel-from-mounted-storage">Azure Databricks cluster init script - Install wheel from mounted storage</a></p>