Installing and using Cylc with uv

Hi all,

I just installed Cylc 8 with uv. It installed very quickly (~10 seconds). I wondered if anyone else has used uv to manage a Cylc project and if they ran into any hiccups. I can’t seem to get the gui to work.

My steps:

  1. Installed uv.

  2. Created a new project.
    Since the gui only works with Python 3.9 at the moment, I pinned that version…

    uv init test-cylc-install --python ">=3.9,<3.10"
    cd test-cylc-install
    
  3. Added cylc-flow and cylc-uiserver as dependencies

    uv add cylc-flow cylc-uiserver
    

    This only took ~10 seconds to install! :exploding_head:


While in my project directory, I can run the Cylc command in the venv like this:

uv run cylc

Doing uv run cylc --version gives me 8.4.2.

I can also invoke the tui

uv run cylc tui

But when I try using the gui with uv run cylc gui I get this error:

"cylc gui" requires "cylc-uiserver"

ModuleNotFoundError: No module named 'pkg_resources'

This is strange to me because I have installed cylc-uiserver in the venv. When I do uv pip list I see that I have the dependency is installed in the venv…

...
cylc-flow                 8.4.2
cylc-uiserver             1.6.1
...

I also have node and npm in my path. Maybe I’m still missing something.


I think its neat that I can also use Cylc as a uv tool (without installing it in a venv), but I don’t know how this behaves when actually running workflows.

uvx --from cylc-flow cylc
uvx --from cylc-flow cylc tui

Hi @blaylockbk

Huh, yeah uv seems great, I just tried it myself. I like the project directory style (although we might need to think about how to use it with the Cylc multi-version wrapper).

Missing pkg_resources seems to be the root cause of that. I did this in the project:

$ uv add setuptools
$ uv run cylc gui

and everything worked perfectly (GUI, a running workflow, and some intervention commands - cylc trigger etc.).

1 Like

I’ve switched from pip to uv pip with no problems, but would generally recommend installing from conda-forge (e.g. using conda, mamba or pixi) rather than from pypi (e.g. using pip or uv) because this ensures the full stack is installed (including system tools that are not available on pypi).

uvx, pipx and other similar tools are a good way to install many CLI tools, they install packages into virtual environments behind the scenes and expose their commands using wrapper scripts. This is much the same as our recommended deployment pattern (see Installation — Cylc 8.4.2 documentation), however, it does not support the installation of parallel Cylc environments (e.g. we have multiple versions of Cylc installed at the same time).

These venv + wrapper script solutions should work fine with Cylc. However, Cylc is not a simple fire-and-forget CLI tool, it’s a full distributed system that needs to launch subprocesses and invoke itself over SSH, so there may be complications.

ModuleNotFoundError: No module named ‘pkg_resources’

Makes sense, this dependency will be removed in the next cylc-uiserver release.

1 Like

Thanks! Adding setuptools worked!

Thanks @oliver.sanders for your thoughts.