Skip to content

BUG: clipboard does not work on wayland #51744

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

Open
3 tasks done
jcorbin opened this issue Mar 2, 2023 · 2 comments
Open
3 tasks done

BUG: clipboard does not work on wayland #51744

jcorbin opened this issue Mar 2, 2023 · 2 comments
Labels
Bug IO Data IO issues that don't fit into a more specific label Upstream issue Issue related to pandas dependency

Comments

@jcorbin
Copy link

jcorbin commented Mar 2, 2023

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

# Use any clipboard copying method on a wayland system without legacy x11 clipboard programs installed
df.to_dataframe()

give an exception:

PyperclipException: 
    Pyperclip could not find a copy/paste mechanism for your system.
    For more information, please visit
    https://pyperclip.readthedocs.io/en/latest/#not-implemented-error

Issue Description

As you can see, the copy of pyperclip at https://github.com/pandas-dev/pandas/blob/main/pandas/io/clipboard/__init__.py lacks wayland support as can be seen in "upstream": https://github.com/asweigart/pyperclip/blob/master/src/pyperclip/__init__.py (search for wl-copy)

Additionally the exception spuriously points to upstream pyperclip docs, when this is a pandas copy of pyperclip... maybe change the exception text to take more ownership of the clipboard mechanism? Not sure what pandas's strategy is on vendoring these sorts of depenencies, but clearly there's some lag since pyperclip has had wayland support for at least 3 years from a glance at their commit history...

Expected Behavior

Clipboard should work on modern wayland systems

Installed Versions

INSTALLED VERSIONS

commit : 2e218d1
python : 3.10.9.final.0
python-bits : 64
OS : Linux
OS-release : 6.2.1-arch1-1
Version : #1 SMP PREEMPT_DYNAMIC Sun, 26 Feb 2023 03:39:23 +0000
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.5.3
numpy : 1.24.2
pytz : 2022.7
dateutil : 2.8.2
setuptools : 67.4.0
pip : None
Cython : 0.29.33
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.2
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.10.0
pandas_datareader: None
bs4 : 4.11.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.3
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
/usr/lib/python3.10/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")

@jcorbin jcorbin added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 2, 2023
@jcorbin
Copy link
Author

jcorbin commented Mar 2, 2023

Fwiw, users can workaround this by just installing the legacy X11 xclip program; but that shouldn't be necessary, pandas's clipboard module should properly support wl-copy.

I'm not sure the rationale behind pandas having/maintaining what seems to be an old copy of pyperclip, but if the intention is to diverge/own the logic, then please avoid this minor mistake: asweigart/pyperclip#220 if/when implementing wayland logic -- tl;dr: it doesn't matter if $DISPLAY is set, just care about $WAYLAND_DISPLAY and if so use wayland over any of the x11/toolkit paths

@rhshadrach
Copy link
Member

Some discussion on why this is vendored is in #28471.

@rhshadrach rhshadrach added the IO Data IO issues that don't fit into a more specific label label Mar 4, 2023
@mroeschke mroeschke added Upstream issue Issue related to pandas dependency and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO Data IO issues that don't fit into a more specific label Upstream issue Issue related to pandas dependency
Projects
None yet
Development

No branches or pull requests

3 participants