https://prefect.io logo
Title
r

RAISS Zineb

04/15/2022, 2:35 PM
Hello , when I restarted my laptop, I tried to run Prefect on local, so I typed the command perefct server start, but an error showed me "prefect: command not found" do you have an idea?
k

Kevin Kho

04/15/2022, 2:36 PM
Were you in a virtual environment when you installed it?
r

RAISS Zineb

04/15/2022, 2:48 PM
No on Ubuntu WSL, I ran the "npm run serve" command and logged in on UI but not logged in to server
a

Andrew Huang

04/15/2022, 2:57 PM
Does this output `pip show prefect`anything?
r

RAISS Zineb

04/15/2022, 3:10 PM
no I only have prefect: command not found
k

Kevin Kho

04/15/2022, 3:30 PM
Yeah hard to tell what happened but seems like you don’t have Prefect installed anymore
r

RAISS Zineb

04/15/2022, 3:35 PM
Prefect is installed, because if it is not installed I will not connect to the UI on localhost:8080 with the npm run serve command, and when I do pip install prefect it gives me that it already exists
k

Kevin Kho

04/15/2022, 3:36 PM
pip install prefect
says it exists but
pip show prefect
shows nothing?? I would expect it to show something
r

RAISS Zineb

04/15/2022, 3:38 PM
Name: prefect Version: 1.2.0 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 with the pip show prefect commandLicense: Apache License 2.0 Location: /home/zineb/.local/lib/python3.8/site-packages Requires: marshmallow-oneofschema, cloudpickle, docker, python-slugify, packaging, distributed, croniter, pytz, msgpack, pyyaml, mypy-extensions, requests, marshmallow, python-dateutil, click, python-box, urllib3, dask, pendulum, tabulate, importlib-resources, toml Required-by:
k

Kevin Kho

04/15/2022, 3:38 PM
Ah ok do you have 2 python versions on the machine?
r

RAISS Zineb

04/15/2022, 3:40 PM
I have python 3.9 which is installed on windows, and python 3.8 which on Ubuntu in WSL
k

Kevin Kho

04/15/2022, 3:41 PM
Can you try doing
which python
and
which pip
?
r

RAISS Zineb

04/15/2022, 3:42 PM
this is what gives me
k

Kevin Kho

04/15/2022, 3:43 PM
wait what? what happens if you just type
python
, like to start an interactive shell
for reference, this is what it looks like for me (running in docker right now)
root@60b2448d651a:/opt/prefect# which python
/usr/local/bin/python
root@60b2448d651a:/opt/prefect# which pip
/usr/local/bin/pip
so for you it seems it can’t find a python installation
r

RAISS Zineb

04/15/2022, 3:45 PM
for me, because I've python 3: zineb@EQ-EQ6288793:~$ which python3 /usr/bin/python3 zineb@EQ-EQ6288793:~$ which pip3 /usr/bin/pip3
and when I type python3 it gives me python editor to write codes
k

Kevin Kho

04/15/2022, 3:47 PM
So does
pip3 show prefect
show an installation too?
r

RAISS Zineb

04/15/2022, 3:48 PM
Name: prefect Version: 1.2.0 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: /home/zineb/.local/lib/python3.8/site-packages Requires: croniter, dask, importlib-resources, docker, pytz, python-slugify, tabulate, python-box, pendulum, urllib3, mypy-extensions, click, distributed, cloudpickle, marshmallow-oneofschema, toml, packaging, marshmallow, python-dateutil, pyyaml, msgpack, requests Required-by:
k

Kevin Kho

04/15/2022, 3:49 PM
Ok we need to point your python3 to be the default python. I don’t know how to do this immediately. Will look a bit
r

RAISS Zineb

04/15/2022, 3:54 PM
Steps to Set Python3 as Default On ubuntu? • Check python version on terminal -
python --version
• Get root user privileges. On terminal type -
sudo su
• Write down the root user password. • Execute this command to switch to python 3.6.
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
• Check python version -
python --version
• All Done!
k

Kevin Kho

04/15/2022, 3:55 PM
Did that work for you?
👍 1
You issue is similar to this . Maybe you can export the PATH and pip install with the --user flag. These issues are always hard to deal with
r

RAISS Zineb

04/15/2022, 4:00 PM
I don't think so, because the UI works well if the problem is at the python level, I'm going to make codes or runner scripts!
I'll look into that, and I'll keep looking for solutions
k

Kevin Kho

04/15/2022, 4:02 PM
Yes this is a path issue, and is why using something like Anaconda makes things easier
r

RAISS Zineb

04/19/2022, 5:32 PM
Hello, during my work on Ubuntu and prefect I typed a command to start local agent and this error message appeared to me another time!! is this problem related to the configuration of prefect? because I did an installation with pip and then I connected the UI with server
k

Kevin Kho

04/19/2022, 5:35 PM
This is a python environment issue and potentially having multiple interpreters. If you only have one Python installation or if you use something like Anaconda it should be fine
r

RAISS Zineb

04/19/2022, 5:36 PM
I have just python3, Python 3.8.10
k

Kevin Kho

04/19/2022, 5:38 PM
This really isn’t a Prefect issue if the environment is consistent. There really isn’t anything configurable about Python packages that would affect this. I think you can test with another library (like with pandas) and I think you should see the same behavior
r

RAISS Zineb

04/19/2022, 5:43 PM
I did pip install pandas and it works fine "Successfully installed numpy-1.22.3 pandas-1.4.2"
k

Kevin Kho

04/19/2022, 5:57 PM
Ah ok it’s really the CLI though that is not using the correct Python path. This is honestly pretty hard to mange without something like Anaconda. Can you use
conda
as an environment manager?
a

Anna Geller

04/19/2022, 6:01 PM
@RAISS Zineb I'm gonna write a Discourse topic on how you can troubleshoot and fix this error, will send a link in a moment
👍 1
r

RAISS Zineb

04/19/2022, 6:15 PM
Yes @Anna Geller It's working with python3 -m prefect server start
Thank you @Kevin Kho and @Anna Geller
👍 1