Skip to content

BUG: clipboard does not work on wayland #51744

Open
@jcorbin

Description

@jcorbin

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.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO DataIO issues that don't fit into a more specific labelUpstream issueIssue related to pandas dependency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions