3

我正在尝试在 conda env 中安装 pmdarima 包,因为它需要 statsmodels <0.12,并且我还想为此项目使用 statmodels 最新版本。我的理解有限,但我第一次尝试

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

有任何想法吗?提前非常感谢您,非常感谢!

4

2 回答 2

1

不确定基于 NumPy 的构建的正确分辨率是什么,但确实setup.py会检查sdist参数,该分支setuptools用于构建而不是numpy. 因此,以下似乎避免了导致问题的代码:

conda skeleton pypi --setup-options sdist pmdarima

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

您可能想在 pmdarima GitHub 上提交问题,看看是否有任何开发人员有想法。否则,它可能pip install对您想要的环境中的包更有效(只要该环境不是base)。

于 2020-09-07T06:14:51.100 回答
0

@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 文件?这很疯狂吗?)但会尝试按照您的建议打开一个问题,再次非常感谢它。

于 2020-09-07T17:44:04.873 回答