episode

episode

0个粉丝

1

问答

0

专栏

0

资料

episode  发布于  2023-11-15 09:52:28
采纳率 0%
1个问答
332

amct安装包import报错

悬赏金¥ 10
已结题
     

完全按照文档步骤安装,之前安装cann toolkit时都没有问题。
报错安装指令

pip3.7.5 install amct_pytorch-0.9.0-py3-none-linux_x86_64.tar.gz --user

会报错没有torch包,然后我修改了setup.py的开头方便定位问题,仍然是import报错
修改的setup.py开头

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Copyright (C) 2019. Shenshu Technologies Co., Ltd. All rights reserved.

This program is free software; you can redistribute it and/or modify
it under the terms of the Apache License Version 2.0.You may not use
this file except in compliance with the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Apache License for more details at
http://www.apache.org/licenses/LICENSE-2.0

package script.

"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import sys
import numpy
sys.exit()

报错信息

Processing ./amct_pytorch-0.9.0-py3-none-linux_x86_64.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "/home/haitu/.local/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/haitu/.local/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/haitu/.local/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-8pqwl1gw/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-8pqwl1gw/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-8pqwl1gw/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 488, in run_setup
          self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-8pqwl1gw/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 26, in <module>
      ModuleNotFoundError: No module named 'numpy'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

如果解压安装包,直接运行python3 setup.py install或者./setup.py等就可以import,但是也无法安装会出现更多其他问题。。。所以还是先解决导入问题

我来回答
回答3个
时间排序
认可量排序

episode

0个粉丝

1

问答

0

专栏

0

资料

episode 2023-11-15 11:23:14
认可0

python正常sys.path的打印

['', '/home/haitu/Ascend/ascend-toolkit/5.13.t5.0.b050/x86_64-linux/compiler/python/site-packages', '/home/haitu/Ascend/ascend-toolkit/5.13.t5.0.b050/x86_64-linux/opp/op_impl/built-in/ai_core/tbe', '/usr/local/python3.7.5/lib/python37.zip', '/usr/local/python3.7.5/lib/python3.7', '/usr/local/python3.7.5/lib/python3.7/lib-dynload', '/home/haitu/.local/lib/python3.7/site-packages', '/usr/local/python3.7.5/lib/python3.7/site-packages']

其中包的位置确实在倒数第二个路径’/home/haitu/.local/lib/python3.7/site-packages’里,没问题
pip install tar.gz时打印sys.path则不包含该路径

['/tmp/pip-req-build-eonv3yf7', '/home/haitu/.local/lib/python3.7/site-packages/pip/_vendor/pyproject_hooks/_in_process', '/tmp/pip-build-env-u51ve24t/site', '/usr/local/python3.7.5/lib/python37.zip', '/usr/local/python3.7.5/lib/python3.7', '/usr/local/python3.7.5/lib/python3.7/lib-dynload', '/tmp/pip-build-env-u51ve24t/overlay/lib/python3.7/site-packages', '/tmp/pip-build-env-u51ve24t/normal/lib/python3.7/site-packages']

怎么解

episode

0个粉丝

1

问答

0

专栏

0

资料

episode 2023-11-15 11:45:16
认可3

得,自己解决了
加了sys.path.append(“/home/haitu/.local/lib/python3.7/site-packages”)
build wheel报错,拉大虚拟机内存安装成功
也不知道这样算不算解决了问题
查了一下虚拟机安装环境pip不应该加—user,site-packages的位置才会符合需求,各版本文档也没见提这个的

四叶草~
四叶草~   回复   episode  2023-11-15 17:50:52
0

6啊

或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
相关问答
无更多相似问答 去提问
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区