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

Problem with building macOS app & metadata #17

Closed
CapnCocoa opened this issue Jun 8, 2022 · 22 comments
Closed

Problem with building macOS app & metadata #17

CapnCocoa opened this issue Jun 8, 2022 · 22 comments

Comments

@CapnCocoa
Copy link
Contributor

CapnCocoa commented Jun 8, 2022

Tried to build the macOS app using the June 7 development branch. Terminal had a problem on the "Preparing metadata" step as seen below:

Screenshot 2022-06-07 at 11 58 13 PM

I also tested this with the ver 1.2 main branch and got the same result.
I'm on an M1 MacBook Pro with macOS 12.3.1.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 8, 2022

From what it's saying, I'm guessing it's an issue with PyQt5. Try running python3 -m pip install PyQt5 and see if it gives the same error.
Assuming it does, you'll need to use a package manager like brew to install Qt@5 first. I've had this problem on macOS before. Being in a virtual environment and attempting to install PyQt5 also fails for me.
If this works, or you find any more information on what's causing this, please update me! I'm curious as to why this is.
Thank you.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 8, 2022

Oh, another thing to note is that this is likely only an issue with PyQt on M1 Macs. I have an M1 Mac Mini, and from what I've found, the difference in architecture can make various things break in certain places.

@CapnCocoa
Copy link
Contributor Author

You were right—I ran python3 -m pip install PyQt5 and got the exact same error. I went and installed Homebrew and qt@5, seemed to get the same result, both with trying to install NSO-RPC as well as running python3 -m pip install PyQt5.

I don't really have a clue on what's going on, but maybe it does have something to do with the Intel/M1 split after all. Your guess is as good as mine!

@CapnCocoa
Copy link
Contributor Author

Okay disregard that last comment, I was able to make some actual progress.

I was able to get PyQt5 installed by running Terminal in Rosetta 2, and then from there I was finally able to build the app. The new problem I have is that when I try to launch it, I immediately get this:
Screenshot 2022-06-08 at 8 09 17 PM

@MCMi460
Copy link
Owner

MCMi460 commented Jun 9, 2022

That might be an issue with the app itself. Are you building from the development branch, or the main branch?
Try using the development branch, and if that still doesn't work, make sure you can run app.py in your Rosetta 2 terminal normally.

@CapnCocoa
Copy link
Contributor Author

I built the app through the development branch, although interestingly I tried out the app through the main branch and it seemed to open and close right away without letting me log in. It looks like the app type is Intel rather than Universal, so maybe it's just an M1 quirk.

I typed app.py straight into both the default and Rosetta 2 Terminal, got a command not found error so that may be at play too.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 10, 2022

In order to run app.py, you will need to execute it using python3.
Try running python3 app.py. The command not found error is because you need to run Python as a command and app.py as an argument.
Also, the app type is not universal because you built it using Rosetta 2.

@CapnCocoa
Copy link
Contributor Author

Ah yeah, my bad—I know next to nothing about Python so thanks for putting up with me as I try to figure this out.

Trying to run app.py in the Rosetta 2 terminal results in this error:
Screenshot 2022-06-10 at 10 25 33 AM

And to clarify on the app type bit (not sure how important it is), it seems the version I built with the Rosetta 2 terminal off of the development branch is actually Universal, while the 1.2 macOS release I got from this page is an Intel app.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 10, 2022

Yes, that makes sense, I suppose.
I always build and release as Intel because it works on both the M1 and Intel Macs.
Try running this in the terminal (don't use the Rosetta terminal for this):

brew install qt@5
brew install pyqt@5
python3 -m pip install -r requirements.txt
python3 app.py

Tell me if it opens the app after installing PyQt5.

@CapnCocoa
Copy link
Contributor Author

Running all of it through non-Rosetta Terminal, I installed pyqt@5 and was informed that I had qt@5 and pip already (I wasn't on the newest version of pip, however, so I updated that as well). The last step of running the app produced the same error as my last comment, unfortunately.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 10, 2022

This is difficult.
Maybe brew installed the wrong architecture of the qt@5 package?
Try in normal terminal:

brew install --force qt@5
brew install --force pyqt@5
python3 app.py

If this doesn't work, then I probably can't help you with it. Maybe you could create a virtual environment, install PyQt5 via the Rosetta terminal, then run app.py.
This is in Rosetta terminal:

python3 -m venv venv
source ./venv/bin/activate
python -m pip install -r requirements.txt
python app.py

I'm sorry if neither of those work. I guess just scour the internet for an online forum with a fix for PyQt5?
Sorry again for the inconvenience.

@CapnCocoa
Copy link
Contributor Author

Interestingly both of those ideas led to a new error:
Screenshot 2022-06-10 at 6 54 08 PM

I'll look around and see if I can find anything. Do you think that this is a problem that might be rectified when you're able to release a prebuilt app version of the current development branch, or are we out of luck?

@MCMi460
Copy link
Owner

MCMi460 commented Jun 11, 2022

The problem is practically obsolete when building on an Intel Mac. The reason the current release fails is the same reason the main branch will always fail- Nintendo's servers have updated, meaning the moment the app connects, it crashes.
Also, to fix the error you just sent, try running python3 -m pip install requests and then python3 app.py to run the app.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 11, 2022

When I return from vacation, I'll rebuild the development branch and make a new release so people can start using the app again.
(As a side note, issue #13 still persists, meaning NSO-RPC now requires a secondary, partner account to maintain normal function)

@CapnCocoa
Copy link
Contributor Author

After running python3 -m pip install requests I had to install a few more things (qtwidgets and pypresence) but I did finally manage to get the app open! I linked it with an account that I friended with my main.
Screenshot 2022-06-10 at 10 30 45 PM

Strangely the friends list appears blank. Just to test it, I logged in with my main and all my friends are there, so I don't know what's going on. It's a completely separate issue from the one at the top of this thread, however, so that's progress!

@MCMi460
Copy link
Owner

MCMi460 commented Jun 11, 2022

Glad the app's finally running!
Since NSO-RPC basically emulates the Nintendo Switch Online mobile app, try logging in with your secondary account on that app (it's available on both the Play Store and the App Store).
I'm really not sure why this is since this isn't a problem for me on any of my accounts that I've tested on.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 11, 2022

This is an example of what my app shows when I log in. Check to make sure your main accounts appears on the friendlist.
image

@CapnCocoa
Copy link
Contributor Author

CapnCocoa commented Jun 11, 2022

IMG_4779
The main account did show up in the app fine, although I am still having trouble getting my main to show up in the friends list in NSO-RPC unfortunately.

On a separate note, though, I tested the application by selecting my friends' profiles through my main, and it seems to work great! I'll play around with trying to get my alt account's friend list working tomorrow, and will update you with how it goes.

@MCMi460
Copy link
Owner

MCMi460 commented Jun 11, 2022

You know what? There's a chance that the program skips over one-user rows. That might be an issue with my formatting- I'll have to check when I get home.
Until then, I think a good fix would be to add two or three more friends to your alt account and test it then.
Once again, I'm really sorry for the inconvenience.

@anthonybaldwin
Copy link
Contributor

anthonybaldwin commented Jun 12, 2022

I have this working correctly on my branch assuming the fix is valid. ☝️ @MCMi460 @CapnCocoa

(Sorry again for the dupe PRs. Probably could've just dropped the commit. 😬)

@CapnCocoa
Copy link
Contributor Author

Just checked out your branch, it seems to work perfectly!

Screenshot 2022-06-12 at 12 38 14 AM

Screenshot 2022-06-12 at 12 35 01 AM

Thank you both for all your help. Looking forward to finally getting to use NSO-RPC!

@MCMi460
Copy link
Owner

MCMi460 commented Jun 16, 2022

I'm glad it works now! And thank you again, @anthonybaldwin for the serious help!

Edit: As a side note, @anthonybaldwin's PR (#19) has been successfully merged with development and (now) main.
Thank you again!

@MCMi460 MCMi460 closed this as completed Jun 16, 2022
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

3 participants