To quickly install Covalent and run a short demo, follow the four steps below.
Before you start
Ensure you are using a compatible OS and Python version. See the Compatibility page for supported Python versions and operating systems.
1. Use Pip to install the Covalent server and libraries locally.
Type the following in a terminal window:
$pipinstallcovalent
2. Start the Covalent server.
In the terminal window, type:
$ covalentstart
Covalent server has started at http://localhost:48008
3. Run a workflow.
Open a Jupyter notebook or Python console and run the following Python code:
importcovalentasct# Construct manageable tasks out of functions# by adding the @covalent.electron decorator@ct.electrondefadd(x,y):returnx+y@ct.electrondefmultiply(x,y):returnx*y@ct.electrondefdivide(x,y):returnx/y# Construct the workflow by stitching together# the electrons defined earlier in a function with# the @covalent.lattice decorator@ct.latticedefworkflow(x,y):r1=add(x,y)r2=[multiply(r1,y)for_inrange(4)]r3=[divide(x,value)forvalueinr2]returnr3# Dispatch the workflowdispatch_id=ct.dispatch(workflow)(1,2)result=ct.get_result(dispatch_id)print(result)
4. View the workflow progress.
Navigate to the Covalent UI at http://localhost:48008 to see your workflow in the queue:
Click on the dispatch ID to view the workflow graph:
Note that the computed result is displayed in the Overview.