Cannot create pex with fbprophet
See original GitHub issueHello,
I’m trying to create a pex with fbprophet in it, and it doesn’t seem to work. I’m on python 3.6 with the latest version of pex. I can successfully install fbprophet with pip, and run my code using fbprophet.
When trying to build a simple pex with it, it fails:
pex pystan fbprophet -o fbprophet.pex
gives me:
ERROR: Command errored out with exit status 1:
command: /home/t.henri/.pex/venvs/s/2dea2668/venv/bin/python3.6 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-npc93b27/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-npc93b27/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-mkxvmgl5
cwd: /tmp/pip-req-build-npc93b27/
Complete output (40 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/fbprophet
creating build/lib/fbprophet/stan_model
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-npc93b27/setup.py", line 149, in <module>
long_description_content_type='text/markdown',
File "/home/t.henri/.pex/venvs/s/2dea2668/venv/lib64/python3.6/site-packages/setuptools/__init__.py", line 169, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/t.henri/.pex/venvs/s/2dea2668/venv/lib64/python3.6/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib64/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-req-build-npc93b27/setup.py", line 48, in run
build_models(target_dir)
File "/tmp/pip-req-build-npc93b27/setup.py", line 36, in build_models
from fbprophet.models import StanBackendEnum
File "/tmp/pip-req-build-npc93b27/fbprophet/__init__.py", line 8, in <module>
from fbprophet.forecaster import Prophet
File "/tmp/pip-req-build-npc93b27/fbprophet/forecaster.py", line 14, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
----------------------------------------
ERROR: Failed building wheel for fbprophet
ERROR: Failed to build one or more wheels
It seems to be a known issue when checking on the internet, where people had trouble installing it with pip, and most of the fix suggest to use conda. Do you have any idea how I could fix it ?
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Cannot use 'pip install fbprophet' to install prophet on mac #17
Failed building wheel for fbprophet. Running setup.py clean for fbprophet. Failed to build fbprophet. Installing collected packages: ...
Read more >Building .pex files — pex 2.1.51 documentation - Read the Docs
This command creates a pex file containing pex and requests, using the console script named “pex”, saving it in ~/bin/pex. At this point,...
Read more >Cannot install Tensorflow in R, "could not find a Python ...
No, py_config() still shows me my default python path, not the one to my conda installation. I'm seriously considering either dual-booting ...
Read more >Installing FBProphet/Prophet for Time Series Forecasting in ...
The main problem of the installation, in my case because I already installed python 3.9 so, the prophet can't be installed. I don't...
Read more >Packaging a Machine Learning Project using Python PEX
Use pex python library to package a python project for deployment.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Trimming things down, the minimal repro:
N.B. that fbprophet is sdist-only and the above backtrace is from running the setup.py in the sdist to build a wheel from it (
bdist_wheel
is the subcommand):Also note, that importing
setup.py
leads to importing numpy indirectly:So the issue here is that to even run the build you must 1st resolve numpy. Now there is a poor mechanism for this built into setup.py via setuptools by using
setup_requires
(as opposed toinstall_requires
), but fbprophet does not use this:It looks like the offending import in
setup.py
got removed though and latest on main works:You may be able to use an older sha - I did not dig to see at which commit the issue is fixed.
So you can use a VCS requirement like I did above for fbprohet (which you can see they re-named to prophet) or else you’ll need to wait to their next release to pick up that fix in an official distribution they publish to PyPI.
That won’t be it, this is a build-time dependency not runtime. I’ll respond more fully in a bit on what you might be able to do.