PaddlePaddle / Paddle2ONNX

ONNX Model Exporter for PaddlePaddle
Apache License 2.0
670 stars 157 forks source link

ModuleNotFoundError: No module named 'paddle2onnx_cpp2py_export' #1262

Closed qzylalala closed 1 month ago

qzylalala commented 1 month ago

Please fill in the information below so that we can solve the problem quickly, Thanks !

Describe the bug A clear and concise description of what the bug is.

I follow the instructions here to build this project, and I got no error. However, I got an error when I try to run script in tests(test_equal.py).

Informations (please complete the following information):

Screenshots

Traceback (most recent call last):
  File "tests/test_equal.py", line 16, in <module>
    from onnxbase import APIOnnx
  File "/work_space/Paddle2ONNX/tests/onnxbase.py", line 23, in <module>
    import paddle2onnx_cpp2py_export as c_p2o
ModuleNotFoundError: No module named 'paddle2onnx_cpp2py_export'

Additional context

Zheng-Bicheng commented 1 month ago

具体是怎么安装的呢?有没有用conda环境啥的。

qzylalala commented 1 month ago

具体是怎么安装的呢?有没有用conda环境啥的。

有的,conda 虚拟环境,python 版本 3.8.3

pip install PaddlePaddle==2.6.0
pip install onnxruntime

git submodule init
git submodule update
python -m build
pip install dist/*.whl

全程没报错,最后执行测试脚本 python tests/test_equal.py 报上面那个错。

Zheng-Bicheng commented 1 month ago

你这个没装paddle2onnx?

qzylalala commented 1 month ago

你这个没装paddle2onnx?

我理解这是本地编译安装了 paddle2onnx把。 python -m build 这条指令不是会生成 wheel 吗,然后再 install。

Zheng-Bicheng commented 1 month ago

pip install dist/*.whl

这条语句执行成功了吗

qzylalala commented 1 month ago

pip install dist/*.whl

这条语句执行成功了吗

当然,全程纵享丝滑。

Zheng-Bicheng commented 1 month ago

大佬,你方便进test目录下,重新执行下这个命令吗?

python test_equal.py

因为刚好项目目录也有一个paddle2onnx,而且目录下有 __init__.py 文件,感觉是不是这里冲突了(虽然我在Mac上是可以运行的)

qzylalala commented 1 month ago

大佬,你方便进test目录下,重新执行下这个命令吗?

python test_equal.py

因为刚好项目目录也有一个paddle2onnx,而且目录下有 __init__.py 文件,感觉是不是这里冲突了(虽然我在Mac上是可以运行的)

进 tests 是没有报错了,那确实是这里的问题,路径认错了,谢谢老哥。 import paddle2onnx.paddle2onnx_cpp2py_export as c_p2o