Conda 骨架 pypi 因 pmdarima 失败——AttributeError numpy disutils

Posted

技术标签:

【中文标题】Conda 骨架 pypi 因 pmdarima 失败——AttributeError numpy disutils【英文标题】:Conda skeleton pypi fails with pmdarima -- AttributeError numpy disutils 【发布时间】:2020-12-25 05:42:30 【问题描述】:

我正在尝试在 conda env 中安装 pmdarima 包,因为它需要 statsmodels

conda skeleton pypi pmdarima

这与下面描述的 numpy disutils 相关的相同 AttributeError 失败。

类似于这个问题的提问者:Conda skeleton pypi: ModuleNotFoundError: No module named 'numpy' 我也无法让它工作。

conda install -n _build numpy

然后我尝试了上面链接的 SO 问题中提出的建议并运行:

conda skeleton pypi --extra-specs numpy pmdarima

这会导致输出很长,但据我所知,关键是:

Applying patch: '/var/folders/7f/8d7rz34522gcq4z774n9v91r0000gn/T/tmp8tv1gdnxconda_skeleton_pmdarima-1.7.1.tar.gz/pypi-distutils.patch'
patching file core.py
Hunk #1 succeeded at 168 with fuzz 2 (offset 1 line).
Partial import of pmdarima during the build process.
Requirements: ['joblib>=0.11', 'Cython>=0.29,<0.29.18', 'numpy>=1.17.3', 'pandas>=0.19', 'scikit-learn>=0.22', 'scipy>=1.3.2', 'statsmodels>=0.11,<0.12', 'urllib3', 'setuptools<50.0.0']
Setting up with numpy.distutils.core
Traceback (most recent call last):
  File "setup.py", line 324, in <module>
    do_setup()
  File "setup.py", line 320, in do_setup
    setup(**metadata)
  File "/opt/anaconda3/conda-bld/skeleton_1599410605346/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/python3.7/site-packages/numpy/distutils/core.py", line 130, in setup
    if dist.help or not _command_line_ok():
AttributeError: 'NoneType' object has no attribute 'help'
$PYTHONPATH = /var/folders/7f/8d7rz34522gcq4z774n9v91r0000gn/T/tmp8tv1gdnxconda_skeleton_pmdarima-1.7.1.tar.gz/pmdarima-1.7.1

Leaving build/test directories:
  Work:
 /opt/anaconda3/conda-bld/skeleton_1599410605346/work 
  Test:
 /opt/anaconda3/conda-bld/skeleton_1599410605346/test_tmp 
Leaving build/test environments:
  Test:
source activate  /opt/anaconda3/conda-bld/skeleton_1599410605346/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place 
  Build:
source activate  /opt/anaconda3/conda-bld/skeleton_1599410605346/_build_env 


Error: command failed: /opt/anaconda3/conda-bld/skeleton_1599410605346/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/python setup.py install

有什么想法吗?非常感谢您,非常感谢!

【问题讨论】:

【参考方案1】:

不确定基于 NumPy 的构建的正确分辨率是什么,但 the setup.py does check for an sdist argument,它分支使用 setuptools 构建而不是 numpy。因此,以下似乎避免了导致问题的代码:

conda skeleton pypi --setup-options sdist pmdarima

我怀疑这种解决方法的缺点是没有完成 Cython 编译,但并不完全确定。

您可能想file an issue on the pmdarima GitHub 看看是否有任何开发者有想法。否则,在您想要的环境中pip install 包可能更有效(只要该环境不是base)。

【讨论】:

如果您有兴趣,我询问了一个现有线程,并认为我会分享相当详细和有用的回复以供将来参考:github.com/alkaline-ml/pmdarima/issues/326【参考方案2】:

@merv 谢谢你的帮助!有趣的是,这适用于骨架,但在运行 conda-build 时失败,输出如下(截断直到出现错误):

0 location(s) to search for versions of sdist:
Given no hashes to check 0 links for project 'sdist': discarding no candidates
ERROR: Could not find a version that satisfies the requirement sdist (from versions: none)
ERROR: No matching distribution found for sdist
Exception information:
Traceback (most recent call last):
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
    status = self.run(options, args)
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
    return func(self, options, args)
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 325, in run
    reqs, check_supported_wheels=not options.target_dir
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
    self._populate_link(req)
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
    req.link = self._find_requirement_link(req)
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
    best_candidate = self.finder.find_requirement(req, upgrade)
  File "$PREFIX/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 928, in find_requirement
    req)
pip._internal.exceptions.DistributionNotFound: No matching distribution found for sdist
Removed build tracker: '/private/tmp/pip-req-tracker-umxriyi2'
Traceback (most recent call last):
  File "/opt/anaconda3/bin/conda-build", line 11, in <module>
    sys.exit(main())
  File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/cli/main_build.py", line 474, in main
    execute(sys.argv[1:])
  File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/cli/main_build.py", line 465, in execute
    verify=args.verify, variants=args.variants)
  File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/api.py", line 210, in build
    notest=notest, variants=variants)
  File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/build.py", line 3036, in build_tree
    notest=notest,
  File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/build.py", line 2155, in build
    cwd=src_dir, stats=build_stats)
  File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/utils.py", line 407, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "/opt/anaconda3/lib/python3.7/site-packages/conda_build/utils.py", line 387, in _func_defaulting_env_to_os_environ
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-o', 'errexit', '/opt/anaconda3/conda-bld/pmdarima_1599500058832/work/conda_build.sh']' returned non-zero exit status 1.

我承认此时我们已经超出了我的想象,(我需要以某种方式编辑 meta.yaml 文件吗?这很疯狂吗?)但会尝试按照您的建议打开一个问题,再次非常感谢它。

【讨论】:

以上是关于Conda 骨架 pypi 因 pmdarima 失败——AttributeError numpy disutils的主要内容,如果未能解决你的问题,请参考以下文章

如何从 Conda 中删除频道 (pypi.org)

可以将 conda 配置为使用私有 pypi 存储库吗?

conda 是不是从使用 pip install 安装的 pypi 更新软件包?

如何使用 anaconda conda 命令安装 PyPi 包

`conda list` 输出的“Channel”列中的“pypi”是啥意思?

使用 conda 设置项目以在 Github 和 PyPi 上发布