Paddle ImportError: attempted relative import with no known parent package

2mbi3lxu  于 2022-11-19  发布在  其他
关注(0)|答案(4)|浏览(234)

bug描述 Describe the Bug

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/paddle/__init__.py", line 25, in <module>
    from .framework import monkey_patch_variable
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/paddle/framework/__init__.py", line 17, in <module>
    from . import random  # noqa: F401
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/paddle/framework/random.py", line 16, in <module>
    import paddle.fluid as fluid
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/paddle/fluid/__init__.py", line 36, in <module>
    from . import framework
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/paddle/fluid/framework.py", line 29, in <module>
    import numpy as np
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/numpy/__init__.py", line 140, in <module>
    from . import core
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/numpy/core/__init__.py", line 100, in <module>
    from . import _add_newdocs_scalars
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/numpy/core/_add_newdocs_scalars.py", line 87, in <module>
    add_newdoc_for_scalar_type('byte', [],
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/numpy/core/_add_newdocs_scalars.py", line 62, in add_newdoc_for_scalar_type
    alias_doc += ''.join(":Alias on this platform ({} {}): `numpy.{}`: {}.\n    ".format(platform.system(), platform.machine(), alias, doc)
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/numpy/core/_add_newdocs_scalars.py", line 62, in <genexpr>
    alias_doc += ''.join(":Alias on this platform ({} {}): `numpy.{}`: {}.\n    ".format(platform.system(), platform.machine(), alias, doc)
  File "/usr/lib/python3.8/platform.py", line 892, in system
    return uname().system
  File "/usr/lib/python3.8/platform.py", line 858, in uname
    processor = _syscmd_uname('-p', '')
  File "/usr/lib/python3.8/platform.py", line 612, in _syscmd_uname
    import subprocess
  File "/usr/lib/python3.8/subprocess.py", line 49, in <module>
    import signal
  File "/opt/pyvenv-paddle/lib/python3.8/site-packages/paddle/signal.py", line 19, in <module>
    from .tensor.attribute import is_complex, is_floating_point
ImportError: attempted relative import with no known parent package

export CUDA_VER=11.6
export CUDA_VISIBLE_DEVICES=0

nvidia-smi
Tue Aug 23 18:04:04 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.47.03 Driver Version: 510.47.03 CUDA Version: N/A

pip list
Package Version

paddle-bfloat 0.1.7
paddlepaddle-gpu 2.3.2.post116

其他补充信息 Additional Supplementary Information

No response

zmeyuzjn

zmeyuzjn1#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网API文档常见问题历史IssueAI社区 来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

kxe2p93d

kxe2p93d2#

import paddle 出现的错误嘛 我这边没有复现这个问题

8ehkhllq

8ehkhllq3#

您好,是pip装好paddlepaddle-gpu之后 import paddle报错。 virtualenv环境。
不知道提供什么信息能帮你重现。

nwwlzxa7

nwwlzxa74#

我今天又重启这个环境试下:
root@dev01rtx:/# python -c 'import paddle'
/opt/pyvenv-paddle/lib/python3.8/site-packages/paddle/fluid/framework.py:516: UserWarning: You are using GPU version Paddle, but your CUDA device is not set properly. CPU device will be used by default.
warnings.warn(

root@dev01rtx:/# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_Mar__8_18:18:20_PST_2022
Cuda compilation tools, release 11.6, V11.6.124
Build cuda_11.6.r11.6/compiler.31057947_0

nvidia-smi
Wed Aug 24 13:27:00 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 510.47.03 Driver Version: 510.47.03 CUDA Version: N/A

相关问题