PFCCLab/fool-proof-paddle-installation

AttributeError: module 'paddle' has no attribute 'utils'

Opened this issue · 9 comments

您好,我按照您的步驟安裝完畢並且顯示成功,但最後要測試時,卻出現AttributeError: module 'paddle' has no attribute 'utils' ,我可以如何解決?謝謝您
不好意思這個問題有點急迫,希望能夠盡快解答,非常感謝您

您好,我按照您的步驟安裝完畢並且顯示成功,但最後要測試時,卻出現AttributeError: module 'paddle' has no attribute 'utils' ,我可以如何解決?謝謝您 不好意思這個問題有點急迫,希望能夠盡快解答,非常感謝您

你好,请问能 pip list 看下当前paddle版本是多少吗? 是否按照gpu版本进行安装 2.4.1的版本呢?

utils 在 paddle 2.5 被消除,怀疑安装的是新版的 paddle 而不是自动安装的 2.4.1 的paddle gpu

实在不行的话,你可以下载 向日葵 远程助手,然后给我邮箱私聊远程协助码,我远程去看看

paddledet 2.6.0
paddlepaddle-gpu 2.4.1.post112

這是我的版本

paddledet 2.6.0 paddlepaddle-gpu 2.4.1.post112

這是我的版本

看起来没有问题,你可以发一个向日葵远程复现操作我看看,具体可以发到我的邮箱 physicoada@gmail.com

您好,我是使用anydesk遠端程式,請問您有辦法使用嘛?

您好,我是使用anydesk遠端程式,請問您有辦法使用嘛?

这个我可能用不了,向日葵应该可以无需登录直接远程;或者你可以截图你的报错(运行步骤和结果),我看看

`(paddlee) user@user-ROG-Strix-G733ZM-G733ZM:~/catkin_ws$ python
Python 3.8.13 (default, Oct 21 2022, 23:50:54)
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import paddle
Traceback (most recent call last):
File "", line 1, in
File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/init.py", line 25, in
from .framework import monkey_patch_variable
File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/framework/init.py", line 17, in
from . import random # noqa: F401
File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/framework/random.py", line 16, in
import paddle.fluid as fluid
File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/init.py", line 36, in
from . import framework
File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/framework.py", line 35, in
from .proto import framework_pb2
File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/proto/framework_pb2.py", line 33, in
_descriptor.EnumValueDescriptor(
File "/home/user/.local/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 914, in new
_message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot 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

`

我目前報錯變成這樣!我照著他的說法降低protobuf到3.19.0跟3.20.1都還是沒有用
跟3.20.1都還是沒有用

降低成3.20.1后 报的新错误是什么

不好意思更正是3.20.0,報錯仍然相同

不好意思,上述問題已解決,但再次運行候,發生以下問題

(paddlee) user@user-ROG-Strix-G733ZM-G733ZM:~$ python 
Python 3.8.13 (default, Oct 21 2022, 23:50:54) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/setuptools/sandbox.py:13: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ... 
W0416 00:30:59.819849 31371 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.4, Runtime API Version: 11.4
W0416 00:30:59.820016 31371 dynamic_loader.cc:307] The third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctly. (error code is /usr/local/cuda/lib64/libcudnn.so: cannot open shared object file: No such file or directory)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 269, in run_check
    _run_static_single(use_cuda, use_xpu, use_npu)
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 173, in _run_static_single
    exe.run(startup_prog)
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1463, in run
    six.reraise(*sys.exc_info())
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/six.py", line 719, in reraise
    raise value
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1450, in run
    res = self._run_impl(program=program,
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1661, in _run_impl
    return new_exe.run(scope, list(feed.keys()), fetch_list,
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 631, in run
    tensors = self._new_exe.run(scope, feed_names,
RuntimeError: In user code:

    File "<stdin>", line 1, in <module>
      
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 269, in run_check
      _run_static_single(use_cuda, use_xpu, use_npu)
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 159, in _run_static_single
      input, out, weight = _simple_network()
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 33, in _simple_network
      weight = paddle.create_parameter(
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/layers/tensor.py", line 152, in create_parameter
      return helper.create_parameter(attr, shape, convert_dtype(dtype), is_bias,
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/layer_helper_base.py", line 381, in create_parameter
      self.startup_program.global_block().create_parameter(
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/framework.py", line 3965, in create_parameter
      initializer(param, self)
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/initializer.py", line 56, in __call__
      return self.forward(param, block)
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/initializer.py", line 184, in forward
      op = block.append_op(type="fill_constant",
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/framework.py", line 4017, in append_op
      op = Operator(
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2858, in __init__
      for frame in traceback.extract_stack():

    PreconditionNotMetError: Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.
      [Hint: cudnn_dso_handle should not be null.] (at /paddle/paddle/phi/backends/dynload/cudnn.cc:60)
      [operator < fill_constant > error]
>>> 

不好意思更正是3.20.0,報錯仍然相同

不好意思,上述問題已解決,但再次運行候,發生以下問題

(paddlee) user@user-ROG-Strix-G733ZM-G733ZM:~$ python 
Python 3.8.13 (default, Oct 21 2022, 23:50:54) 
[GCC 11.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/setuptools/sandbox.py:13: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('google')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
>>> paddle.utils.run_check()
Running verify PaddlePaddle program ... 
W0416 00:30:59.819849 31371 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 11.4, Runtime API Version: 11.4
W0416 00:30:59.820016 31371 dynamic_loader.cc:307] The third-party dynamic library (libcudnn.so) that Paddle depends on is not configured correctly. (error code is /usr/local/cuda/lib64/libcudnn.so: cannot open shared object file: No such file or directory)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX;
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 269, in run_check
    _run_static_single(use_cuda, use_xpu, use_npu)
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 173, in _run_static_single
    exe.run(startup_prog)
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1463, in run
    six.reraise(*sys.exc_info())
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/six.py", line 719, in reraise
    raise value
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1450, in run
    res = self._run_impl(program=program,
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 1661, in _run_impl
    return new_exe.run(scope, list(feed.keys()), fetch_list,
  File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/executor.py", line 631, in run
    tensors = self._new_exe.run(scope, feed_names,
RuntimeError: In user code:

    File "<stdin>", line 1, in <module>
      
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 269, in run_check
      _run_static_single(use_cuda, use_xpu, use_npu)
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 159, in _run_static_single
      input, out, weight = _simple_network()
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/utils/install_check.py", line 33, in _simple_network
      weight = paddle.create_parameter(
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/layers/tensor.py", line 152, in create_parameter
      return helper.create_parameter(attr, shape, convert_dtype(dtype), is_bias,
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/layer_helper_base.py", line 381, in create_parameter
      self.startup_program.global_block().create_parameter(
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/framework.py", line 3965, in create_parameter
      initializer(param, self)
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/initializer.py", line 56, in __call__
      return self.forward(param, block)
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/initializer.py", line 184, in forward
      op = block.append_op(type="fill_constant",
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/framework.py", line 4017, in append_op
      op = Operator(
    File "/home/user/anaconda3/envs/paddlee/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2858, in __init__
      for frame in traceback.extract_stack():

    PreconditionNotMetError: Cannot load cudnn shared library. Cannot invoke method cudnnGetVersion.
      [Hint: cudnn_dso_handle should not be null.] (at /paddle/paddle/phi/backends/dynload/cudnn.cc:60)
      [operator < fill_constant > error]
>>> 

请问你有按照过程安装了 cudnn的库吗,过程中会有询问是否安装cudnn库

也就是安装过程中的这一步:

echo "请点击下列网址下载CUDNN库,随后放到和脚本一致的路径下"
echo "https://developer.nvidia.com/downloads/c118-cudnn-linux-8664-87084cuda11-archivetarz"