在Azure Synapse中添加自定义Python库

huangapple go评论66阅读模式
英文:

Adding Custom Python library in Azure Synapse

问题

我在Azure Synapse工作簿中启动了一个笔记本,并附加了一个Apache Spark池,通过在我的笔记本的第一个代码块中运行以下代码来安装我的Python SDK:"from XYZ import XYZ.client",但是我遇到了以下错误:

"未找到模块“XYZ”错误。

我该如何解决这个问题?我有XYZ的Python wheel包。有人可以指导我在Azure Synapse中的步骤吗?

英文:

I have spinned up a notebook in Azure Synapse workbook and I have attached an Apache Spark pool and I am installing my python sdk in there by running command in first block of my notebook with code as "from XYZ import XYZ.client" but I get error as

> "Module "XYZ" not found error.

How do i fix this? I have the python wheel package of XYZ with me. can someone guide me the steps in Azure Synapse

答案1

得分: 1

在将您的.whl文件添加到工作区包后。

在Azure Synapse中添加自定义Python库

然后,您需要将其添加到Spark池包中,如下所示。

转到Apache Spark池
在您的Spark池中,点击更多选项,然后选择

在Azure Synapse中添加自定义Python库

您将获得以下不同上传选项。
首先,启用允许会话级包选项,
然后在工作区包下选择您之前在工作区上传的文件,然后点击应用设置。

在Azure Synapse中添加自定义Python库

如果您没有任何.whl文件,只需创建requirements.txt,添加所需的包,并在要求文件下上传。
单击应用设置后,请等待一段时间以成功应用设置。
然后,转到笔记本,停止当前会话并在新的Spark会话中运行笔记本。

在Azure Synapse中添加自定义Python库

确保在添加包后在新会话中运行笔记本。

英文:

After adding your .whl file in to the workspace packages.

在Azure Synapse中添加自定义Python库

Again you need to add it to spark pool package as below.

Go-To Apache Spark pool
click on More option in your spark pool, then packages.

在Azure Synapse中添加自定义Python库

You will get option to upload in different ways as below.
First, enable Allow session level packages option,
then under Workspace packages select the file you uploaded in workspace earlier and click on apply settings.

在Azure Synapse中添加自定义Python库

If you don't have any .whl files just create requirements.txt add required packages and upload here under Requirements files.
After clicking on apply settings wait for some time to successfully apply settings.
Then, go to notebook stop the current session and run notebook in new spark session.

在Azure Synapse中添加自定义Python库

Make sure you run notebook in new session after adding packages.

huangapple
  • 本文由 发表于 2023年7月20日 21:44:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76730532.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定