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

Install problem on Windows Python 3.11 #5

Open
SonGokussj4 opened this issue Feb 23, 2024 · 12 comments
Open

Install problem on Windows Python 3.11 #5

SonGokussj4 opened this issue Feb 23, 2024 · 12 comments

Comments

@SonGokussj4
Copy link

I've activated venv and tried install from requirements.txt

python -m venv .venv
.venv/scripts/activate
python -m pip install -U pip
python -m pip install -r requirements.txt

...
ERROR: Cannot install -r .\requirements.txt (line 2) and starlette==0.37.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested starlette==0.37.1
    fastapi 0.109.2 depends on starlette<0.37.0 and >=0.36.3
@SonGokussj4
Copy link
Author

Fixed by python -m pip install -r requirements.txt --no-deps

But then when running as described in README.md

(.venv) PS (xxx) - (~\GIT\Spotifyte) [main] $ python -m .\
.git                .venv               CONTRIBUTING.md     README.md           src
.github             CODE_OF_CONDUCT.md  LICENSE             requirements.txt
(.venv) PS (xxx) - (~\GIT\Spotifyte) [main] $ python -m .\src\main.py
C:\Users\xxx\GIT\Spotifyte\.venv\Scripts\python.exe: Relative module names not supported

(.venv) PS (xxx) - (~\GIT\Spotifyte) [main] $ cd src

(.venv) PS (xxx) - (~\GIT\Spotifyte\src) $ python -m .\main.py
C:\Users\xxx\GIT\Spotifyte\.venv\Scripts\python.exe: Relative module names not supported

Fixed by python -m src.main but then No module named PySide6

 $ python -m src.main
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\xxx\GIT\Spotifyte\src\main.py", line 3, in <module>
    from PySide6.QtCore import Qt, Signal, QEasingCurve, QUrl
ModuleNotFoundError: No module named 'PySide6'

Fixed by adding PySide6 to requirements.txt and reinstalling all.

But then another problem. Not sure how to continue.

$ python -m src.main
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\xxx\GIT\Spotifyte\src\main.py", line 3, in <module>
    from PySide6.QtCore import Qt, Signal, QEasingCurve, QUrl
  File "C:\Users\xxx\GIT\Spotifyte\.venv\Lib\site-packages\PySide6\__init__.py", line 124, in <module>
    _setupQtDirectories()
  File "C:\Users\xxx\GIT\Spotifyte\.venv\Lib\site-packages\PySide6\__init__.py", line 58, in _setupQtDirectories
    for dir in _additional_dll_directories(pyside_package_dir):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\xxx\GIT\Spotifyte\.venv\Lib\site-packages\PySide6\__init__.py", line 27, in _additional_dll_directories
    raise ImportError(str(shiboken6) + ' does not exist')
ImportError: C:\Users\xxx\GIT\Spotifyte\.venv\Lib\shiboken6\libshiboken does not exist

@rohankishore
Copy link
Owner

The shiboken error is a known PySide6 glitch. I recommend uninstalling PySide6, shiboken, etc and then re-installing them. This has existed since PySide6 days sadly. I'd try to build future apps using maybe PyQt6.

Also, I'd recommend uninstalling shiboken and downloading shiboken 6.3.0 version as I read some articles on how their issue got fixed.

pip install shiboken6==6.3.0

Ref: marcelotduarte/cx_Freeze#665 , ImportError with PySide6/shiboken6

Thanks

@rohankishore
Copy link
Owner

I might migrate this entire app to PyQt6 since PySide6 has a lot of issues which the devs are just ignoring.

@Bibhav48
Copy link

Also, I'd recommend uninstalling shiboken and downloading shiboken 6.3.0 version as I read some articles on how their issue got fixed.

@rohankishore shiboken6==6.3.0 is for Python <3.11, >=3.6 as stated here. So, obviouslyPython >=3.11 won't support it.

@SonGokussj4
Copy link
Author

Degrading to python3.10 and running python -m pip install -U PySide6 shiboken6==6.3.0 PyQt5 solved a few turmoils.
But now

Spotifyte\.venv310\lib\site-packages\qfluentwidgets\common\config.py", line 8, in <module>
    import darkdetect
ModuleNotFoundError: No module named 'darkdetect'

So I installed one lib next to another. Because I was able to install from -r requirements.txt only with --no-deps, dependencies didn't install.

I had to do 2 things.

$ python -m pip install -U PySide6 shiboken6==6.3.0 PyQt5 darkdetect pypiwin32 spotipy brotli pycryptodomex websockets spotdl

This installed (I hope) all missing libraries.

Secondly, if I want to run the program from the root directory with python -m src.main, I had to change

# src.main.py

# before
import artist
import playlist
from song import Song

# to
from src import artist
from src import playlist
from src.song import Song

Now it finally does something.
But? I've ended with this and don't know how to continue.

$ python -m src.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

@rohankishore
Copy link
Owner

Download the codes and try again. I've migrated to pyqt6. Also, download pyqt fluent widgets like this (after uninstalling existing one):

pip install "PyQt6-Fluent-Widgets[full]" -i https://pypi.org/simple/

@SonGokussj4
Copy link
Author

Please specify which Python version should I use
And update requirements.txt with valid requirements.
And update README for the correct process.

# with python3.11 as default
python -m venv .venv
.venv/scripts/activate
python -m pip install -U pip
python -m pip install -r requirements.txt

INFO: pip is looking at multiple versions of fastapi to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r .\requirements.txt (line 2) and starlette==0.37.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested starlette==0.37.1
    fastapi 0.109.2 depends on starlette<0.37.0 and >=0.36.3

@rohankishore
Copy link
Owner

Will do it. I have no issues running it on my pc, so does a lot of others. I used python 3.11

@SonGokussj4
Copy link
Author

I've removed all ==xxx versions from requirements and added

PyQt6
PyQt6-Fluent-Widgets[full]

Edited the src.main.py as I've stated above.

neither python -m src.main or python src/main.py or from the directory src running python -m main or python ./main.py does not work.

Ends with this message.

$ python -m src.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

@rohankishore
Copy link
Owner

Did you just try running the main.py via any ide? Maybe some python parsing issues?

@SonGokussj4
Copy link
Author

No, everything through windows terminal. How do you run it? Because your Readme is just not working. You can't run module with .py extension.

@rohankishore
Copy link
Owner

Try it with any ide. It should work that way maybe.

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

When branches are created from issues, their pull requests are automatically linked.

3 participants