Unable to uninstall plugin or to save my Custom control editor modifications


#1

Hi,
I tried to uninstall Octoprint_toggle and I get this error message:
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/OctoPrint_Toggle-0.1-py2.7.egg/EGG-INFO/requires.txt'

I guess Octoprint gains sudo access while installing/uninstalling plugins ?
I tried by hand and (as expected) I don't have write access to that directory as user octo, and complete access as root.

Am I doing something wrong/stupid ?
Thank you


#2

Just noticed another problem on another Beaglebone....Entering "plugin Manager" I receive the error message " The pip command could not be found. Please configure it manually. No installation and uninstallation of plugin packages is possible while pip is unavailable."

Nethertheless pip IS available on my systems (I checked as root as well as octo)


#3

I'm no expert in the plugin manager but it looks to me like this is in the wrong place.

OctoPrint and many programs written in Python these days take advantage of a concept of compartmentalization using a virtual manager. When I deal with my own OctoPi-imaged Raspberry Pi, I know that the location of python is something like...

~/oprint/lib/python2.7

...or something like that. If I'm developing here on my MacBook, there's a step which involves me running some commands and one of them is...

source venv/bin/activate

My prompt then changes to indicate that I'm running inside a virtual environment which is separate from the global/normal one. Here, it will use a dedicated installation of python which is in a different space.

One advantage to this approach is that the entire subdirectory tree belongs to the user in question. It's all under their home directory so there's never a rights issue like you're having.

Short answer: I'm guessing that your installation approach is wrong since you're using the global location of python. Read the documentation and see what's required.


#4

Thank you for your answer and patience, unfortunately I have been using my beaglebone OctoPrint setup for months, problem raised only yesterday, so I don’t think there’s some “original sin”. More other, if I change some OctoPrint settings (like virtual com speed) my parameters are saved without problems. My problem is on plugin management and/or configuration....


#5

The plugin you are trying to uninstall isn't installed in a virtual environment. It might be that your OctoPrint installation isn't either. That's not a recommended setup and plugin management will not work if OctoPrint can't write to the environment - which is why the use of a virtual environment is recommended. OctoPrint doesn't use sudo on its own for plugin management (unless you tell it to which is not recommended for various reasons).

Please share your log files so it can become a bit more clear what kind of setup you have there, right now it's only possible to blindly guess.

To be honest, based on the error you are seeing I have my doubts here :wink: But an octoprint.log should provide clarification.


#6

UPDATE: I discovered that two scripts did not have group write access....weird, I did not touch these, only worked with custom control editor...Anyway, now plugin works again.....

root@kamikaze:/home/octo/.octoprint# cd scripts/
root@kamikaze:/home/octo/.octoprint/scripts# ls -la
total 12
drwxr-xr-x 3 octo octo 4096 Jan 24 2018 .
drwxr-xr-x 13 octo octo 4096 Sep 26 17:09 ..
drwxr-xr-x 2 octo octo 4096 Sep 26 16:59 gcode
root@kamikaze:/home/octo/.octoprint/scripts# cd gcode/
root@kamikaze:/home/octo/.octoprint/scripts/gcode# ls -la
total 20
drwxr-xr-x 2 octo octo 4096 Sep 26 16:59 .
drwxr-xr-x 3 octo octo 4096 Jan 24 2018 ..
-rw------- 1 octo octo 145 Sep 17 15:04 afterPrintCancelled
-rw-rw---- 1 root root 31 Sep 19 14:50 afterPrintDone
-rw------- 1 octo octo 60 Sep 26 16:59 afterPrinterConnected
root@kamikaze:/home/octo/.octoprint/scripts/gcode# chmod a=rw after*
root@kamikaze:/home/octo/.octoprint/scripts/gcode# chmod a=rw after*
root@kamikaze:/home/octo/.octoprint/scripts/gcode# ls -la
total 20
drwxr-xr-x 2 octo octo 4096 Sep 26 16:59 .
drwxr-xr-x 3 octo octo 4096 Jan 24 2018 ..
-rw-rw-rw- 1 octo octo 145 Sep 17 15:04 afterPrintCancelled
-rw-rw-rw- 1 root root 31 Sep 19 14:50 afterPrintDone
-rw-rw-rw- 1 octo octo 60 Sep 26 16:59 afterPrinterConnected


#7

here a log of erro:

2018-09-26 16:56:46,555 - octoprint.plugins.softwareupdate - INFO - Saved version cache to disk
2018-09-26 16:56:52,241 - octoprint.server - INFO - Preemptively caching / for {'query_string': 'en', 'path': '/', 'base_url': 'http://192.168.0.180/'}
2018-09-26 16:56:54,984 - octoprint.server.util.sockjs - INFO - Client connection closed: 192.168.0.88
2018-09-26 16:56:55,862 - octoprint.server.util.sockjs - INFO - New connection from client: 192.168.0.88
2018-09-26 16:57:29,193 - octoprint - ERROR - Exception on /api/settings [POST]
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/usr/local/lib/python2.7/dist-packages/OctoPrint-1.2.16-py2.7.egg/octoprint/server/util/flask.py", line 934, in decorated_view
return flask.ext.login.login_required(func)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Flask_Login-0.2.11-py2.7.egg/flask_login.py", line 758, in decorated_view
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/Flask_Principal-0.3.5-py2.7.egg/flask_principal/init.py", line 198, in _decorated
rv = f(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/OctoPrint-1.2.16-py2.7.egg/octoprint/server/api/settings.py", line 284, in setSettings
s.saveScript("gcode", name, script.replace("\r\n", "\n").replace("\r", "\n"))
AttributeError: 'NoneType' object has no attribute 'replace'
2018-09-26 16:57:47,647 - octoprint.server.util.sockjs - INFO - Client connection closed: 192.168.0.88
2018-09-26 16:57:47,912 - octoprint.server.util.sockjs - INFO - New connection from client: 192.168.0.88


#8

I also had troubles removing Custom Control Editor plugin. The log file would say 'uninstalled successfully' and the plugin would not be listed under the list of installed plugins, but the additional controls created by this plugin remain present in UI. It appears that this plugin was last updated 4 years ago and may have compatibility issues with the latest versions of OctoPrint.

I was able to make it disappear from UI by manually removing corresponding section from config.yaml file and restarting OctoPrint, but I wonder - what is the right way of removing "broken" plugins like this? My plugins directory is empty; so where should I look if any files related to this plugin are still present?

Thanks


#9

You found the plugins.pluginName section in the config.yaml. That's one thing to cleanup. If you're in the virtual environment then run a pip freeze and look for the offending plugin. If there, I think you could do a pip uninstall pluginName and it should try to remove it from the virtual environment.

You could manually look for an .egg file within the pi user's home directory: find ~ -name *.egg | less . In some cases, they might add a file under /etc/sudoers.d to permission the pi user to do sudo-less commands of some sort; if you recognized something that only that plugin had you could consider deleting it if you know what you're doing.

Ultimately, the original setup.py file is supposed to take care of this under the control of the plugin manager. Going to school on this file (and the requirements.txt) for the plugin may give you more insight. For example, the plugin might install something like numpy or similar.


#10

Yes, as I've mentioned

I was able to make it disappear from UI by manually removing corresponding section from config.yaml file and restarting OctoPrint

2 days ago I flushed the image and installed OctoPi 0.16.0, so will try other suggestions later, if I have a similar problem.
Thanks