qtile: ModuleNotFoundError: No module named 'xcffib.ffi_build'

Maintainers update (2023-06-15)

This is now fixed on tree but not released yet.

In the meantime, you can install Qtile from source with pip install git+https://github.com/qtile/qtile@master. 😃


The issue:

Hi guys,

After trying to update qtile (from Github) in my Fedora machine I bumped with this issue:

Defaulting to user installation because normal site-packages is not writeable
Processing /home/eddie/qtile
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  Ɨ Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      /usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py:264: UserWarning: Unknown distribution option: 'use_scm_version'
        warnings.warn(msg)
      Failed to find pulseaudio headers. PulseVolume widget will be unavailable
      Failed to find pywlroots. Wayland backend libinput configuration will be unavailable.
      Traceback (most recent call last):
        File "/usr/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/usr/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
          return hook(metadata_directory, config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 377, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 484, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 105, in <module>
        File "/usr/lib/python3.11/site-packages/setuptools/__init__.py", line 87, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
                                       ^^^^^^^^^^^^
        File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 476, in __init__
          _Distribution.__init__(
        File "/usr/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 282, in __init__
          self.finalize_options()
        File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 900, in finalize_options
          ep(self)
        File "/usr/lib/python3.11/site-packages/setuptools/dist.py", line 920, in _finalize_setup_keywords
          ep.load()(self, ep.name, value)
        File "/home/eddie/.local/lib/python3.11/site-packages/cffi/setuptools_ext.py", line 219, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "/home/eddie/.local/lib/python3.11/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "/home/eddie/.local/lib/python3.11/site-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "libqtile/backend/x11/xcursors_ffi_build.py", line 25, in <module>
          from xcffib.ffi_build import ffi as xcffib_ffi
      ModuleNotFoundError: No module named 'xcffib.ffi_build'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Ɨ Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I also tried some of the solution here to no avail.

Thanks,

Eddie

Required:

  • I have searched past issues to see if this bug has already been reported.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 39 (23 by maintainers)

Most upvoted comments

Sorry if I’m being rude, but this repo is about Qtile, not Arch Linux

I thought because the AUR package is maintained by @m-col , it would be good to keep the discussion related to this issue in one place. Sorry if I misjudged this. More clarity on this would be appreciated. I will add a comment to the AUR package page. (Due to some unrelated breakage in xkeyboardconfig I wasn’t able to log in there earlier)

I found out how to select a specific older revision of the git repo, so now I am using the qtile version from 3 weeks ago again.

If you want to run on Wayland, you most likely want to install Qtile with the extra-dependencies: pip install qtile[wayland]

Ah, yeah that sounds right, I just couldn’t remember the exact syntax. Thanks for reminding me. Unforunately even after installing the missing dependencies with pip by trial and error, all I got was a segfault. Seems like the same problem I had when trying to test the wlroots-0.16 branch. I tried asking there how to properly test qtile in a venv (so not using the system packages I guess?), but haven’t gotten an answer. If there is some documentation about this, I would be very grateful if you could point me to it.

Feel free to continue this discussion in https://github.com/qtile/qtile/pull/3985, seeing as it now departs more from the original issue.

@cr1ogen This is another problem, can you please open another issue?

Alright then come to Discord / IRC if you want me to investigate

I was just looking at your chat with Alex on discord, but now I have to get back to work (i’m from Argentina xD). Thanks anyway

I’m Alex from discord, I’ll describe the step by step I used to install qtile.

The following steps were used on Ubuntu 23.04:

Required packages: python3-virtualenv python3-pip

mkdir ~/qtile python3 -m virtualenv ~/qtile source ~/qtile/bin/activate

pip install xcffib==1.3.0 pip install --no-cache-dir cairocffi pip install --no-use-pep517 --no-build-isolation qtile

OPTIONAL: pip install dbus-next

#Leaving the virtualenv deactivate

When installing qtile by pip, it does not create the xsessions entry and also does not create the /usr/share/doc/qtile/default_config.py file

Alternative default config file: https://github.com/qtile/qtile/blob/master/libqtile/resources/default_config.py

OPTIONAL: install package: python3-virtualenv-clone

#move virtualenv folder ā€˜qtile’ for /opt/qtile sudo virtualenv-clone ~/qtile /opt/qtile

#replace user sudo chown -R user:user /opt/qtile

#set qtile for enviroment mkdir ~/.local/share/bin ln -s /opt/qtile/bin/qtile ~/.local/share/bin/qtile

#add PATH ~/.local/share/bin on .bashrc or .zshrc export PATH=ā€œ$HOME/.local/share/bin:$PATHā€

#creating an entry in xsessions | /usr/share/xsessions/qtile.desktop [Desktop Entry] Name=Qtile Comment=Qtile Session Exec=/opt/qtile/bin/qtile start Type=Application X-GDM-SessionRegisters=true Keywords=wm;tiling

Alright then come to Discord / IRC if you want me to investigate

Your Qtile still talks with 1.4.0 somehow. There really should be no other reason for that error to happen.

I just added a note on the OP and pinned the issue until we finish this ā€œmigrationā€ since I guess most newcomers will hit this.

Well I don’t know what I was doing wrong because I was using this sequence:

pip install --no-cache xcffib==1.3.0
pip install --no-build-isolation --no-cache --upgrade --ignore-installed "cairocffi[xcb]"
python -m pip install  --no-build-isolation --no-cache --upgrade .

And that was leading to the errors above. Note that I also tried pip install --no-build-isolation --no-cache --upgrade --ignore-installed "cairocffi[xcb]==1.3.0" with no success.

My solution was:

pip install -I --force-reinstall --no-cache xcffib==1.3.0

and then install qtile.

Also is worth to note that after installing cairocffi[xcb] a folder of xcffib 1.4 version was created. It may be related with @tych0 issue

Thanks anyway guys.