Hunyuan3D-1.0 / setup_local_diffusers.py
gokaygokay's picture
diffusers
ad540bf
raw
history blame
1.38 kB
import os
import sys
import subprocess
def setup_local_diffusers():
# 1. Try to uninstall existing diffusers package
try:
subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "diffusers", "-y"])
print("Successfully uninstalled existing diffusers package")
except subprocess.CalledProcessError:
print("No existing diffusers package found to uninstall")
# 2. Get the current directory and add it to PYTHONPATH
current_dir = os.path.dirname(os.path.abspath(__file__))
# Add the parent directory of diffusers to Python path
if current_dir not in sys.path:
sys.path.insert(0, current_dir)
print(f"Added {current_dir} to PYTHONPATH")
# 3. Verify the import works
try:
import diffusers
print(f"Successfully imported diffusers from: {diffusers.__file__}")
# Verify specific module exists
from diffusers.loaders.single_file import FromOriginalModelMixin
print("Successfully imported FromOriginalModelMixin")
return True
except ImportError as e:
print(f"Failed to import diffusers: {e}")
return False
if __name__ == "__main__":
success = setup_local_diffusers()
if success:
print("Local diffusers setup completed successfully")
else:
print("Failed to setup local diffusers")