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

bug(macos/brew): import error on fresh homebrew install #98

Closed
sweetkane opened this issue Mar 13, 2024 · 11 comments
Closed

bug(macos/brew): import error on fresh homebrew install #98

sweetkane opened this issue Mar 13, 2024 · 11 comments
Assignees
Labels
bug Something isn't working priority:high High priority issues

Comments

@sweetkane
Copy link

Homebrew 4.2.12

$ brew install yurijmikhalevich/tap/rclip
$ rclip "cat"
---
Traceback (most recent call last):
  File "/opt/homebrew/bin/rclip", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/rclip/1.7.25/libexec/lib/python3.11/site-packages/rclip/main.py", line 205, in main
    arg_parser = helpers.init_arg_parser()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/rclip/1.7.25/libexec/lib/python3.11/site-packages/rclip/utils/helpers.py", line 144, in init_arg_parser
    if is_mps_available():
       ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/rclip/1.7.25/libexec/lib/python3.11/site-packages/rclip/utils/helpers.py", line 153, in is_mps_available
    import torch.backends.mps
ModuleNotFoundError: No module named 'torch'
@sandronm
Copy link

sandronm commented Apr 8, 2024

Same here :/

(Homebrew 4.2.17, MacOS Sonoma 14.4.1 on M1 Max)

@yurijmikhalevich yurijmikhalevich added the bug Something isn't working label Apr 8, 2024
@yurijmikhalevich yurijmikhalevich self-assigned this Apr 8, 2024
@yurijmikhalevich yurijmikhalevich added the priority:high High priority issues label Apr 8, 2024
@yurijmikhalevich
Copy link
Owner

@sweetkane, thank you for the report. Fixing.

@yurijmikhalevich
Copy link
Owner

yurijmikhalevich commented Apr 9, 2024

@sweetkane, @sandronm, @xvvvyz, @came, @Alkapims, the issue should be fixed after you upgrade rclip installed with brew to the latest version: brew update && brew upgrade

Let me know if you still have it.

@sandronm
Copy link

sandronm commented Apr 9, 2024 via email

@timersys
Copy link

Not for me. I installed rclip and I get:
Traceback (most recent call last):
File "/opt/homebrew/bin/rclip", line 5, in
from rclip.main import main
File "/opt/homebrew/Cellar/rclip/1.10.3/libexec/lib/python3.12/site-packages/rclip/main.py", line 13, in
from rclip import db, fs, model
File "/opt/homebrew/Cellar/rclip/1.10.3/libexec/lib/python3.12/site-packages/rclip/model.py", line 10, in
import open_clip
File "/opt/homebrew/Cellar/rclip/1.10.3/libexec/lib/python3.12/site-packages/open_clip/init.py", line 3, in
from .coca_model import CoCa
File "/opt/homebrew/Cellar/rclip/1.10.3/libexec/lib/python3.12/site-packages/open_clip/coca_model.py", line 3, in
import torch
ModuleNotFoundError: No module named 'torch'
Then I did brew update && brew upgrade but I still get the same error

@yurijmikhalevich
Copy link
Owner

yurijmikhalevich commented Nov 29, 2024

@timersys, thank you for flagging! I see what's up. Homebrew updated their torch to a version that uses Python 3.13, and rclip expects 3.12. Will fix.

We will need a way to keep these in sync for homebrew version.

@yurijmikhalevich yurijmikhalevich changed the title Import error on fresh homebrew install bug: import error on fresh homebrew install Nov 29, 2024
@yurijmikhalevich yurijmikhalevich changed the title bug: import error on fresh homebrew install bug(macos/brew): import error on fresh homebrew install Nov 29, 2024
@timersys
Copy link

@yurijmikhalevich any news on this? Is there no a way to lock the version such as composer dependencies does? so you can lock the torch version needed.

@yurijmikhalevich
Copy link
Owner

yurijmikhalevich commented Dec 14, 2024

@timersys, we can lock rclip's Python version in brew, but we can't lock torchs Python version in brew – they made it depend on the latest Python. If there is a disconnect between the two rclip fails.

I am updating rclip Python dep to fix this short term and will think of a long term solution. Maybe, we can have a forked torch formula with a fixed version for rclip tap.

As a workaround, you can install rclip with pip install rclip

@yurijmikhalevich
Copy link
Owner

yurijmikhalevich commented Dec 18, 2024

@timersys, a fixed version of rclip was released to brew. Can you do brew update && brew upgrade and let me know if it fixes this for you?

Sorry about the bad experience, and thank you for flagging this! 🙌

To prevent this from happening again, I have moved "brewed" rclip to its own versions of pytorch and torchvision.

To further harden the brewed rclip (and other rclip distributions), I'll do the following:

@timersys
Copy link

@yurijmikhalevich Excellent job. It sworking and also the pip version.

@yurijmikhalevich
Copy link
Owner

@timersys, thank you for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:high High priority issues
Projects
None yet
Development

No branches or pull requests

4 participants