【问题标题】:Running setup.py install for fbprophet ... error为 fbprophet 运行 setup.py install ... 错误
【发布时间】:2019-06-21 10:12:34
【问题描述】:

我无法安装 fbprophet 或 gcc7。

我已经手动安装了一个预编译的 ephem。

Running setup.py install for fbprophet ... error

我尝试过使用 python 3.6 和 3.7。我试过以管理员身份运行,但没有。

我的 anaconda 提示无法安装任何东西而不抛出错误。我宁愿使用 pip。

问题可能与pystan有关。

File "d:\python37\lib\site-packages\pystan\api.py", line 13, in <module> import pystan._api  # stanc wrapper
ImportError: DLL load failed: The specified module could not be found.

我使用的是 Windows 10。

【问题讨论】:

  • 从终端运行python -c "from pip._internal.pep425tags import get_supported; print(get_supported()[0])" 并在此处发布输出。确保使用所需的 Python 目标版本,例如如果需要,py -3.7 在命令中而不是 python
  • 这个答案可能会对您有所帮助。 stackoverflow.com/a/64713567/10126125

标签: python pip pystan


【解决方案1】:

使用: 第一步是移除pystan和缓存:

pip uninstall fbprophet pystan
pip --no-cache-dir install pystan==2.17  #any version
pip --no-cache-dir install fbprophet==0.2 #any version
conda install Cython --force

pip install pystan
conda install pystan -c conda-forge
conda install -c conda-forge fbprophet

它创建一个轮子并更新包所需的环境。 pip install fbprophet 会产生类似的问题。

确保 pystan 正常工作。

import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)
y = model.sampling().extract()['y']
y.mean()  # with luck the result will be near 0

使用此链接:Installing PyStan on windows

【讨论】:

  • 感谢您的回复。没有 PyStan 没有工作,即使它说它已成功安装。如何正确安装 PyStan?
  • @CamK 太好了。您可以安装:pip install pystan,也可以使用答案中的链接:pystan.readthedocs.io/en/latest/windows.html
  • @CamK 我更新了答案,让我们删除 pystan 并缓存并重新安装。
  • d:\python37\include\pyconfig.h(59): 致命错误 C1083: 无法打开包含文件: 'io.h': 没有这样的文件或目录
  • 我在运行第二行“pip --no-cache-dir install pystan==2.17”时收到该错误
【解决方案2】:

原因:Anaconda3 上的 python 发行版使用的是旧版本的 gcc (4.2.x)

请以管理员身份使用 anaconda 提示符

为 stan 设置新环境

conda create -n stan python=<your_version> numpy cython

在虚拟环境中安装 pystan 和 gcc。

conda activate stan   

source activate stan
(stan)  pip install pystan
(stan)  pip install gcc

验证您的 gcc 版本:

gcc --version
gcc (GCC) 4.8.5

【讨论】:

  • 由于 ipykernel,我的 anaconda 提示无法安装任何东西。那是一个单独的问题。我无法在 pip 上安装 gcc。 pip install gcc7“找不到版本”
  • 您应该使用其中之一:conda activate stan 或 source activate stan,但不能同时使用。
  • 这个问题是因为你的环境(stan),我有 python 3.7.3 和 Visual Studio 2017 并以管理员身份运行我的 anaconda,我可以安装 pystan。看看我在回答中上传的图片。
  • 我将 python 3.7.0 与 Visual Studio 2017 一起使用。当我运行 pip install gcc 时出现错误:找不到满足 gcc 要求的版本(来自版本:无)
  • @CamK,太好了,你可以跳过 gcc 并按照我的最后一个答案进行操作
【解决方案3】:

为了解决这个问题,我卸载了我现有的 python 3.7 和 anaconda。我重新安装了 anaconda 有一个关键区别。

我在 Anaconda 安装过程中将 Anaconda 注册为我的默认 Python 3.7。这可以让 Visual Studio、PyDev 和其他程序自动检测 Anaconda 作为要使用的主要版本。

【讨论】:

    【解决方案4】:

    我尝试在 Python Anaconda 上导入 fbprophet,但是出现了一些错误。

    这段代码对我有用..

    conda install -c conda-forge/label/cf201901 fbprophet 
    

    【讨论】:

      【解决方案5】:

      如果所有答案都不起作用,请克隆 pystan,不要使用上述解决方案:

      git clone --recursive https://github.com/stan-dev/pystan.git
      cd pystan
      python setup.py install
      

      【讨论】:

      • 我应该使用 pip 还是 anaconda?
      • @CamK 搜索 anaconda 提示并右键单击并选择“以管理员身份运行”,然后运行我的最后一个答案
      • 错误:无法创建文件LIB / boost_1.69.0 /库/几何/ DOC / HTML /几何/参考/ spatial_indexes / boost__geometry__index__rtree / rtree_parameters_type_const ____ indexable_getter_const ____ value_equal_const ____ allocator_type_const ___ HTML:文件名太长无法结帐 'c2fb25c3f53d3d33157a27ce995911b0bc92d55d' 在子模块路径“pystan/stan/lib/stan_math”无法递归到子模块路径“pystan/stan”
      • 老实说,我觉得我可能不得不完全重新安装anaconda并从头开始。
      • 亲爱的@CamK 我确定是因为你的环境,请看环境,例如对我来说是:(base) C:\Windows\system32> git clone --recursive github.com/stan-dev/pystan.git ,检查您的环境,如果您选择 Anaconda 提示,则默认情况下它位于根目录上。
      【解决方案6】:

      (Short n Sweet)对于 Mac 用户:

      1. pip3 卸载 pystan
      2. pip3 install pystan==2.17.1.0
      3. pip3 安装 fbprophet

      【讨论】:

        【解决方案7】:

        我使用以下步骤在 windows 10 (2022-03-10) 上安装 fbprophet 0.7.1:

        1. 安装 anaconda here
        2. 按照guide 安装pystan。我使用的主线是conda install libpython m2w64-toolchain -c msys2。然后,使用pip install pystan 安装 pystan
        3. 通过在 python 终端中运行以下命令来检查您的安装:
        >>> import pystan
        >>> model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
        >>> model = pystan.StanModel(model_code=model_code)
        >>> y = model.sampling().extract()['y']
        >>> y.mean()  # with luck the result will be near 0
        
        1. 如果上述方法有效,请继续使用pip install fbprophet 安装 fbprophet

        希望这对你有用!

        【讨论】:

          猜你喜欢
          • 2018-10-06
          • 1970-01-01
          • 1970-01-01
          • 2020-03-09
          • 2021-05-04
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多