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

Can't pickle class sqlalchemy.orm.session.Session on Windows #165

Open
jack89roberts opened this issue Feb 2, 2020 · 2 comments
Open

Can't pickle class sqlalchemy.orm.session.Session on Windows #165

jack89roberts opened this issue Feb 2, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@jack89roberts
Copy link
Contributor

jack89roberts commented Feb 2, 2020

Get the error below on Windows when trying to run run_airsenal_predictions. Seems related to multiprocessing trying and failing to pickle SQLAlchemy objects.

  File "C:\tools\miniconda3\envs\airsenalenv\Scripts\run_airsenal_predictions-script.py", line 11, in <module>
  File "<string>", line 1, in <module>
    load_entry_point('airsenal', 'console_scripts', 'run_airsenal_predictions')()
  File "c:\users\jackr\github\airsenal\airsenal\scripts\fill_predictedscore_table.py", line 156, in main
  File "C:\tools\miniconda3\envs\airsenalenv\lib\multiprocessing\spawn.py", line 105, in spawn_main
    num_thread=args.num_thread)
  File "c:\users\jackr\github\airsenal\airsenal\scripts\fill_predictedscore_table.py", line 109, in make_predictedscore_table
    exitcode = _main(fd)
  File "C:\tools\miniconda3\envs\airsenalenv\lib\multiprocessing\spawn.py", line 115, in _main
    calc_all_predicted_points(gw_range, season, tag,  session)
      File "c:\users\jackr\github\airsenal\airsenal\scripts\fill_predictedscore_table.py", line 91, in calc_all_predicted_points
self = reduction.pickle.load(from_parent)
EOFErrorprocessor.start():
  File "C:\tools\miniconda3\envs\airsenalenv\lib\multiprocessing\process.py", line 112, in start
Ran out of input
    self._popen = self._Popen(self)
  File "C:\tools\miniconda3\envs\airsenalenv\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\tools\miniconda3\envs\airsenalenv\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\tools\miniconda3\envs\airsenalenv\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\tools\miniconda3\envs\airsenalenv\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: Can't pickle <class 'sqlalchemy.orm.session.Session'>: it's not the same object as sqlalchemy.orm.session.Session
@jack89roberts jack89roberts added the bug Something isn't working label Feb 2, 2020
@jack89roberts jack89roberts changed the title Multiprocessing pickle error on Windows: Can't pickle class sqlalchemy.orm.session.Session run_airsenal_predictions on Windows: Can't pickle class sqlalchemy.orm.session.Session Feb 2, 2020
@jack89roberts
Copy link
Contributor Author

Short-term workaround might be to make sure we don't use anything from multiprocessing if num_thread = 1, and only support single-threaded on Windows.

@jack89roberts
Copy link
Contributor Author

jack89roberts commented Feb 9, 2020

The discussion here (plus linked issues) might be relevant: pymeasure/pymeasure#12

@jack89roberts jack89roberts changed the title run_airsenal_predictions on Windows: Can't pickle class sqlalchemy.orm.session.Session Can't pickle class sqlalchemy.orm.session.Session on Windows Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant