[xxxxxserverxxxxxx]$ python prefect_sample.py Trac...
# ask-community
s
[xxxxxserverxxxxxx]$ python prefect_sample.py Traceback (most recent call last): File "prefect_sample.py", line 5, in <module> import prefect ImportError: No module named prefect
z
Hi! Could you share the output of
pip --version,
python --version
, and
which prefect
?
s
pip3 --version pip 9.0.3 from /usr/lib/python3.7/site-packages (python 3.7) python3 --version Python 3.7.9
not decided yet about prefect server or cloud...settign up fo rthe first time in AWS
z
Could you run the command
which prefect
?
And
pip show prefect
s
ok checking
This is what I see
pip3 show prefect Name: prefect Version: 0.14.3 Summary: The Prefect Core automation and scheduling engine. Home-page: https://www.github.com/PrefectHQ/prefect Author: Prefect Technologies, Inc. Author-email: help@prefect.io License: Apache License 2.0 Location: /usr/local/lib/python3.7/site-packages Requires: pyyaml, tabulate, marshmallow-oneofschema, cloudpickle, msgpack, dask, pytz, marshmallow, urllib3, requests, croniter, distributed, docker, python-slugify, toml, click, pendulum, mypy-extensions, python-box, importlib-resources, python-dateutil
z
So here you’re referencing
pip3
and
python3
but in the to command you just used
python
to run your script
The package looks to be installed just fine within python 3
s
let me try python3
Michael, need some help
prefect server start Exception caught; killing services (press ctrl-C to force) Traceback (most recent call last): File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/prefect/cli/server.py", line 347, in start ["docker-compose", "pull"], cwd=compose_dir_path, env=env File "/usr/lib64/python3.7/subprocess.py", line 358, in check_call retcode = call(*popenargs, **kwargs) File "/usr/lib64/python3.7/subprocess.py", line 339, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib64/python3.7/subprocess.py", line 800, in init restore_signals, start_new_session) File "/usr/lib64/python3.7/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'docker-compose': 'docker-compose' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/ec2-user/enviroment_name/bin/prefect", line 11, in <module> sys.exit(cli()) File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/click/core.py", line 829, in call return self.main(*args, **kwargs) File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/home/ec2-user/enviroment_name/lib/python3.7/site-packages/prefect/cli/server.py", line 385, in start ["docker-compose", "down"], cwd=compose_dir_path, env=env File "/usr/lib64/python3.7/subprocess.py", line 411, in check_output **kwargs).stdout File "/usr/lib64/python3.7/subprocess.py", line 488, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib64/python3.7/subprocess.py", line 800, in init restore_signals, start_new_session) File "/usr/lib64/python3.7/subprocess.py", line 1551, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'docker-compose': 'docker-compose'
gettign this error
g
The error seems pretty clear to me?
docker-compose
couldn't be found on the system, so it needs to be installed, or at least be on the system path so that Prefect can interact with it. FWIW the "installation" section of the docs does mention that both Docker and Docker Compose must be installed in order to run Prefect Server. https://docs.prefect.io/core/getting_started/installation.html#running-the-local-server-and-ui
z
I would highly recommend checking out Prefect Cloud first — it’s free and running Prefect Server is pretty complicated.