Filament Manager can't connect to postgresql db after Python 3 update

After the upgrade of my two Octoprint instances I can no longer use the shared postgresql database. Neither instance of Octoprint can connect to the external database. The log shows the statement "tornado.access - WARNING - 400 POST /plugin/filamentmanager/database/test (::ffff: 35.89ms"

I unistalled filament manager, reinstalled it, checked the config files and made sue psycopg2 was installed per the plugin page.

octoprint-10-02.log (178.3 KB)

Any suggestions?

1 Like

It looks like it's trying to resolve an IPv6 IP address of your postgres SQL server for some reason rather than IPv4.

Is this how you are entering the database connection?

Looking through the log I think you just didn't install the psycopg2 the right way using the virtualenv command. Make sure you installed it using the command ~/oprint/bin/pip install psycopg2.

2020-10-03 03:43:52,386 - octoprint.plugins.filamentmanager - ERROR - Failed to initialize database: No module named 'psycopg2'

I tried that and it successfully installed, but no change. I am beginning to think it is a fundamental issue with postgresql. When I uninstalled FM and reinstalled I had it clean up the data from FM. That lost the filament database. I now can't create new spool profiles and add filament to the system. I get this error:


This is the last few lines in the log:

2020-10-03 18:49:49,763 - octoprint.plugins.pluginmanager - INFO - Loaded notice data from disk, was still valid
2020-10-03 18:49:50,235 - octoprint.plugins.softwareupdate - INFO - Saved version cache to disk
2020-10-03 18:49:50,306 - octoprint.plugins.filamentmanager - ERROR - Failed to fetch profiles lastmodified timestamp: 'NoneType' object has no attribute 'get_profiles_lastmodified'
2020-10-03 18:49:50,307 - octoprint.plugins.filamentmanager - ERROR - Failed to fetch profiles: 'NoneType' object has no attribute 'get_all_profiles'
2020-10-03 18:49:50,318 - tornado.access - ERROR - 500 GET /plugin/filamentmanager/profiles (::ffff: 18.88ms
2020-10-03 18:50:37,553 - octoprint.plugins.filamentmanager - ERROR - Failed to create profile: 'NoneType' object has no attribute 'create_profile'
2020-10-03 18:50:37,563 - tornado.access - ERROR - 500 POST /plugin/filamentmanager/profiles (::ffff: 20.77ms
2020-10-03 18:50:48,981 - tornado.access - WARNING - 400 POST /plugin/filamentmanager/database/test (::ffff: 18.67ms
2020-10-03 18:51:08,272 - octoprint.plugins.filamentmanager - ERROR - Failed to create profile: 'NoneType' object has no attribute 'create_profile'
2020-10-03 18:51:08,282 - tornado.access - ERROR - 500 POST /plugin/filamentmanager/profiles (::ffff: 20.35ms

I think I'm gonna bust out a new SD card and do a complete new octoprint image from scratch, reinstall postgresql, etc, and see what happens.

1 Like

Yes it is. Remember, the external database was working for months until I updated to Python 3 Octoprint. As a looong time network admin I'm always suspicious of major updates. :slight_smile:

Typically when I've seen errors like this it is because of corrupted plugin settings. Check your config.yaml for any settings in the filamentmanager section that are set to null. If there are, clearing the plugin's settings on uninstall and installing fresh may resolve the issue. But at this point, it seems like you may need to open an issue on the plugin's repo.

Where would I find this fill, config.yaml?

I created a new server on a spare PI, and the problem persists. I know the postgresql databases are working as I can use pgAdmin on my PC, and open and see the databases on the PI running postgresql, so it has to be the plugin, but the plugin developer is non responsive.

1 Like

@OllisGit, the new plugin maintainer, is typically responsive so you may just have to be patient until he has the ability to respond.


I just posted this to OllisGit:

I spun up a clean instant of Octoprint and installed postgresql on it after updating everything on the instance except updating to Python3. It's running Python2.7. I'm running that as a standalone Octprint instance not attached to a printer, hosting the external filament database only.

I'm running two Octoprint instances, one attached to a Qidi X-One2 and a second attached to an Ender 3 Pro. The Qidi octoprint has not been updated to Python3. It immediately attached to the new external database.

The Ender 3 Pro octoprint was upgraded to Python3, and was the original external database server. It would not attached to the new external database server, and the non Python3 octoprint could not attach to it.

I spun up another new instant of octoprint for the Ender 3 Pro. I updated everything on it except updating to Phython3. It's running Python2.7. It immediately connected to the new external database server.

To summarize what I figured out is a client running Phython3 will not connect to an external database server period. If the database server is running Python3, no clients can connect to it regardless of what version of Python they are running.

For a connection to an external database server to work neither the client or server can be running Python3.

The issue may be in the configuration of Filament Manager under Python3, but if so, I'm not smart enough to figure out what the issue is.



1 Like

Hi @mpd352,
I could not reproduce the issue.
Let's continue analysing the error in this issue:

1 Like

Run this as the pi user from the pi home folder. Do not SUDO.

oprint/bin/pip install psycopg2

to install psycopg2 into the octoprint virtual environment.

You may also have to install libpq by running

sudo apt install libpq