pytailwindcss icon indicating copy to clipboard operation
pytailwindcss copied to clipboard

PyTailwindCssBinaryNotFound with latest (v4.0.0)

Open SHoen opened this issue 11 months ago • 3 comments

Tailwindcss stopped working and I go following error that the tailwindcss binary was not found.:

File "/redacted/.venv/lib/python3.12/site-packages/pytailwindcss/__init__.py", line 50, in run
    output = subprocess.run([str(bin_path)] + tailwindcss_cli_args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/redacted/.venv/lib/python3.12/site-packages/pytailwindcss/bin/latest/tailwindcss'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/redacted/.venv/bin/tailwindcss", line 8, in <module>
    sys.exit(main())
                     ^^^^^^
File "/redacted/.venv/lib/python3.12/site-packages/pytailwindcss/__main__.py", line 13, in main
    completed_process = pytailwindcss.run(
                                            ^^^^^^^^^^^^^^^^^^
File "/redacted/.venv/lib/python3.12/site-packages/pytailwindcss/__init__.py", line 55, in run
    raise PyTailwindCssBinaryNotFound(err)
pytailwindcss.exceptions.PyTailwindCssBinaryNotFound: [Errno 2] No such file or directory: '/redacted/.venv/lib/python3.12/site-packages/pytailwindcss/bin/latest/tailwindcss'

What I checked.

  1. tailwindcss binary is availabe under given path.
  2. Permissions are correct also.

After some research I loaded the v3.4.7 binary manual into the correct location and it worked again.

if I use tailwind with the following env var: export TAILWINDCSS_VERSION=v3.4.17 it works perfectly fine.

For me it looks like sth. is broken with the latest release.

SHoen avatar Jan 27 '25 19:01 SHoen

It's working for me... that is to say, it correctly downloads 4.0 and executes the 4.0 binary.

4.0 broke all my CSS but that's a different issue.

kuthair avatar Jan 28 '25 19:01 kuthair

I'm seeing this in my logs:

sh: 1: watchman: not found
≈ tailwindcss v4.0.0

Done in 912ms
Done in 8ms
Done in 1ms
Done in 1ms
Done in 1ms
Done in 974µs
Done in 5ms
Done in 1ms
Done in 2ms
Done in 1ms
Done in 1ms
Done in 536µs
Done in 656µs
Done in 532µs
Done in 802µs
Done in 1ms
Done in 543µs
Done in 603µs
Done in 909µs
Done in 1ms
Done in 824µs
Done in 835µs
Done in 4ms
Done in 1ms
... (continues over and over again apparently detecting changes that don't exist)

It doesn't seem to pick up the CSS classes from my code anymore

Adding TAILWINDCSS_VERSION=v3.4.17 to the environment fixes things for me :) Thanks for that

JamesHutchison avatar Jan 29 '25 17:01 JamesHutchison

That's an issue with Tailwindcss, not pytailwindcss.

See the upgrade guide here:

https://tailwindcss.com/docs/upgrade-guide

kuthair avatar Jan 29 '25 20:01 kuthair