I have a random forest model that I’ve trained in Python 3.11.0 with scikit-learn. I’m then exporting the model weights with skompiler 0.7. I then export the model weights to dataframe, and then copy to clipboard. I have pyperclip 1.8.2 installed. I’ve installed xclip and xsel on my ubuntu 20.04.6 LTS server that I’m running my code on. I’m getting the error below when I run the code in a cell in a jupyter notebook I’m hosting from my ubuntu server. Do you know what the issue might be and can you suggest how to solve it?
code:
from skompiler import skompile
from skompiler.fromskast.excel import excel_range
expr = skompile(rf.predict,excel_range(f"B3:BQ3")
code = expr.to('excel', multistage=True, assign_to=exccel_range('BT3:*3'))
code.to_dataframe().to_clipboard()
error:
---------------------------------------------------------------------------
PyperclipException Traceback (most recent call last)
Cell In[48], line 1
----> 1 code.to_dataframe().to_clipboard()
File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/util/_decorators.py:333, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
327 if len(args) > num_allow_args:
328 warnings.warn(
329 msg.format(arguments=_format_argument_list(allow_args)),
330 FutureWarning,
331 stacklevel=find_stack_level(),
332 )
--> 333 return func(*args, **kwargs)
File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/core/generic.py:3244, in NDFrame.to_clipboard(self, excel, sep, **kwargs)
3177 r"""
3178 Copy object to the system clipboard.
3179
(...)
3240 pyperclip.copy(html)
3241 """
3242 from pandas.io import clipboards
-> 3244 clipboards.to_clipboard(self, excel=excel, sep=sep, **kwargs)
File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/io/clipboards.py:178, in to_clipboard(obj, excel, sep, **kwargs)
175 obj.to_csv(buf, sep=sep, encoding="utf-8", **kwargs)
176 text = buf.getvalue()
--> 178 clipboard_set(text)
179 return
180 except TypeError:
File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/io/clipboard/__init__.py:659, in lazy_load_stub_copy(text)
657 global copy, paste
658 copy, paste = determine_clipboard()
--> 659 return copy(text)
File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/io/clipboard/__init__.py:316, in init_no_clipboard.<locals>.ClipboardUnavailable.__call__(self, *args, **kwargs)
315 def __call__(self, *args, **kwargs):
--> 316 raise PyperclipException(EXCEPT_MSG)
PyperclipException:
Pyperclip could not find a copy/paste mechanism for your system.
For more information, please visit
https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error