• python setup.py build develop时出现问题


    关注 码龄 粉丝数 原力等级 -- 被采纳 被点赞 采纳率 "ꪖꪀᧁꫀꪶ⁵²⁰" 2024-04-14 16:23 采纳率: 25% 浏览 4 首页/ 编程语言 / python setup.py build develop时出现问题 pythonpytorch人工智能 ^ In file included from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/ATen/ATen.h:13:0, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/types.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader_options.h:4, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader/base.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader/stateful.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/all.h:8, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/torch/extension.h:4, from C:\Users\HP\Downloads\faster-rcnn.pytorch-pytorch-1.0 (1)\faster-rcnn.pytorch-pytorch-1.0\lib\model\csrc/cpu/vision.h:3, from C:\Users\HP\Downloads\faster-rcnn.pytorch-pytorch-1.0 (1)\faster-rcnn.pytorch-pytorch-1.0\lib\model\csrc\cpu\ROIAlign_cpu.cpp:2: C:\Users\HP\Downloads\faster-rcnn.pytorch-pytorch-1.0 (1)\faster-rcnn.pytorch-pytorch-1.0\lib\model\csrc\cpu\ROIAlign_cpu.cpp:254:32: warning: 'T* at::Tensor::data() const [with T = float]' is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations] output.data()); ^ D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/ATen/Dispatch.h:13:12: note: in definition of macro 'AT_PRIVATE_CASE_TYPE' return __VA_ARGS__(); \ ^ C:\Users\HP\Downloads\faster-rcnn.pytorch-pytorch-1.0 (1)\faster-rcnn.pytorch-pytorch-1.0\lib\model\csrc\cpu\ROIAlign_cpu.cpp:242:3: note: in expansion of macro 'AT_DISPATCH_FLOATING_TYPES' AT_DISPATCH_FLOATING_TYPES(input.type(), "ROIAlign_forward", [&] { ^ In file included from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/ATen/Tensor.h:3:0, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/ATen/Context.h:4, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/ATen/ATen.h:9, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/types.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader_options.h:4, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader/base.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader/stateful.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data/dataloader.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/data.h:3, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include\torch\csrc\api\include/torch/all.h:8, from D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/torch/extension.h:4, from C:\Users\HP\Downloads\faster-rcnn.pytorch-pytorch-1.0 (1)\faster-rcnn.pytorch-pytorch-1.0\lib\model\csrc/cpu/vision.h:3, from C:\Users\HP\Downloads\faster-rcnn.pytorch-pytorch-1.0 (1)\faster-rcnn.pytorch-pytorch-1.0\lib\model\csrc\cpu\ROIAlign_cpu.cpp:2: D:\anaconda\envs\pytorch-gpu\lib\site-packages\torch\include/ATen/core/TensorBody.h:363:7: note: declared here T * data() const { ^ error: command 'D:\\anaconda\\envs\\pytorch-gpu\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit code 1 展开全部 收起 写回答 好问题 0 提建议 追加酬金 关注问题 微信扫一扫 点击复制链接 分享 邀请回答 编辑 收藏 删除 结题 收藏 举报 追加酬金 (90%的用户在追加酬金后获得了解决方案) 当前问题酬金 ¥ 0 (可追加 ¥500) ¥ 15¥ 20¥ 50¥ 100¥ 200 支付方式 扫码支付 二维码出错 点击刷新 支付金额 15 元 提供问题酬金的用户不参与问题酬金结算和分配 支付即为同意 《付费问题酬金结算规则》 结题 再想想 删除 再等等

    3条回答 默认 最新

    • Kwan的解忧杂货铺 Java领域优质创作者 2024-04-14 16:23
      关注

      下午好🌅🌅🌅
      本答案参考ChatGPT-3.5

      问题描述不够完整,无法确定具体的问题。请提供更多信息,例如完整的错误信息,以及代码的更多细节。

      对于该错误的一般解决方案如下:

      1. 确认已安装依赖项和正确的版本。

      2. 升级或降低Pytorch的版本,以解决ATen相关的错误。

      3. 确认文件路径是否正确。

      4. 检查代码中是否存在过时的方法或模块,并进行相应的更新。

      评论 编辑记录
    • 专家-赤兔[在线] 全栈领域优质创作者 2024-04-14 16:23
      关注

      引自免费微信小程序:皆我百晓生

      看起来你在尝试编译一个基于PyTorch的项目(可能是Faster R-CNN),并遇到了一些警告和错误。这个错误是由于在ROIAlign_cpu.cpp文件中的代码使用了已经被弃用的方法at::Tensor::data()。根据提示,你应该将它替换为at::Tensor::data_ptr()

      要解决这个问题,你需要找到ROIAlign_cpu.cpp文件,并查找所有类似这样的行:

      output.data());
      

      然后将其替换为:

      output.data_ptr());
      

      确保在所有的浮点类型遍历宏AT_DISPATCH_FLOATING_TYPES里都进行了这个更改。

      这是一个示例如何修改宏内的代码:

      // 原始代码
      AT_DISPATCH_FLOATING_TYPES(input.type(), "ROIAlign_forward", [&] {
          // ...
          output.data());
          // ...
      });
      
      // 修改后的代码
      AT_DISPATCH_FLOATING_TYPES(input.type(), "ROIAlign_forward", [&] {
          // ...
          output.data_ptr());
          // ...
      });
      

      完成这些更改后,再次运行python setup.py build develop命令应该可以正常构建而不会报错。如果还有其他问题,可能是因为环境配置、依赖项不正确或者其他原因导致的,这需要进一步排查。

      评论 编辑记录
    • CSDN-Ada助手 CSDN-AI 官方账号 2024-04-14 18:18
      关注

      【相关推荐】



      • 这篇博客: python setup.py的使用中的 查看python setup.py相关命令 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:

        主要分成build和install两类
        python setup.py --help-commands

        hui@hui-XPS-8920:~$ python spam_setup.py --help-commands
        Standard commands:
          build            build everything needed to install
          build_py         "build" pure Python modules (copy to build directory)
          build_ext        build C/C++ extensions (compile/link to build directory)
          build_clib       build C/C++ libraries used by Python extensions
          build_scripts    "build" scripts (copy and fixup #! line)
          clean            clean up temporary files from 'build' command
          install          install everything from build directory
          install_lib      install all Python modules (extensions and pure Python)
          install_headers  install C/C++ header files
          install_scripts  install scripts (Python or otherwise)
          install_data     install data files
          sdist            create a source distribution (tarball, zip file, etc.)
          register         register the distribution with the Python package index
          bdist            create a built (binary) distribution
          bdist_dumb       create a "dumb" built distribution
          bdist_rpm        create an RPM distribution
          bdist_wininst    create an executable installer for MS Windows
          check            perform some checks on the package
          upload           upload binary package to PyPI
        
        usage: spam_setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
           or: spam_setup.py --help [cmd1 cmd2 ...]
           or: spam_setup.py --help-commands
           or: spam_setup.py cmd --help
        

        如下为python编译C extensions的步骤

        # 编译
        # python setup.py build --inplace 
        python setup.py build_ext --inplace
        # 清楚.o的临时文件
        python setup.py clean
        # 在python的lib目录下建立软连接到编译生成的.so
        python setup.py install
        

      如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^

      展开全部

      评论
    编辑
    预览

    报告相同问题?

  • 相关阅读:
    人工智能机器人专业就业前景怎样
    vue自定义防抖指令
    MaxEnt模型融合技术的物种分布模拟、参数优化方法、结果分析制图与论文写作
    空气温湿度、光照度、二氧化碳传感器
    如何正则匹配乱码?
    MySQL——函数和流程控制
    在WordPress网站上添加文章分类信息
    MATLAB程序设计与应用 3.2 矩阵变换
    分布式事务解决方案Seata
    c++11 入门基础
  • 原文地址:https://ask.csdn.net/questions/8088354