AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
140.3k stars 26.55k forks source link

[Bug]: mpmath version versions > 1.3 don't have rational attribute #15103

Closed johnlawerance closed 4 months ago

johnlawerance commented 6 months ago

Checklist

What happened?

On Ubuntu 23.10 the version of mpmath pip installs to satisfy the sympy package is 1.4.0a0 which does not have the rational attribute. Short term fix could be to update pip requirements.

AttributeError: module 'mpmath' has no attribute 'rational'

Steps to reproduce the problem

  1. Use Ubuntu 23.10
  2. git clone current master branch (bef51aed032c0aaa5cfd80445bc4cf0d85b408b5)
  3. Create new venv
  4. Run ./webui.sh

What should have happened?

Version 1.3.0 of mpmath with rational should be installed instead.

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

{
    "Platform": "Linux-6.5.0-21-generic-x86_64-with-glibc2.38",
    "Python": "3.11.6",
    "Version": "v1.8.0",
    "Commit": "bef51aed032c0aaa5cfd80445bc4cf0d85b408b5",
    "Script path": "/home/jclark/Desktop/sd/stable-diffusion-webui",
    "Data path": "/home/jclark/Desktop/sd/stable-diffusion-webui",
    "Extensions dir": "/home/jclark/Desktop/sd/stable-diffusion-webui/extensions",
    "Checksum": "76838d936abcbfda303be8ee3a6242b0ad398099ef97ece46409706047ff524b",
    "Commandline": [
        "launch.py"
    ],
    "Torch env info": {
        "torch_version": "2.3.0",
        "is_debug_build": "False",
        "cuda_compiled_version": "N/A",
        "gcc_version": "(Ubuntu 13.2.0-4ubuntu3) 13.2.0",
        "clang_version": null,
        "cmake_version": null,
        "os": "Ubuntu 23.10 (x86_64)",
        "libc_version": "glibc-2.38",
        "python_version": "3.11.6 (main, Oct  8 2023, 05:06:43) [GCC 13.2.0] (64-bit runtime)",
        "python_platform": "Linux-6.5.0-21-generic-x86_64-with-glibc2.38",
        "is_cuda_available": "True",
        "cuda_runtime_version": null,
        "cuda_module_loading": "LAZY",
        "nvidia_driver_version": null,
        "nvidia_gpu_models": "AMD Radeon RX 7900 XTX (gfx1100)",
        "cudnn_version": null,
        "pip_version": "pip3",
        "pip_packages": [
            "numpy==1.26.2",
            "open-clip-torch==2.20.0",
            "pytorch-lightning==1.9.4",
            "pytorch-triton-rocm==3.0.0+0a22a91d04",
            "torch==2.3.0.dev20240301+rocm5.7",
            "torchdiffeq==0.2.3",
            "torchmetrics==1.3.1",
            "torchsde==0.2.6",
            "torchvision==0.18.0.dev20240301+rocm5.7"
        ],
        "conda_packages": null,
        "hip_compiled_version": "5.7.31921-d1770ee1b",
        "hip_runtime_version": "5.7.31921",
        "miopen_runtime_version": "2.20.0",
        "caching_allocator_config": "",
        "is_xnnpack_available": "True",
        "cpu_info": [
            "Architecture:                       x86_64",
            "CPU op-mode(s):                     32-bit, 64-bit",
            "Address sizes:                      43 bits physical, 48 bits virtual",
            "Byte Order:                         Little Endian",
            "CPU(s):                             8",
            "On-line CPU(s) list:                0-7",
            "Vendor ID:                          AuthenticAMD",
            "Model name:                         AMD Ryzen 3 3300X 4-Core Processor",
            "CPU family:                         23",
            "Model:                              113",
            "Thread(s) per core:                 2",
            "Core(s) per socket:                 4",
            "Socket(s):                          1",
            "Stepping:                           0",
            "Frequency boost:                    enabled",
            "CPU(s) scaling MHz:                 99%",
            "CPU max MHz:                        4349.2178",
            "CPU min MHz:                        2200.0000",
            "BogoMIPS:                           7586.29",
            "Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl umip rdpid overflow_recov succor smca sev sev_es",
            "Virtualization:                     AMD-V",
            "L1d cache:                          128 KiB (4 instances)",
            "L1i cache:                          128 KiB (4 instances)",
            "L2 cache:                           2 MiB (4 instances)",
            "L3 cache:                           16 MiB (1 instance)",
            "NUMA node(s):                       1",
            "NUMA node0 CPU(s):                  0-7",
            "Vulnerability Gather data sampling: Not affected",
            "Vulnerability Itlb multihit:        Not affected",
            "Vulnerability L1tf:                 Not affected",
            "Vulnerability Mds:                  Not affected",
            "Vulnerability Meltdown:             Not affected",
            "Vulnerability Mmio stale data:      Not affected",
            "Vulnerability Retbleed:             Mitigation; untrained return thunk; SMT enabled with STIBP protection",
            "Vulnerability Spec rstack overflow: Mitigation; safe RET",
            "Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl",
            "Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization",
            "Vulnerability Spectre v2:           Mitigation; Retpolines, IBPB conditional, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected",
            "Vulnerability Srbds:                Not affected",
            "Vulnerability Tsx async abort:      Not affected"
        ]
    },
    "Exceptions": [],
    "CPU": {
        "model": "x86_64",
        "count logical": 8,
        "count physical": 4
    },
    "RAM": {
        "total": "31GB",
        "used": "6GB",
        "free": "2GB",
        "active": "8GB",
        "inactive": "19GB",
        "buffers": "211MB",
        "cached": "23GB",
        "shared": "386MB"
    },
    "Extensions": [],
    "Inactive extensions": [],
    "Environment": {
        "GIT": "git",
        "GRADIO_ANALYTICS_ENABLED": "False",
        "TORCH_COMMAND": "pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/rocm5.7"
    },
    "Config": {
        "ldsr_steps": 100,
        "ldsr_cached": false,
        "SCUNET_tile": 256,
        "SCUNET_tile_overlap": 8,
        "SWIN_tile": 192,
        "SWIN_tile_overlap": 8,
        "SWIN_torch_compile": false,
        "hypertile_enable_unet": false,
        "hypertile_enable_unet_secondpass": false,
        "hypertile_max_depth_unet": 3,
        "hypertile_max_tile_unet": 256,
        "hypertile_swap_size_unet": 3,
        "hypertile_enable_vae": false,
        "hypertile_max_depth_vae": 3,
        "hypertile_max_tile_vae": 128,
        "hypertile_swap_size_vae": 3,
        "sd_model_checkpoint": "picxReal_10.safetensors [07919b495d]",
        "sd_checkpoint_hash": "07919b495df62d7b1b2c6f1715669e1b8f9ce92e496de3a688b30744daece525",
        "save_images_before_highres_fix": false
    },
    "Startup": {
        "total": 7.069541692733765,
        "records": {
            "initial startup": 0.0048677921295166016,
            "prepare environment/checks": 4.553794860839844e-05,
            "prepare environment/git version info": 0.003149747848510742,
            "prepare environment/torch GPU test": 1.6632449626922607,
            "prepare environment/clone repositores": 0.012382030487060547,
            "prepare environment/run extensions installers": 0.0003216266632080078,
            "prepare environment": 1.7039909362792969,
            "launcher": 0.0007789134979248047,
            "import torch": 2.6326711177825928,
            "import gradio": 0.6092870235443115,
            "setup paths": 0.7708301544189453,
            "import ldm": 0.0036973953247070312,
            "import sgm": 2.384185791015625e-06,
            "initialize shared": 0.03893542289733887,
            "other imports": 0.30447888374328613,
            "opts onchange": 0.0002989768981933594,
            "setup SD model": 4.029273986816406e-05,
            "setup codeformer": 0.000499725341796875,
            "setup gfpgan": 0.0033338069915771484,
            "set samplers": 2.0265579223632812e-05,
            "list extensions": 0.0006799697875976562,
            "restore config state file": 5.7220458984375e-06,
            "list SD models": 0.014080524444580078,
            "list localizations": 0.00011205673217773438,
            "load scripts/custom_code.py": 0.0009198188781738281,
            "load scripts/img2imgalt.py": 0.00034499168395996094,
            "load scripts/loopback.py": 0.00018739700317382812,
            "load scripts/outpainting_mk_2.py": 0.0003161430358886719,
            "load scripts/poor_mans_outpainting.py": 0.0002536773681640625,
            "load scripts/postprocessing_caption.py": 0.00013780593872070312,
            "load scripts/postprocessing_codeformer.py": 0.00024390220642089844,
            "load scripts/postprocessing_create_flipped_copies.py": 0.00013375282287597656,
            "load scripts/postprocessing_focal_crop.py": 0.0005295276641845703,
            "load scripts/postprocessing_gfpgan.py": 0.0002052783966064453,
            "load scripts/postprocessing_split_oversized.py": 0.0002231597900390625,
            "load scripts/postprocessing_upscale.py": 0.00029659271240234375,
            "load scripts/processing_autosized_crop.py": 0.00016117095947265625,
            "load scripts/prompt_matrix.py": 0.00026702880859375,
            "load scripts/prompts_from_file.py": 0.0002601146697998047,
            "load scripts/sd_upscale.py": 0.000164031982421875,
            "load scripts/xyz_grid.py": 0.0012857913970947266,
            "load scripts/ldsr_model.py": 0.0719749927520752,
            "load scripts/lora_script.py": 0.07114744186401367,
            "load scripts/scunet_model.py": 0.010814189910888672,
            "load scripts/swinir_model.py": 0.009949684143066406,
            "load scripts/hotkey_config.py": 0.0002505779266357422,
            "load scripts/extra_options_section.py": 0.00040602684020996094,
            "load scripts/hypertile_script.py": 0.021979093551635742,
            "load scripts/hypertile_xyz.py": 0.00014591217041015625,
            "load scripts/soft_inpainting.py": 0.0005700588226318359,
            "load scripts/comments.py": 0.009683370590209961,
            "load scripts/refiner.py": 0.0002148151397705078,
            "load scripts/seed.py": 0.0002677440643310547,
            "load scripts": 0.20335960388183594,
            "load upscalers": 0.0016696453094482422,
            "refresh VAE": 0.0006439685821533203,
            "refresh textual inversion templates": 3.170967102050781e-05,
            "scripts list_optimizers": 0.0002875328063964844,
            "scripts list_unets": 3.337860107421875e-06,
            "reload hypernetworks": 0.005193233489990234,
            "initialize extra networks": 0.0221099853515625,
            "scripts before_ui_callback": 0.004221439361572266,
            "create ui": 0.4455432891845703,
            "gradio launch": 0.30035924911499023,
            "add APIs": 0.022305727005004883,
            "app_started_callback/lora_script.py": 0.0002009868621826172,
            "app_started_callback": 0.000202178955078125
        }
    },
    "Packages": [
        "accelerate==0.21.0",
        "aenum==3.1.15",
        "aiofiles==23.2.1",
        "aiohttp==3.9.3",
        "aiosignal==1.3.1",
        "altair==5.2.0",
        "antlr4-python3-runtime==4.9.3",
        "anyio==3.7.1",
        "attrs==23.2.0",
        "blendmodes==2022",
        "certifi==2024.2.2",
        "charset-normalizer==3.3.2",
        "clean-fid==0.1.35",
        "click==8.1.7",
        "clip==1.0",
        "contourpy==1.2.0",
        "cycler==0.12.1",
        "deprecation==2.1.0",
        "einops==0.4.1",
        "facexlib==0.3.0",
        "fastapi==0.94.0",
        "ffmpy==0.3.2",
        "filelock==3.13.1",
        "filterpy==1.4.5",
        "fonttools==4.49.0",
        "frozenlist==1.4.1",
        "fsspec==2024.2.0",
        "ftfy==6.1.3",
        "gitdb==4.0.11",
        "gitpython==3.1.32",
        "gradio-client==0.5.0",
        "gradio==3.41.2",
        "h11==0.12.0",
        "httpcore==0.15.0",
        "httpx==0.24.1",
        "huggingface-hub==0.21.3",
        "idna==3.6",
        "imageio==2.34.0",
        "importlib-resources==6.1.2",
        "inflection==0.5.1",
        "jinja2==3.1.3",
        "jsonmerge==1.8.0",
        "jsonschema-specifications==2023.12.1",
        "jsonschema==4.21.1",
        "kiwisolver==1.4.5",
        "kornia==0.6.7",
        "lark==1.1.2",
        "lazy-loader==0.3",
        "lightning-utilities==0.10.1",
        "llvmlite==0.42.0",
        "markupsafe==2.1.3",
        "matplotlib==3.8.3",
        "mpmath==1.3.0",
        "multidict==6.0.5",
        "networkx==3.2.1",
        "numba==0.59.0",
        "numpy==1.26.2",
        "omegaconf==2.2.3",
        "open-clip-torch==2.20.0",
        "opencv-python==4.9.0.80",
        "orjson==3.9.15",
        "packaging==23.2",
        "pandas==2.2.1",
        "piexif==1.1.3",
        "pillow==9.5.0",
        "pip==23.2",
        "protobuf==3.20.0",
        "psutil==5.9.5",
        "pydantic==1.10.14",
        "pydub==0.25.1",
        "pyparsing==3.1.1",
        "python-dateutil==2.9.0.post0",
        "python-multipart==0.0.9",
        "pytorch-lightning==1.9.4",
        "pytorch-triton-rocm==3.0.0+0a22a91d04",
        "pytz==2024.1",
        "pywavelets==1.5.0",
        "pyyaml==6.0.1",
        "referencing==0.33.0",
        "regex==2023.12.25",
        "requests==2.31.0",
        "resize-right==0.0.2",
        "rpds-py==0.18.0",
        "safetensors==0.4.2",
        "scikit-image==0.21.0",
        "scipy==1.12.0",
        "semantic-version==2.10.0",
        "sentencepiece==0.2.0",
        "setuptools==68.1.2",
        "six==1.16.0",
        "smmap==5.0.1",
        "sniffio==1.3.1",
        "spandrel==0.1.6",
        "starlette==0.26.1",
        "sympy==1.12",
        "tifffile==2024.2.12",
        "timm==0.9.16",
        "tokenizers==0.13.3",
        "tomesd==0.1.3",
        "toolz==0.12.1",
        "torch==2.3.0.dev20240301+rocm5.7",
        "torchdiffeq==0.2.3",
        "torchmetrics==1.3.1",
        "torchsde==0.2.6",
        "torchvision==0.18.0.dev20240301+rocm5.7",
        "tqdm==4.66.2",
        "trampoline==0.1.2",
        "transformers==4.30.2",
        "typing-extensions==4.8.0",
        "tzdata==2024.1",
        "urllib3==2.2.1",
        "uvicorn==0.27.1",
        "wcwidth==0.2.13",
        "websockets==11.0.3",
        "yarl==1.9.4"
    ]
}

Console logs

(venv) jclark@jclark-desktop:~/Desktop/sd/stable-diffusion-webui$ ./webui.sh 

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye), Fedora 34+ and openSUSE Leap 15.4 or newer.
################################################################

################################################################
Running on jclark user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
python venv already activate or run without venv: /home/jclark/Desktop/sd/stable-diffusion-webui/venv
################################################################

################################################################
Launching launch.py...
################################################################
glibc version is 2.38
Cannot locate TCMalloc. Do you have tcmalloc or google-perftool installed on your system? (improves CPU memory usage)
Python 3.11.6 (main, Oct  8 2023, 05:06:43) [GCC 13.2.0]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
Installing torch and torchvision
Looking in indexes: https://download.pytorch.org/whl/nightly/rocm5.7
Collecting torch
  Downloading https://download.pytorch.org/whl/nightly/rocm5.7/torch-2.3.0.dev20240303%2Brocm5.7-cp311-cp311-linux_x86_64.whl (1844.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 GB 2.8 MB/s eta 0:00:00
Collecting torchvision
  Downloading https://download.pytorch.org/whl/nightly/rocm5.7/torchvision-0.18.0.dev20240301%2Brocm5.7-cp311-cp311-linux_x86_64.whl (65.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.6/65.6 MB 16.0 MB/s eta 0:00:00
Collecting filelock (from torch)
  Downloading https://download.pytorch.org/whl/nightly/filelock-3.13.1-py3-none-any.whl (11 kB)
Collecting typing-extensions>=4.8.0 (from torch)
  Downloading https://download.pytorch.org/whl/nightly/typing_extensions-4.8.0-py3-none-any.whl (31 kB)
Collecting sympy (from torch)
  Downloading https://download.pytorch.org/whl/nightly/sympy-1.12-py3-none-any.whl (5.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 10.8 MB/s eta 0:00:00
Collecting networkx (from torch)
  Downloading https://download.pytorch.org/whl/nightly/networkx-3.2.1-py3-none-any.whl (1.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 17.7 MB/s eta 0:00:00
Collecting jinja2 (from torch)
  Downloading https://download.pytorch.org/whl/nightly/Jinja2-3.1.3-py3-none-any.whl (133 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.2/133.2 kB 9.2 MB/s eta 0:00:00
Collecting fsspec (from torch)
  Downloading https://download.pytorch.org/whl/nightly/fsspec-2024.2.0-py3-none-any.whl (170 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 170.9/170.9 kB 12.4 MB/s eta 0:00:00
Collecting pytorch-triton-rocm==3.0.0+0a22a91d04 (from torch)
  Downloading https://download.pytorch.org/whl/nightly/pytorch_triton_rocm-3.0.0%2B0a22a91d04-cp311-cp311-linux_x86_64.whl (234.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 234.3/234.3 MB 11.5 MB/s eta 0:00:00
Collecting numpy (from torchvision)
  Downloading https://download.pytorch.org/whl/nightly/numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.3/18.3 MB 18.3 MB/s eta 0:00:00
Collecting torch
  Downloading https://download.pytorch.org/whl/nightly/rocm5.7/torch-2.3.0.dev20240301%2Brocm5.7-cp311-cp311-linux_x86_64.whl (1844.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 GB 2.6 MB/s eta 0:00:00
Collecting pillow!=8.3.*,>=5.3.0 (from torchvision)
  Downloading https://download.pytorch.org/whl/nightly/Pillow-9.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 21.4 MB/s eta 0:00:00
Collecting MarkupSafe>=2.0 (from jinja2->torch)
  Downloading https://download.pytorch.org/whl/nightly/MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (28 kB)
Collecting mpmath>=0.19 (from sympy->torch)
  Downloading https://download.pytorch.org/whl/nightly/mpmath-1.4.0a0-py3-none-any.whl (537 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 537.3/537.3 kB 22.7 MB/s eta 0:00:00
Installing collected packages: typing-extensions, pillow, numpy, networkx, mpmath, MarkupSafe, fsspec, filelock, sympy, pytorch-triton-rocm, jinja2, torch, torchvision
Successfully installed MarkupSafe-2.1.3 filelock-3.13.1 fsspec-2024.2.0 jinja2-3.1.3 mpmath-1.4.0a0 networkx-3.2.1 numpy-1.26.4 pillow-9.3.0 pytorch-triton-rocm-3.0.0+0a22a91d04 sympy-1.12 torch-2.3.0.dev20240301+rocm5.7 torchvision-0.18.0.dev20240301+rocm5.7 typing-extensions-4.8.0
Installing clip
Installing open_clip
Installing requirements
Launching Web UI with arguments: 
Traceback (most recent call last):
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/modules/launch_utils.py", line 465, in start
    import webui
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/modules/initialize.py", line 17, in imports
    import pytorch_lightning  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/__init__.py", line 35, in <module>
    from pytorch_lightning.callbacks import Callback  # noqa: E402
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/callbacks/__init__.py", line 28, in <module>
    from pytorch_lightning.callbacks.pruning import ModelPruning
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/callbacks/pruning.py", line 31, in <module>
    from pytorch_lightning.core.module import LightningModule
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/core/__init__.py", line 16, in <module>
    from pytorch_lightning.core.module import LightningModule
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/core/module.py", line 48, in <module>
    from pytorch_lightning.trainer.connectors.logger_connector.fx_validator import _FxValidator
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/trainer/__init__.py", line 17, in <module>
    from pytorch_lightning.trainer.trainer import Trainer
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/trainer/trainer.py", line 58, in <module>
    from pytorch_lightning.loops import PredictionLoop, TrainingEpochLoop
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/loops/__init__.py", line 15, in <module>
    from pytorch_lightning.loops.batch import TrainingBatchLoop  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/loops/batch/__init__.py", line 15, in <module>
    from pytorch_lightning.loops.batch.training_batch_loop import TrainingBatchLoop  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/loops/batch/training_batch_loop.py", line 20, in <module>
    from pytorch_lightning.loops.optimization.manual_loop import _OUTPUTS_TYPE as _MANUAL_LOOP_OUTPUTS_TYPE
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/loops/optimization/__init__.py", line 15, in <module>
    from pytorch_lightning.loops.optimization.manual_loop import ManualOptimization  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/loops/optimization/manual_loop.py", line 23, in <module>
    from pytorch_lightning.loops.utilities import _build_training_step_kwargs, _extract_hiddens
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/loops/utilities.py", line 29, in <module>
    from pytorch_lightning.strategies.parallel import ParallelStrategy
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/strategies/__init__.py", line 15, in <module>
    from pytorch_lightning.strategies.bagua import BaguaStrategy  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/strategies/bagua.py", line 29, in <module>
    from pytorch_lightning.plugins.precision import PrecisionPlugin
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/plugins/__init__.py", line 7, in <module>
    from pytorch_lightning.plugins.precision.apex_amp import ApexMixedPrecisionPlugin
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/plugins/precision/__init__.py", line 18, in <module>
    from pytorch_lightning.plugins.precision.fsdp_native_native_amp import FullyShardedNativeNativeMixedPrecisionPlugin
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/pytorch_lightning/plugins/precision/fsdp_native_native_amp.py", line 24, in <module>
    from torch.distributed.fsdp.fully_sharded_data_parallel import MixedPrecision
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/fsdp/__init__.py", line 1, in <module>
    from ._flat_param import FlatParameter as FlatParameter
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/fsdp/_flat_param.py", line 30, in <module>
    from torch.distributed.fsdp._common_utils import (
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/fsdp/_common_utils.py", line 31, in <module>
    from torch.distributed._tensor.device_mesh import DeviceMesh
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/_tensor/__init__.py", line 6, in <module>
    import torch.distributed._tensor.ops
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/_tensor/ops/__init__.py", line 2, in <module>
    from .embedding_ops import *  # noqa: F403
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/_tensor/ops/embedding_ops.py", line 8, in <module>
    import torch.distributed._functional_collectives as funcol
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/_functional_collectives.py", line 12, in <module>
    from . import _functional_collectives_impl as fun_col_impl
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/distributed/_functional_collectives_impl.py", line 36, in <module>
    from torch._dynamo import assume_constant_result
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/_dynamo/__init__.py", line 2, in <module>
    from . import convert_frame, eval_frame, resume_execution
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/_dynamo/convert_frame.py", line 31, in <module>
    from torch.fx.experimental.symbolic_shapes import (
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/fx/experimental/symbolic_shapes.py", line 63, in <module>
    from torch.utils._sympy.functions import FloorDiv, Mod, IsNonOverlappingAndDenseIndicator
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/torch/utils/_sympy/functions.py", line 1, in <module>
    import sympy
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/sympy/__init__.py", line 30, in <module>
    from sympy.core.cache import lazy_function
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/sympy/core/__init__.py", line 9, in <module>
    from .expr import Expr, AtomicExpr, UnevaluatedExpr
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/sympy/core/expr.py", line 4159, in <module>
    from .mul import Mul
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/sympy/core/mul.py", line 2193, in <module>
    from .numbers import Rational
  File "/home/jclark/Desktop/sd/stable-diffusion-webui/venv/lib/python3.11/site-packages/sympy/core/numbers.py", line 4567, in <module>
    _sympy_converter[type(mpmath.rational.mpq(1, 2))] = sympify_mpmath_mpq
                          ^^^^^^^^^^^^^^^
AttributeError: module 'mpmath' has no attribute 'rational'

Additional information

Manually installing mpmath-1.3.0 fixes the problem. -- I'm happy to PR whatever is deemed an appropriate solution (update requirements to cap mpmath below 1.4.0, update sympy version to do the same, etc.)

josfaber commented 6 months ago

I have exactly this error from a fresh clone (macbook air M1, 16Gb, macOS 14.4) and using the optimizations as mentioned here. I don't understand what to do with the info on the 'Fixes sympy...' link above?

johnlawerance commented 6 months ago

@josfaber

In the meantime manually installing mpmath-1.3.0 in your venv fixes the problem.

johnlawerance commented 4 months ago

Is fixed by https://github.com/pytorch/rl/pull/1988