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

Can't run with python #7

Open
SonGokussj4 opened this issue Mar 5, 2024 · 11 comments
Open

Can't run with python #7

SonGokussj4 opened this issue Mar 5, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@SonGokussj4
Copy link

Created .venv with python3.11
Tried to install requirements.txt

ERROR: Cannot install PyQt6_sip==13.5.2 and PyQt6_sip==13.6.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested PyQt6_sip==13.5.2
    The user requested PyQt6_sip==13.6.0

Removed ==<version> from requirements.txt
Installed requirements.txt
Run the script

(.venv) (username@kuroneko) - (~\GIT\Youtility\youtility) $ python -m .\main.py
C:\Users\username\GIT\Youtility\.venv\Scripts\python.exe: Relative module names not supported

(.venv) (username@kuroneko) - (~\GIT\Youtility\youtility) $ python -m main

📢 Tips: QFluentWidgets Pro is now released. Click https://qfluentwidgets.com/pages/pro to learn more about it.

QWidget: Must construct a QApplication before a QWidget

Issue 1: python -m main.py in docu won't run the app.
Issue 2: requirements.txt conflicts
Issue 3: can't run, not sure why

@douglaskdonaldson
Copy link

Same result with pyenv virtualenv using 3.10.9:

(Youtility) doug@Dougs-MacBook-Pro-2 Youtility % python -m pip install -r requirements.txt
Collecting PyQt6==6.6.1 (from -r requirements.txt (line 1))
  Downloading PyQt6-6.6.1-cp38-abi3-macosx_10_14_universal2.whl.metadata (2.1 kB)
Collecting PyQt6_Fluent_Widgets==1.5.1 (from -r requirements.txt (line 2))
  Downloading PyQt6_Fluent_Widgets-1.5.1-py3-none-any.whl.metadata (5.2 kB)
Collecting PyQt6_Frameless_Window==0.3.8 (from -r requirements.txt (line 3))
  Downloading PyQt6_Frameless_Window-0.3.8-py3-none-any.whl.metadata (5.8 kB)
Collecting PyQt6_sip==13.5.2 (from -r requirements.txt (line 4))
  Downloading PyQt6_sip-13.5.2-cp310-cp310-macosx_10_9_universal2.whl.metadata (503 bytes)
ERROR: Cannot install PyQt6_sip==13.5.2 and PyQt6_sip==13.6.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested PyQt6_sip==13.5.2
    The user requested PyQt6_sip==13.6.0

rohankishore added a commit that referenced this issue Mar 6, 2024
@rohankishore
Copy link
Owner

I'd say, try running main.py via any IDE. Also, i've removed contradicting packages from requirements.txt.

If it was with exe, then the issue is most prolly with firewall, as solved in #6

@rohankishore rohankishore added the bug Something isn't working label Mar 7, 2024
@SonGokussj4
Copy link
Author

I'm sorry but argument run it with IDE is... How? If I set my VSCode to run I like python module, it will end up with the same error. The same if I set it to run the python file. This is a different problem in my opinion.

@rohankishore
Copy link
Owner

Here are few steps.

  • I've updated the main.py in the repo (Now I'm not importing QWidget directly from the files) (That might not be the fix tho)
  • Remove super.init() statement from functions.

Please try these and tell me the results. I've suggest downloading the latest code too in case you're in an older version.

Thank You
rohankishore

@SonGokussj4
Copy link
Author

Installation is OK now. No requirements.txt bugs. but the start of the program still results in QWidget: Must construct a QApplication before a QWidget

@rohankishore
Copy link
Owner

Damn. I still can't figure out what's the problem here lol. It's running well in my PC tho.

@SonGokussj4
Copy link
Author

Did you try what we had?
Create venv, activate, install requirements, run through python -m main and you should have the same problem?

@rohankishore
Copy link
Owner

I'll check it right now and update the progress. Thank you

@rohankishore
Copy link
Owner

Funnily enough, I'm getting an entirely different error now.

from PyQt6.QtCore import Qt, pyqtSignal, QEasingCurve, QUrl
ImportError: DLL load failed while importing QtCore: The specified procedure could not be found.

But mine works when trying to run the main.py using PyCharm though.

@SonGokussj4
Copy link
Author

Interesting.
Well, I haven't use PyCharm for many years mainly because is has it self ecosystem of some kind. I like the things more raw, when I connect VSCode to a script I'm writing, it will call venv and the command I want. But I have to specify that.

I don't know if PyCharm has anything automatic. Or if you have more pip packages (global) installed and it's conflicting with the virtual env version.

@rohankishore
Copy link
Owner

rohankishore commented Mar 8, 2024

Hey! I have a new fix (this might be trial and error so sorry for that).

Try replacing the last section of the main.py from:

QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)
    qdarktheme.enable_hi_dpi()
    app = QApplication(sys.argv)
    w = Window()
    qdarktheme.setup_theme("dark", custom_colors={"primary": theme_color})
    w.show()
    app.exec()

to:

    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough)

    qdarktheme.enable_hi_dpi()
    app = QApplication(sys.argv)
    w = Window()
    qdarktheme.setup_theme("dark", custom_colors={"primary": theme_color})
    w.show()
    sys.exit(app.exec())

I guess it might be the missing of sys.exit() statement that caused all the issues since the sys.exit() is necessary to ensure proper cleanup and termination of the application event loop when the main window is closed. But the question " then how tf did it run in my PC " still stands tho


I've updating the repo code anyways even if this's not actually a fix for the issue.

rohankishore added a commit that referenced this issue Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants