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

Give ModuleNotFoundError for few packages #153

Open
YukiRed opened this issue Jul 18, 2024 · 1 comment
Open

Give ModuleNotFoundError for few packages #153

YukiRed opened this issue Jul 18, 2024 · 1 comment

Comments

@YukiRed
Copy link

YukiRed commented Jul 18, 2024

Package like the following is not install

  • diffusers
  • ultralytics
  • segment_anything

Turns out it is because launch is not available and unable to pip install launch.
Have to change to using subprocess

import subprocess

required_packages = {
    "accelerate": "accelerate",
    "diffusers": "diffusers",
    "huggingface_hub": "huggingface-hub",
    "numpy": "numpy",
    "cv2": "opencv-python",
    "PIL": "Pillow",
    "segment_anything": "segment-anything",
    "transformers": "transformers",
    "ultralytics": "ultralytics",
    "tqdm": "tqdm",
    "packaging": "packaging",
    "loguru": "loguru",
    "rich": "rich",
    "pydantic": "pydantic",
    "timm": "timm",
}

for package in required_packages:
    try:
        __import__(package)
        print(f"{package} is already installed.")
    except ImportError:
        try:
            subprocess.run(["pip", "install", required_packages[package]], check=True)
            print(f"Successfully installed {required_packages[package]}.")
        except subprocess.CalledProcessError:
            print(f"Can't install {required_packages[package]}. Please follow the readme to install manually.")
@Uminosachi
Copy link
Owner

Although I couldn't reproduce the issue, I have modified the install.py file to allow installation even when the launch package is not found. Please update and try again.

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

No branches or pull requests

2 participants