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

build: better communicate lack of support for Python 3.11 #370

Merged
merged 1 commit into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ autoformat: ## Run the autoformatter.
@# ERA,T201
@-ruff --extend-ignore ANN,ARG001,C90,DTZ,D100,D101,D102,D103,D202,D203,D212,D415,E501,RET504,S101,UP006,UP007 --extend-select C,D400,I,W --unfixable T,ERA --fix-only .
@black .
@isort --atomic --profile black .
@isort --atomic --profile black --skip downloads/** .

test: ## Run the tests.
@pytest
Expand Down
11 changes: 11 additions & 0 deletions imaginairy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
# tells pytorch to allow MPS usage (for Mac M1 compatibility)
os.putenv("PYTORCH_ENABLE_MPS_FALLBACK", "1")

import sys # noqa

from .api import imagine, imagine_image_files # noqa
from .schema import ( # noqa
ImaginePrompt,
ImagineResult,
LazyLoadingImage,
WeightedPrompt,
)

# if python version is 3.11 or higher, throw an exception
if sys.version_info >= (3, 11):
msg = (
"Imaginairy is not compatible with Python 3.11 or higher. Please use Python 3.8 - 3.10.\n"
"This is due to torch 1.13 not supporting Python 3.11 and this library not having yet switched "
"to torch 2.0"
)
raise RuntimeError(msg)
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def get_git_revision_hash() -> str:
"uvicorn>=0.16.0",
"xformers>=0.0.16; sys_platform!='darwin' and platform_machine!='aarch64'",
],
# torchvision doesn't support python 3.11 unless we switch to torch 2.0
python_requires=">=3.8,<3.11",
# don't specify maximum python versions as it can cause very long dependency resolution issues as the resolver
# goes back to older versions of packages that didn't specify a maximum
# https://discuss.python.org/t/requires-python-upper-limits/12663/75
# https://github.com/brycedrennan/imaginAIry/pull/341#issuecomment-1574723908
python_requires=">=3.8",
)
Loading