Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building locally and running scroll demo fails on Linux Mint 20 (Ubuntu 20) #2

Open
hbk619 opened this issue Dec 4, 2020 · 2 comments

Comments

@hbk619
Copy link

hbk619 commented Dec 4, 2020

This is a neat project!

I cloned the repo, ran poetry install, used poetry to run the scroll demo script and got:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/ssd/code/gest/gest/examples/two_handed_scroll_and_click.py", line 6, in <module>
    import pynput.mouse
  File "/home/kimmy/.cache/pypoetry/virtualenvs/gest-DwnxmegZ-py3.8/lib/python3.8/site-packages/pynput/__init__.py", line 40, in <module>
    from . import keyboard
  File "/home/kimmy/.cache/pypoetry/virtualenvs/gest-DwnxmegZ-py3.8/lib/python3.8/site-packages/pynput/keyboard/__init__.py", line 31, in <module>
    backend = backend(__name__)
  File "/home/kimmy/.cache/pypoetry/virtualenvs/gest-DwnxmegZ-py3.8/lib/python3.8/site-packages/pynput/_util/__init__.py", line 76, in backend
    raise ImportError('this platform is not supported: {}'.format(
ImportError: this platform is not supported: ("failed to acquire X connection: No module named 'Xlib'", ModuleNotFoundError("No module named 'Xlib'"))

Try one of the following resolutions:

 * Please make sure that you have an X server running, and that the DISPLAY environment variable is set correctly

I activated the poetry shell via poetry shell and tried again:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/ssd/code/gest/gest/examples/two_handed_scroll_and_click.py", line 6, in <module>
    import pynput.mouse
  File "/home/kimmy/.cache/pypoetry/virtualenvs/gest-DwnxmegZ-py3.8/lib/python3.8/site-packages/pynput/__init__.py", line 40, in <module>
    from . import keyboard
  File "/home/kimmy/.cache/pypoetry/virtualenvs/gest-DwnxmegZ-py3.8/lib/python3.8/site-packages/pynput/keyboard/__init__.py", line 31, in <module>
    backend = backend(__name__)
  File "/home/kimmy/.cache/pypoetry/virtualenvs/gest-DwnxmegZ-py3.8/lib/python3.8/site-packages/pynput/_util/__init__.py", line 76, in backend
    raise ImportError('this platform is not supported: {}'.format(
ImportError: this platform is not supported: ("failed to acquire X connection: No module named 'Xlib'", ModuleNotFoundError("No module named 'Xlib'"))

Try one of the following resolutions:

 * Please make sure that you have an X server running, and that the DISPLAY environment variable is set correctly

Running pip install gest shows an error but does actually install and then
(venv) ➜ gest-test python -m gest.examples.two_handed_scroll_and_click
works.

X-server is running and display is set

(gest-DwnxmegZ-py3.8) ➜  gest git:(master) ✗ echo $DISPLAY
:0.0

I planned on integrating with Talon as an experiment so I don't think I need pynput for that but wondered what I've missed to make it work :-)

@bm371613
Copy link
Owner

bm371613 commented Dec 4, 2020

After a short investigation, here is what I think happens: a problem similar to this python-poetry/poetry#2269 makes poetry ignore platform specific requirements. I suspect it affects pip install gest because I use poetry to push to PyPI.

Before I figure out a proper fix, it might help to run pip install pynput.

@hbk619
Copy link
Author

hbk619 commented Dec 4, 2020

That works 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants