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

Change dependencies for Python 3.10 support #446

Merged
merged 8 commits into from
Jun 14, 2022

Conversation

norabelrose
Copy link
Contributor

Currently, imitation does not work properly on Python 3.10 due to its reliance on the PyPI version of Sacred (0.8.2). In particular, if you try to run python -m imitation.scripts.train_rl, you'll get errors like this:

Exception originated from within Sacred.
Traceback (most recent calls):
  File "/opt/homebrew/Caskroom/miniforge/base/lib/python3.10/site-packages/sacred/utils.py", line 345, in recursive_update
    if isinstance(v, collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'

The Mapping type was removed from the collections library in Python 3.10. The GitHub version of Sacred was actually updated for Python 3.10 back in March (it's now on 0.8.3), but unfortunately the maintainer in charge of pushing new releases to PyPI seems to be MIA (see IDSIA/sacred#857), so it's not clear when the PyPI package will be updated. This PR fixes the issue by simply changing the Sacred dependency in setup.py to the GitHub version.

I also noticed that the tests currently require an out-of-date version of Ray Tune (~=0.8.5), but Ray just added support for Python 3.10 in its most recent release a few days ago (1.13.0). So I changed that dependency from ~=0.8.5 to >=0.8.5 to allow for downloading the most recent version for testing.

Copy link
Member

@AdamGleave AdamGleave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Couple of minor points about what versions we should specify but generally happy with the upgrade.

Note CI will still be running on 3.8 as Dockerfile not changed. But we probably want that so long as we want to maintain compatibility with 3.8, as Python is backwards compatible more likely to break on 3.8 and not 3.10 than vice-versa.

setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 13, 2022

Codecov Report

Merging #446 (2933864) into master (f332680) will decrease coverage by 0.39%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #446      +/-   ##
==========================================
- Coverage   96.96%   96.56%   -0.40%     
==========================================
  Files          79       79              
  Lines        6264     6263       -1     
==========================================
- Hits         6074     6048      -26     
- Misses        190      215      +25     
Impacted Files Coverage Δ
src/imitation/scripts/parallel.py 64.06% <0.00%> (-32.87%) ⬇️
src/imitation/scripts/config/train_adversarial.py 63.63% <0.00%> (-3.90%) ⬇️
src/imitation/scripts/train_adversarial.py 94.28% <0.00%> (-1.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f332680...2933864. Read the comment docs.

@AdamGleave
Copy link
Member

Fixes #399

setup.py Outdated Show resolved Hide resolved
Copy link
Member

@AdamGleave AdamGleave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AdamGleave AdamGleave merged commit 2db81fe into HumanCompatibleAI:master Jun 14, 2022
@norabelrose norabelrose mentioned this pull request Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants