https://prefect.io logo
m

Matthew Blau

12/30/2020, 2:24 PM
Hello all, I have attempted to install prefect on a Ubuntu server via
Copy code
pip3 install prefect
and when I run
Copy code
prefect backend server
I get a
Copy code
prefect: command not found
my python version is 3.6.8. What am I doing wrong?
j

josh

12/30/2020, 2:27 PM
Hmm this looks to be due to the executable not being on your PATH, take a look at this solution here and see if it solves your issue https://stackoverflow.com/a/35899029/10563601 https://askubuntu.com/a/900316
m

Matthew Blau

12/30/2020, 2:29 PM
path on my Ubuntu server:
Copy code
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/mssql-tools/bin
and the path on my local machine where the installation works as expected:
Copy code
/home/mblau/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/mssql-tools/bin
Ahh I see that when I import it and print out
Copy code
prefect.__file__
it shows
Copy code
/home/serverName/.local/lib/python3.6/site-packages/prefect/__init__.py
as its location
On my local system it also shows
Copy code
/home/mblau/.local/lib/python3.8/site-packages/prefect/__init__.py
as prefect's location and I can run prefect backend server and start server from anywhere. Hmmm
j

josh

12/30/2020, 3:28 PM
I wonder if
~/.local/lib/
needs to be on your PATH, it doesn’t appear to be on it in the one you pasted
m

Matthew Blau

12/30/2020, 3:31 PM
That's the odd thing, on both machines it's not in the path but only on my local system can I run prefect server start from anywhere.
@josh I just got back to trying to figure out what the issue is and even being in
Copy code
/home/ServerName/.local/lib/python3.6/site-packages
I get a prefect: command not found. I have uinstalled and reinstalled prefect via pip as well. Any ideas?
j

josh

12/30/2020, 7:03 PM
It still must not be on the path somehow. The only somewhat similar issue I found is https://github.com/PrefectHQ/prefect/issues/3779 but it is not exactly the same. Running with a virtual environment (such as conda) should resolve this 🤔
m

Matthew Blau

12/30/2020, 7:26 PM
@josh for now I am able to call it directly. I was informed yesterday that I can do a
Copy code
prefect server start -d
in order to start it in the background, however I do not see that as an option and I am using 0.14.1 as I had just reinstalled it today
j

josh

12/30/2020, 7:27 PM
What do you see when you run with the
-d
flag?
m

Matthew Blau

12/30/2020, 7:27 PM
Copy code
mblau@mblau-VirtualBox:~/.local/bin$ prefect server start -d --use-volume
Usage: prefect server start [OPTIONS]
Try 'prefect server start -h' for help.

Error: no such option: -d
j

josh

12/30/2020, 7:28 PM
And when you run
prefect version
do you see
0.14.1
?
m

Matthew Blau

12/30/2020, 7:29 PM
hmm, actually it seems to have picked up 0.14.0. How am I able to upgrade this?
j

josh

12/30/2020, 7:29 PM
pip install prefect -U
m

Matthew Blau

12/30/2020, 7:37 PM
Awesome! Thank you. You guys have been a big help
@josh one last question, hopefully, for today. Where can I find documentation on changing ports for the various services that Prefect uses. hasura is unable to start as we already use port 3000.
j

josh

12/30/2020, 7:49 PM
You should be able to change the ports for all of the services in the
prefect server start
command
Copy code
--postgres-port     TEXT    Port used to serve Postgres, defaults to '5432'
      --hasura-port       TEXT    Port used to serve Hasura, defaults to '3000'
      --graphql-port      TEXT    Port used to serve the GraphQL API, defaults to '4201'
      --ui-port           TEXT    Port used to serve the UI, defaults to '8080'
      --server-port       TEXT    Port used to serve the Core server, defaults to '4200'
https://docs.prefect.io/api/latest/cli/server.html#start
m

Matthew Blau

12/30/2020, 9:08 PM
@josh That did the trick, thank you! I am looking at the docs for the local agent and since this is running on a remote server, I would want to run
Copy code
prefect agent local install
correct? I don't see an option for running the local agent in the background and it would appear that using Supervisor is the best option. Also the link for supervisor.org doesn't actually go to anything.
j

josh

12/30/2020, 9:10 PM
Ah will fix that! It’s supposed to be supervisord.org 🙂 yeah running the local agent would be fine and since it’s on a remote server you’re going to want to look into the other flow storage options besides the default Local storage: https://docs.prefect.io/orchestration/flow_config/storage.html
m

Matthew Blau

12/30/2020, 9:10 PM
It is a on prem server, just remote to me.
j

josh

12/30/2020, 9:12 PM
Yeah yeah since the server isn’t running on your machine you will just need to use a storage option other than the default Local storage because Local storage stores the flow as a file on the machine you register it from. So in order to get it to the agent running elsewhere it needs to be able to pull the flow from some cloud-based storage
m

Matthew Blau

12/30/2020, 9:21 PM
The way that I was envisioning us registering the flows was from this server. The flows were going to live on this server, is this not a recommended way of operating?
j

josh

12/30/2020, 9:22 PM
Ah you can definitely do that as well! I thought by your messaging it seemed like you would be registering from your local environment
m

Matthew Blau

12/30/2020, 9:25 PM
Ah, so in this case for the local agent to run in the background I would need to use Supervisor? or is there an easy way to start the agent in the background without the use of supervisor? It wasn't very clear to me in the docs what is best practice for this
j

josh

12/30/2020, 9:28 PM
Supervisor is just one example of running it in the background, it really comes down to your preference and what’s available on your machine. So on linux you could even use something like
nohup
m

Matthew Blau

12/30/2020, 9:29 PM
Ahh, that's good to know. It is a Ubuntu server we are running Prefect on