Windows 11系统下fbprophet安装失败问题求助
问题描述
在Windows 11系统中通过命令提示符安装fbprophet(用于建筑场地天气模拟模型,优化施工规划、缓解季风对施工的影响)时,持续报错。安装过程中pip解析pystan依赖时出现ModuleNotFoundError: No module named 'Cython'错误,完整终端报错信息如下:
C:\Users\user2>pip install fbprophet Collecting fbprophet Using cached fbprophet-0.7.1.tar.gz (64 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: Cython>=0.22 in c:\users\user2\appdata\local\programs\python\python312\lib\site-packages (from fbprophet) (3.0.10) Collecting cmdstanpy==0.9.5 (from fbprophet) Using cached cmdstanpy-0.9.5-py3-none-any.whl.metadata (2.9 kB) Collecting pystan>=2.14 (from fbprophet) Using cached pystan-3.9.1-py3-none-any.whl.metadata (3.7 kB) Requirement already satisfied: numpy>=1.15.4 in c:\users\user2\appdata\local\programs\python\python312\lib\site-packages (from fbprophet) (1.26.4) Requirement already satisfied: pandas>=1.0.4 in c:\users\user2\appdata\local\programs\python\python312\lib\site-packages (from fbprophet) (2.2.2) Collecting matplotlib>=2.0.0 (from fbprophet) Using cached matplotlib-3.9.0-cp312-cp312-win_amd64.whl.metadata (11 kB) Collecting LunarCalendar>=0.0.9 (from fbprophet) Using cached LunarCalendar-0.0.9-py2.py3-none-any.whl.metadata (6.3 kB) Collecting convertdate>=2.1.2 (from fbprophet) Using cached convertdate-2.4.0-py3-none-any.whl.metadata (8.3 kB) Collecting holidays>=0.10.2 (from fbprophet) Using cached holidays-0.49-py3-none-any.whl.metadata (23 kB) Collecting setuptools-git>=1.2 (from fbprophet) Using cached setuptools_git-1.2-py2.py3-none-any.whl.metadata (5.8 kB) Requirement already satisfied: python-dateutil>=2.8.0 in c:\users\user2\appdata\local\programs\python\python312\lib\site-packages (from fbprophet) (2.9.0.post0) Collecting tqdm>=4.36.1 (from fbprophet) Using cached tqdm-4.66.4-py3-none-any.whl.metadata (57 kB) Collecting pymeeus<=1,>=0.3.13 (from convertdate>=2.1.2->fbprophet) Using cached PyMeeus-0.5.12.tar.gz (5.8 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Collecting ephem>=3.7.5.3 (from LunarCalendar>=0.0.9->fbprophet) Using cached ephem-4.1.5-cp312-cp312-win_amd64.whl.metadata (6.1 kB) Requirement already satisfied: pytz in c:\users\user2\appdata\local\programs\python\python312\lib\site-packages (from LunarCalendar>=0.0.9->fbprophet) (2024.1) Collecting contourpy>=1.0.1 (from matplotlib>=2.0.0->fbprophet) Using cached contourpy-1.2.1-cp312-cp312-win_amd64.whl.metadata (5.8 kB) Collecting cycler>=0.10 (from matplotlib>=2.0.0->fbprophet) Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB) Collecting fonttools>=4.22.0 (from matplotlib>=2.0.0->fbprophet) Using cached fonttools-4.52.1-cp312-cp312-win_amd64.whl.metadata (164 kB) Collecting kiwisolver>=1.3.1 (from matplotlib>=2.0.0->fbprophet) Using cached kiwisolver-1.4.5-cp312-cp312-win_amd64.whl.metadata (6.5 kB) Collecting packaging>=20.0 (from matplotlib>=2.0.0->fbprophet) Using cached packaging-24.0-py3-none-any.whl.metadata (3.2 kB) Collecting pillow>=8 (from matplotlib>=2.0.0->fbprophet) Using cached pillow-10.3.0-cp312-cp312-win_amd64.whl.metadata (9.4 kB) Collecting pyparsing>=2.3.1 (from matplotlib>=2.0.0->fbprophet) Using cached pyparsing-3.1.2-py3-none-any.whl.metadata (5.1 kB) Requirement already satisfied: tzdata>=2022.7 in c:\users\user2\appdata\local\programs\python\python312\lib\site-packages (from pandas>=1.0.4->fbprophet) (2024.1) Collecting aiohttp<4.0,>=3.6 (from pystan>=2.14->fbprophet) Using cached aiohttp-3.9.5-cp312-cp312-win_amd64.whl.metadata (7.7 kB) Collecting clikit<0.7,>=0.6 (from pystan>=2.14->fbprophet) Using cached clikit-0.6.2-py2.py3-none-any.whl.metadata (1.6 kB) INFO: pip is looking at multiple versions of pystan to determine which version is compatible with other requirements. This could take a while. Collecting pystan>=2.14 (from fbprophet) Using cached pystan-3.9.0-py3-none-any.whl.metadata (3.7 kB) Using cached pystan-3.8.0-py3-none-any.whl.metadata (3.8 kB) Using cached pystan-3.7.0-py3-none-any.whl.metadata (3.7 kB) Using cached pystan-3.6.0-py3-none-any.whl.metadata (3.7 kB) Using cached pystan-3.5.0-py3-none-any.whl.metadata (3.7 kB) Using cached pystan-3.4.0-py3-none-any.whl.metadata (3.7 kB) Using cached pystan-3.3.0-py3-none-any.whl.metadata (3.6 kB) INFO: pip is still looking at multiple versions of pystan to determine which version is compatible with other requirements. This could take a while. Using cached pystan-3.2.0-py3-none-any.whl.metadata (3.6 kB) Using cached pystan-3.1.1-py3-none-any.whl.metadata (3.6 kB) Using cached pystan-3.1.0-py3-none-any.whl.metadata (3.6 kB) Using cached pystan-3.0.2-py3-none-any.whl.metadata (3.6 kB) Using cached pystan-3.0.1-py3-none-any.whl.metadata (3.6 kB) INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C. Using cached pystan-3.0.0-py3-none-any.whl.metadata (3.6 kB) Using cached pystan-2.19.1.1.tar.gz (16.2 MB) 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 ╰─> [20 lines of output] Traceback (most recent call last): File "C:\Users\user2\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module> main() File "C:\Users\user2\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user2\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user2\AppData\Local\Temp\pip-build-env-941ls65v\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user2\AppData\Local\Temp\pip-build-env-941ls65v\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires self.run_setup() File "C:\Users\user2\AppData\Local\Temp\pip-build-env-941ls65v\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\user2\AppData\Local\Temp\pip-build-env-941ls65v\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup exec(code, locals()) File "<string>", line 122, in <module> ModuleNotFoundError: No module named 'Cython' [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.
解决方案
核心原因
- Python 3.12与fbprophet 0.7.1依赖的pystan 2.x版本不兼容,旧版pystan无法在Python 3.12环境下正常构建。
- 虽然系统已安装Cython,但pip在构建pystan临时环境时无法调用到已安装的Cython版本。
解决步骤
方法1:降级Python版本(最稳妥)
fbprophet 0.7.1仅支持Python 3.6~3.11,建议降级到Python 3.9或3.10版本,之后直接执行pip install fbprophet即可完成安装。
方法2:手动指定依赖版本安装
如果不想降级Python,按以下顺序执行命令:
pip install cython==0.29.36 pip install pystan==2.19.1.1 pip install fbprophet==0.7.1
先安装与pystan 2.x兼容的旧版Cython,再安装指定版本的pystan,最后安装fbprophet,避免pip自动选择不兼容的版本组合。
方法3:使用conda安装(依赖自动处理)
如果你的系统有conda环境,执行以下命令可自动解决依赖问题:
conda install -c conda-forge fbprophet
内容的提问来源于stack exchange,提问作者Anonymous
相关产品推荐
相关产品推荐

