开源发票识别InvoiceNet项目Windows部署踩坑记(1)

今天安装在github上的InvoiceNet开源项目,准备对它进行测试,安装过程出现了一些问题,做个记录,给遇到兄弟爬坑。

第一个问题,conda的问题,

这是另外一个包管理器,不仅仅可以管理python的虚拟环境,还能管理很多其他语言的包或库,主要是科学计算、人工智能领域的开发者用的比较多,(感叹:这个时代的轮子太多了)

第二个问题,执行pip install .的命令时,提示:ERROR: No matching distribution found for tensorflow==2.13.1

在网上找了半天,大致是说在pypi上找不到对应版本的包,唉~~为啥这包就没有了呢?只放最新的吗?

后来想到别人应该也会遇到,于是到项目的问题列表中找了一下,果不其然,有人遇到https://github.com/naiveHobo/InvoiceNet/issues/117

解决的办法是在setup.py中,去掉指定的tensorflow的版本号,我这就有点奇怪了,既然这个问题早就有了,为啥在setup.py中不修改一下呢?还有那个numpy的版本,而且这两个的版本号在setup.py中还是单独指定的,真是有点不太理解。懂的兄弟可以给解惑一下,谢啦。

去掉了版本号,终于可以正常执行pip install .了

第三个问题:执行训练工具报错:

执行完成后,运行训练工具,但是报错:

shell 复制代码
(invoicenet) D:\Projects\AI\InvoiceNet>python trainer.py
2024-07-22 21:33:31.035230: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2024-07-22 21:33:31.035436: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "trainer.py", line 22, in <module>
    from invoicenet.gui.trainer import Trainer
  File "D:\Projects\AI\InvoiceNet\invoicenet\gui\trainer.py", line 36, in <module>
    from ..acp.acp import AttendCopyParse
  File "D:\Projects\AI\InvoiceNet\invoicenet\acp\acp.py", line 24, in <module>
    import tensorflow as tf
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\python\__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\python\eager\context.py", line 29, in <module>
    from tensorflow.core.framework import function_pb2
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\core\framework\function_pb2.py", line 16, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\core\framework\tensor_pb2.py", line 16, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py", line 16, in <module>
    from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\tensorflow\core\framework\tensor_shape_pb2.py", line 42, in <module>
    serialized_options=None, file=DESCRIPTOR),
  File "C:\Users\Atom\.conda\envs\invoicenet\lib\site-packages\google\protobuf\descriptor.py", line 561, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

报错"cudart64_110.dll not found",dll不存在,搜索资料后发现是nvida的cuda开发工具

shell 复制代码
2024-07-22 22:41:34.544495: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2024-07-22 22:41:34.544737: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

没看仔细这个只是个警告信息,不影响,下面的部分才是异常,白搞了半天

根据异常信息搜索,在statckoverflow找到了答案:

https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly

这个是原文截图

shell 复制代码
(invoicenet) D:\Projects\AI\InvoiceNet>pip install protobuf==3.20.*
Collecting protobuf==3.20.*
  Downloading protobuf-3.20.3-cp37-cp37m-win_amd64.whl.metadata (699 bytes)
Downloading protobuf-3.20.3-cp37-cp37m-win_amd64.whl (905 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 905.1/905.1 kB 1.8 MB/s eta 0:00:00
Installing collected packages: protobuf
  Attempting uninstall: protobuf
    Found existing installation: protobuf 4.24.4
    Uninstalling protobuf-4.24.4:
      Successfully uninstalled protobuf-4.24.4

终于成功了

安装完成后重新运行:python trainer.py,启动成功

终于启动成功了!

相关推荐
西猫雷婶14 分钟前
python学opencv|读取图像(二十一)使用cv2.circle()绘制圆形进阶
开发语言·python·opencv
老刘莱国瑞1 小时前
STM32 与 AS608 指纹模块的调试与应用
python·物联网·阿里云
一只敲代码的猪2 小时前
Llama 3 模型系列解析(一)
大数据·python·llama
Hello_WOAIAI2 小时前
批量将 Word 文件转换为 HTML:Python 实现指南
python·html·word
winfredzhang2 小时前
使用Python开发PPT图片提取与九宫格合并工具
python·powerpoint·提取·九宫格·照片
矩阵推荐官hy147623 小时前
短视频矩阵系统种类繁多,应该如何对比选择?
人工智能·python·矩阵·流量运营
测试19983 小时前
外包干了2年,技术退步明显....
自动化测试·软件测试·python·功能测试·测试工具·面试·职场和发展
码银3 小时前
【python】银行客户流失预测预处理部分,独热编码·标签编码·数据离散化处理·数据筛选·数据分割
开发语言·python
小木_.3 小时前
【python 逆向分析某有道翻译】分析有道翻译公开的密文内容,webpack类型,全程扣代码,最后实现接口调用翻译,仅供学习参考
javascript·python·学习·webpack·分享·逆向分析
R-sz3 小时前
14: curl#6 - “Could not resolve host: mirrorlist.centos.org; 未知的错误“
linux·python·centos