Skip to content
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

Upgrade from 1.6.0 to 1.6.2 fails #10

Closed
hgroover opened this issue Oct 9, 2020 · 34 comments
Closed

Upgrade from 1.6.0 to 1.6.2 fails #10

hgroover opened this issue Oct 9, 2020 · 34 comments
Labels
status: markedForAutoClose Issue will be closed automatically

Comments

@hgroover
Copy link

hgroover commented Oct 9, 2020

Describe the bug
I am running Octoprint 1.4.2 via Octopi (installed recently). When trying to update to 1.6.2, I get this error:
Updating, please wait.
/home/pi/oprint/bin/python2 -m pip --disable-pip-version-check install https://github.com/OllisGit/OctoPrint-FilamentManager/releases/latest/download/master.zip --no-cache-dir
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting https://github.com/OllisGit/OctoPrint-FilamentManager/releases/latest/download/master.zip
Downloading https://github.com/OllisGit/OctoPrint-FilamentManager/releases/latest/download/master.zip (245kB)
Requirement already satisfied: OctoPrint in /home/pi/oprint/lib/python2.7/site-packages (from OctoPrint-FilamentManager==1.6.2) (1.4.2)
Requirement already satisfied: backports.csv<1.1,>=1.0.5 in /home/pi/oprint/lib/python2.7/site-packages (from OctoPrint-FilamentManager==1.6.2) (1.0.7)
Requirement already satisfied: uritools<2.2,>=2.1 in /home/pi/oprint/lib/python2.7/site-packages (from OctoPrint-FilamentManager==1.6.2) (2.1.1)
Requirement already satisfied: SQLAlchemy<1.2,>=1.1.15 in /home/pi/oprint/lib/python2.7/site-packages (from OctoPrint-FilamentManager==1.6.2) (1.1.18)
Collecting psycopg2-binary
Downloading https://files.pythonhosted.org/packages/fc/51/0f2c6aec5c59e5640f507b59567f63b9d73a9317898810b4db311da32dfc/psycopg2-binary-2.8.6.tar.gz (384kB)
ERROR: Command errored out with exit status 1:
command: /home/pi/oprint/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-jVjlgA/psycopg2-binary/setup.py'"'"'; file='"'"'/tmp/pip-install-jVjlgA/psycopg2-binary/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-jVjlgA/psycopg2-binary/pip-egg-info
cwd: /tmp/pip-install-jVjlgA/psycopg2-binary/
Complete output (23 lines):
running egg_info
creating /tmp/pip-install-jVjlgA/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info
writing /tmp/pip-install-jVjlgA/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/PKG-INFO
writing top-level names to /tmp/pip-install-jVjlgA/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/top_level.txt
writing dependency_links to /tmp/pip-install-jVjlgA/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/dependency_links.txt
writing manifest file '/tmp/pip-install-jVjlgA/psycopg2-binary/pip-egg-info/psycopg2_binary.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
https://www.psycopg.org/docs/install.html).

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The update did not finish successfully. Please consult octoprint.log and plugin_softwareupdate_console.log for details.

(from octoprint.log)
2020-10-09 12:59:15,760 - octoprint.plugins.softwareupdate - INFO - Starting update of filamentmanager to 1.6.2...
2020-10-09 12:59:22,073 - octoprint.plugins.softwareupdate - ERROR - Update of filamentmanager can not be performed, please also check plugin_softwareupdate_console.log for possible causes of this
Traceback (most recent call last):
File "/home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/softwareupdate/init.py", line 1155, in _perform_update
update_result = updater.perform_update(target, populated_check, target_version, log_cb=self._log, online=online)
File "/home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/softwareupdate/updaters/pip.py", line 116, in perform_update
raise exceptions.UpdateError("Error while executing pip install", (stdout, stderr))
UpdateError
2020-10-09 12:59:22,689 - octoprint.plugins.tracking - INFO - Sent tracking event update_failed, payload: {'to_version': '1.6.2', 'from_version': '1.6.0', 'target': u'filamentmanager'}

Steps to reproduce

  1. Restart Octoprint
  2. Check for update suggests a newer version of Filament Manager is available
  3. Upgrade now
  4. Failure as shown above. Tried a second time as other plugins were (successfully) updated, same result (after restarting Octoprint)

NOTE There appears to be a workaround for this. On Raspbian (Octopi) or other Debian / Ubuntu systems, run
sudo apt-get update
sudo apt-get install libpq-dev
This installs pg_config from the PostgreSQL dev tools.

Expected behavior
Update should succeed.

Did the same happen when all other 3rd party plugins are disabled?
Did not try this.

Log file
octoprint.log

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@ohadlevy
Copy link

ohadlevy commented Oct 9, 2020

same here.

@Deses
Copy link

Deses commented Oct 9, 2020

Yep. Can confirm.

@cicinovec
Copy link

I also confirm this bug

@truglodite
Copy link

truglodite commented Oct 9, 2020

Same here... not sure it's related but sounds like it may be:
https://community.octoprint.org/t/filament-manager-plugin-how-to-setup-postgresql-database/10698/22

I noted that "psycopg2-binary" is already in the plugin_requires section. So it's not that.

@plorimer
Copy link

plorimer commented Oct 9, 2020

Well, good to know it's nothing on my end causing this.

@mpd352
Copy link

mpd352 commented Oct 9, 2020

This is probably going to help the rest of you guys, but I did resolve my issue with a failed upgrade to 1.6.2.

I resolved the issue through the back door. I am running three instances of Octoprint. Two are connected to printers, the third is just a database server for filament manager. The filament manager instance and one of the printer instances are new, having been built up over the last 10 days in my fight to get filament manager to run under Python3.

Both of those instances successfully upgraded to 1.6.2. I just cloned the working printer instance, and reconfigured it, and now all three instances of Octoprint are connecting to the filament manager database.

Thanks,

Kevin

@JamieS01
Copy link

JamieS01 commented Oct 9, 2020

Same problem here 👍

@hgroover
Copy link
Author

hgroover commented Oct 9, 2020

OK, this worked for me on Octopi - I'm in the middle of a very long print job so will not be able to try the actual upgrade anytime soon (about 16 hours to go):

  1. ssh into pi
  2. sudo apt-get update
  3. PATH=/home/pi/oprint/bin:${PATH}
  4. pip install psycopg2-binary
    (just to show you that it will fail in a similar manner to the error)

Now we'll fix the missing pg_config:
5. sudo apt-get install libpq-dev
(thank you StackOverflow)

And now the pip install will work:
6. pip install psycopg2-binary

There will be some warnings about upgrading pip and the upcoming deprecation of Python 2.7 but I believe this will solve the problem. I will not be able to verify for some hours.

@hgroover
Copy link
Author

I was successfully able to update. I don't know if the pip install was needed but the essential step was

sudo apt-get install libpq-dev

@thegarbz
Copy link

Can confirm @hgroover solution worked.
Note: apt-get install libpq-dev initially failed. I had to run "sudo apt update" first.

@hgroover
Copy link
Author

Can confirm @hgroover solution worked.
Note: apt-get install libpq-dev initially failed. I had to run "sudo apt update" first.

Thanks, updated the issue. Good to know the pip command wasn't also needed.

@12345Josparky
Copy link

Ok so I don't know how to do all those commands but mine still is not updating through the update manager

@hgroover
Copy link
Author

@12345Josparky that's just a workaround for those who have ssh / sudo access (not that hard but there are a few steps you might have to go through, like setting up putty or some other ssh client, and knowing the password used to setup your installation of Octopi, assuming that's what you're using; but if you're not already experienced at this it's better to wait for an update).

The maintainers of this addon will probably come out with an update soon that will address this. I'm just a user who is grateful to have this very useful addon and has provided detailed info on what happened and what fixes it. My best suggestion is to wait, seeing that the maintainers here are pretty active they will have an update before long. In the meantime the previous version should work perfectly well.

I hope that helps!

@12345Josparky
Copy link

Thanks for the quick reply I do have putty but I am not that familiar with it at all lol. I watched a video that showed me how to set it all up and that was couple years ago. I don't even remember how I done it lol. I can wait no biggy. Thanks for your help and reply.

@spanzetta
Copy link

I also confirm it works with the manual update

@maxmednik
Copy link

Same problem here. Can we just not worry about manually updating and wait until a future update fixes this so it can auto-update via Octoprint by itself smoothly?

@thegarbz
Copy link

Sure but I wouldn't hold your breath. The problem appears to be in pip not in this plugin. Outdated versions of pip fail to install the dependency. You will likely need to wait for Octopi itself to receive an update.

@Deses
Copy link

Deses commented Oct 11, 2020

Same problem here. Can we just not worry about manually updating and wait until a future update fixes this so it can auto-update via Octoprint by itself smoothly?

If you want to keep receiving the update notification, sure.

sudo apt-get install libpq-dev, it's not that hard.

@maxmednik
Copy link

Is it just that one command? I see.5 other steps in hgroover's reply earlier, and I'm worried about one of those failing also. Should I try just the one command you wrote, Deses, or all 6 of hgroover's commands?

@hgroover
Copy link
Author

hgroover commented Oct 12, 2020 via email

@12345Josparky
Copy link

so where do you put the commands can they be put in octoprint??

@mpd352
Copy link

mpd352 commented Oct 12, 2020

download and install PuTTY. https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html.

use the ip address of your octoprint instance to telnet direct to it witH PuTTY. log in with the username and password you used to create your octoprint instance, then enter the commands listed.

@DeviousPenguin
Copy link

Thanks for posting the fix, sudo apt install libpq-dev worked great for me :)

@thegarbz
Copy link

@12345Josparky if you have a keyboard and a TV it may be easier to simply plug the Raspberry Pi into those, login on the console and then type those commands. If you've not used SSH before this may be easier.

Otherwise download putty.
Under Hostname / IP on the first window put in "octopi.local" and click Open
Default username: pi
Default password: raspberry.
Type: sudo apt update (when prompted give that default password again).
Type: sudo apt-get install libpq-dev
Type: exit.

And you should be all done. I can't remember if the default octopi image has ssh enabled though or if I took additional steps to make this work for me. But as said above the same stuff works by logging directly into the console, all you need is a keyboard and a hdmi cable.

@12345Josparky
Copy link

Thank you all for the detailed instructions. I do have one more question. May be a dumb one lol. I am assuming I need to download the update from here and have it somewhere so it can install it. I appreciate all you guys help. I do have putty installed on my pc just not familiar with it. I watched a video to get it all installed before.

@hgroover
Copy link
Author

Not a dumb question by any means. After doing the apt update / apt install (assuming it completes successfully) just go back to Octoprint / settings / updates and click on the update button for Filament Manager. This time it should succeed.

@12345Josparky
Copy link

12345Josparky commented Oct 12, 2020

The instructions worked and I am now update. So if I can ask one more question so I understand this a little more for future. What is this updating exactly? And thank you all for being so nice to help the ones that don't know that much about putty. I am always wanting to learn more.

@hgroover
Copy link
Author

There are a few layers to what you probably have:

  1. The computer you're running Octoprint on (most commonly, a Raspberry Pi 3 or 4)
  2. The operating system, usually a version of Raspbian (which is derived from Debian, like Ubuntu). If you downloaded and installed Octopi, it's a complete installation of Raspbian with Octoprint already installed plus the motion JPEG streaming components.
  3. The Octoprint application itself, which has
  4. Various plugins including this one.

The apt update you ran is part of the operating system support. apt is a package manager and allows you to add and update features of a Linux-based operating system distribution.

pip is kind of a package manager for Python libraries. Someone mentioned in an earlier comment that this problem is actually related to pip. Installing this missing library at the OS level works around this problem with pip, which in turn causes the update for this plugin to fail.

@12345Josparky
Copy link

Thanks hgroover

@thegarbz
Copy link

Yeah @12345Josparky to answer your question specifically on what this did:
In the release notes of FilamentManager you can see 1.6.2 "#7 added postgressql database driver to the plugin"

When the update runs you can see above the error message says
"Error: pg_config executable not found. pg_config is required to build psycopg2 from source." This is pip (Package Installer for Python) trying and failing to install the postgressql database driver library that this new version depends on. Rather than take the drastic method of updating pip (which according to a quick internet search would fix this, but a task best left to the octodash team), we instead are installing the package libpq-dev which provides the missing file from the operating system repository via Aptitude.

So what we did with the commands:
sudo - this tells Linux to run the following commands with elevated privileges. Aptitude only runs as root.
apt update - this tells apt to go back to the repository from Raspbian and get a list of all software available, its dependencies, and its current versions. You may have gotten a message after running this that 100 updates are available or something like that. We simply ignored that.
apt-get install libpq-dev - this should be self explanatory, it fetches and installs the libpq-dev library which includes the missing pg_config.

With the missing software installed, pip is able to download and install psycopg2 and then install this plugin.

@OllisGit
Copy link
Owner

Hi all,
I am really sorry, that you have problems to install the latest version which includes PostgreSQL-Driver.

I thought it is just an other dependency which I could add to the requirement section in the plugin.

Now, I removed the driver from the plugin (Version 1.6.3), If someone needs to use the external database, he/she can look into the wiki-page: https://github.com/OllisGit/OctoPrint-FilamentManager/wiki/Setup-PostgreSQL-on-Raspbian-(Stretch)

@thegarbz
Copy link

@OllisGit it should have been. Maybe something to do with python version being outdated. At least on the psycopg github page there are people saying an updated version of pip fixes the problem, and frankly it should since the whole point of the binary package is that it shouldn't need to be built. psycopg/psycopg2#699

@hgroover
Copy link
Author

@OllisGit I can confirm that the upgrade from 1.6.0 to 1.6.3 went smoothly on another Octopi installation (where I had not applied the apt workaround). Can we close this issue now? If you'd rather I do so please let me know... Thank you!

@stale
Copy link

stale bot commented Nov 12, 2020

This issue has been automatically marked for closing, because it has not had activity in 30 days. It will be closed if no further activity occurs in 10 days.

@stale stale bot added the status: markedForAutoClose Issue will be closed automatically label Nov 12, 2020
@stale stale bot closed this as completed Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: markedForAutoClose Issue will be closed automatically
Projects
None yet
Development

No branches or pull requests