ImportError: Could not resolve module sqlalchemy.ext.baked

47 views
Skip to first unread message

Raoul Snyman

unread,
Apr 13, 2019, 1:44:58 AM4/13/19
to PyInstaller
Hi everyone,

We've been using PyInstaller for a number of years now to build Windows and macOS versions of our software, but in our last few builds we've been getting the following error when attempting to read or write to the database using SQLAlchemy::

Traceback (most recent call last):
File "openlp\plugins\songs\lib\mediaitem.py", line 500, in on_edit_click File "openlp\plugins\songs\forms\editsongform.py", line 534, in load_song File "site-packages\sqlalchemy\orm\attributes.py", line 276, in __get__ File "site-packages\sqlalchemy\orm\attributes.py", line 682, in get File "site-packages\sqlalchemy\orm\strategies.py", line 723, in _load_for_state File "<string>", line 1, in <lambda> File "site-packages\sqlalchemy\orm\strategies.py", line 772, in _emit_lazyload File "site-packages\sqlalchemy\util\langhelpers.py", line 929, in __getattr__ File "<string>", line 1, in <lambda> File "site-packages\sqlalchemy\orm\strategies.py", line 743, in _memoized_attr__bakery File "site-packages\sqlalchemy\util\langhelpers.py", line 1074, in __getattr__ File "site-packages\sqlalchemy\util\langhelpers.py", line 1071, in __getattr__ ImportError: Could not resolve module sqlalchemy.ext.baked

I've tried a few things, including adding an extra hook for SQLAlchemy to see if it was a hidden import that wasn't being included, but that didn't seem to help.

We're running PyInstaller in onedir mode, the build completes without an errors, though we do get two warnings:

24547 INFO: Found 4 sqlalchemy hidden imports
24548 WARNING: Hidden import "MySQLdb" not found!
24549 WARNING: Hidden import "sqlalchemy.sql.functions.func" not found!

Has anyone else run into this problem?

Philip Kloc

unread,
Jun 1, 2019, 6:32:50 AM6/1/19
to PyInstaller
OK, I had this issue and just resolved it by adding sqlalchemy.ext.baked in hidden imports section of the .spec file like so,

hiddenimports=['sqlalchemy.ext.baked'],

Hope it helps

Philip Kloc

unread,
Jun 1, 2019, 6:33:10 AM6/1/19
to PyInstaller
Hi, I too am having this problem. I've tried all kinds of things but nothing works. I hope I don't have to resort to using pysqlite for DB operations as I like using SQLAlchemy, but frankly this is a show stopper for my project at the moment.


On Friday, April 12, 2019 at 11:44:58 PM UTC-6, Raoul Snyman wrote:

Raoul Snyman

unread,
Jun 4, 2019, 1:51:05 AM6/4/19
to PyInstaller
I thought I had added that hidden import as well, but perhaps not.
I'll try that again.
> --
> You received this message because you are subscribed to the Google Groups "PyInstaller" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
> To post to this group, send email to pyins...@googlegroups.com.
> Visit this group at https://groups.google.com/group/pyinstaller.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/d12a3e53-75b7-431b-a3bd-31efad133bb7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Raoul Snyman
B.Tech Information Technology (Software Engineering)
E-Mail: raoul....@gmail.com
Web: http://www.saturnlaboratories.co.za/
Blog: http://blog.saturnlaboratories.co.za/
Mobile: 082 550 3754
Registered Linux User #333298 (http://counter.li.org)
Reply all
Reply to author
Forward
0 new messages