You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行Remorph工具转换SQL时遇PyO3模块导入错误求助

问题描述

我在用Remorph(一款将传统SQL代码转换为Spark SQL的开源工具)执行转换命令时出现错误,执行的命令如下:

databricks labs remorph transpile -input-sgl C:\Users\anubhav.sharma \Downloads\emp_purge_data.sql--source snowflake --output-folder C:\Users\anubhav.sharma Downloads

注:原命令存在两处问题:-input-sgl是拼写错误(应为-input-sql),路径中存在多余空格(需修正为无空格的合法路径)。

此前安装过Python 3.13,当前使用Python 3.12,已通过python --version确认仅安装了一个Python版本。完整错误信息如下:

C:\Users\anubhav.sharma>Traceback (most recent call last):

File "C:\Users\anubhav.sharma\.databricks\labs\remorph\lib\src\databricks\labs\remorph\cli.py", line 9, in <module>

from databricks.labs.remorph.reconcile.runner import ReconcileRunner File "C:\Users\anubhav.sharma\.databricks\labs\remorph\lib\src\databricks\labs\remorph\reconcile\runner.py", line 13, in <module> from databricks.labs.remorph.reconcile.execute import RECONCILE_OPERATION_NAME

File "C:\Users\anubhav.sharma\.databricks\labs\remorph\lib\src\databricks\labs\remorph\reconcile\execute.py", line 25, in <module> from databricks.labs.remorph.reconcile.connectors.source_adapter import create_adapter ", lin

File "C:\Users\anubhav.sharma\.databricks\labs\remorph\lib\src\databricks\labs\remorph\reconcile\connectors\source_adapter.py

e 7, in <module> from databricks.labs.remorph.reconcile.connectors.snowflake import SnowflakeDataSource

File "C:\Users\anubhav.sharma\.databricks\labs\remorph\lib\src\databricks\labs\remorph\reconcile\connectors\snowflake.py", line 10,

in <module>

from cryptography.hazmat.primitives import serialization

File "C:\Users\anubhav.sharma.databricks\labs\remorph\state\venv\Lib\site-packages\cryptography\hazmat\primitives\serialization.

init.py", line 7, in <module>

from cryptography.hazmat.primitives. serialization import ( File "C:\Users\anubhav.sharma\.databricks\labs\remorph\state\venv\Lib\site-packages\cryptography\hazmat\primitives\_serialization.p

y", line 10, in <module> from cryptography.hazmat.primitives.hashes import HashAlgorithm File "C:\Users\anubhav.sharma.databricks\labs\remorph\state\venv\Lib\site-packages\cryptography\hazmat\primitives\hashes.py", line

9, in <module>

from cryptography.hazmat.bindings. rust import openssl as rust openssl ImportError: Py03 modules compiled for CPython 3.8 or older may only be initialized once per interpreter process

Error: exit status 1
解决方案
  • 修正命令错误:把命令里的-input-sgl改为-input-sql,同时修正路径中的空格,确保路径合法,修正后的命令示例:
    databricks labs remorph transpile -input-sql C:\Users\anubhav.sharma\Downloads\emp_purge_data.sql --source snowflake --output-folder C:\Users\anubhav.sharma\Downloads
    
  • 重置Remorph虚拟环境:
    1. 删除Remorph自动创建的虚拟环境目录:C:\Users\anubhav.sharma\.databricks\labs\remorph\state\venv
    2. 重新安装Remorph:运行databricks labs install remorph
  • 更新cryptography依赖:
    1. 进入Remorph的虚拟环境:执行C:\Users\anubhav.sharma\.databricks\labs\remorph\state\venv\Scripts\activate
    2. 升级cryptography到兼容Python 3.12的版本:运行pip install --upgrade cryptography
  • 降级Python版本:如果上述方法无效,可切换到Python 3.11版本(该版本对旧依赖兼容性更稳定),之后重新安装Remorph再执行转换命令。

内容的提问来源于stack exchange,提问作者Anubhav sharma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 20:15:56