Guide: How to make the Cutter plugin load other Python packages #3533
xxnuo
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I encountered similar issues on both Linux and macOS. Some Python packages are not built-in, and modifying the environment can be messy and problematic. So, I researched how to install third-party Python packages and run Python plugins without modifying the system, for the reference of newcomers.
Note:
homepath may result in the errorNo such file or directory. Simply replace thehomewith the absolute path to your user directory.Step 1: Get the Python plugin
This article uses this plugin as an example:
https://github.com/restkhz/CutterMCP-plus
The same applies to other plugins.
Step 2: Obtain the plugin path
Open Cutter, click on Edit > Preferences > Plugins from the menu bar.
The plugin directory will be displayed on the right.
Click to open and navigate to the
pythonfolder, then record the path.This article uses my path as an example:
home/Library/Application Support/rizin/cutter/plugins/python(Using thehomepath may result in aNo such file or directoryerror; simply replace thehomewith the absolute path of your user directory)Step 3: Obtain the Python version built into Cutter
Open terminal and execute (on macOS. Linux and Windows need to find it yourself):
The output content shows that the built-in Python version of my Cutter is
3.12, remember it:Step 4: Modify the plugin's dependency files (not required when installing packages manually)
Take the plugin I downloaded as an example, it has a
requirements.txt:We need to remove the
PySide6plugin that is already built into Cutter to prevent conflicts (I also removed the version number constrained in the file, you can choose this yourself), the modified file content:Step 5: Crucial, install dependencies to the plugin directory
Modify the following command
uv pipis equivalent topip3and can be replaced by yourself; I'm just used to the fasteruvtargetwith the Cutter python plugin directory obtained abovepython-versionwith the Python version built into Cutter obtained abovehomepath may cause errorNo such file or directory, just replace thehomewith the absolute path of your user directoryStep 6: Modify the plugin source code
Taking my project above as an example, its plugin file is
mcp_plugin.py, open it with an editor and add the following code at the top of the fileThen copy the modified file to the plugin directory obtained above:
cp mcp_plugin.py "home/Library/Application Support/rizin/cutter/plugins/python"Using the
homepath may result in aNo such file or directoryerror. Simply replace thehomewith the absolute path to your user directory.Step 7: Restart Cutter
Now plugins that depend on third-party Python packages can be loaded normally
Beta Was this translation helpful? Give feedback.
All reactions