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

Support for Windows #14

Open
crashoverburn opened this issue Mar 21, 2021 · 13 comments
Open

Support for Windows #14

crashoverburn opened this issue Mar 21, 2021 · 13 comments

Comments

@crashoverburn
Copy link

Please have a look and if you can help, think can help a lot of people on windows environment.

C:\Users\maiqu\Documents\repos\qbr>pip3 install -r requirements.txt
Requirement already satisfied: cffi==1.14.4 in c:\python39\lib\site-packages (from -r requirements.txt (line 1)) (1.14.4)
Requirement already satisfied: future==0.18.2 in c:\python39\lib\site-packages (from -r requirements.txt (line 2)) (0.18.2)
Requirement already satisfied: kociemba==1.2.1 in c:\python39\lib\site-packages (from -r requirements.txt (line 3)) (1.2.1)
Requirement already satisfied: numpy==1.20.1 in c:\python39\lib\site-packages (from -r requirements.txt (line 4)) (1.20.1)
Requirement already satisfied: opencv-python==4.5.1.48 in c:\python39\lib\site-packages (from -r requirements.txt (line 5)) (4.5.1.48)
Requirement already satisfied: opencv-contrib-python==4.5.1.48 in c:\python39\lib\site-packages (from -r requirements.txt (line 6)) (4.5.1.48)
Requirement already satisfied: pycparser==2.20 in c:\python39\lib\site-packages (from -r requirements.txt (line 7)) (2.20)
Requirement already satisfied: pydocstyle==5.1.1 in c:\python39\lib\site-packages (from -r requirements.txt (line 8)) (5.1.1)
Requirement already satisfied: python-i18n==0.3.9 in c:\python39\lib\site-packages (from -r requirements.txt (line 9)) (0.3.9)
Requirement already satisfied: snowballstemmer==2.1.0 in c:\python39\lib\site-packages (from -r requirements.txt (line 10)) (2.1.0)

C:\Users\maiqu\Documents\repos\qbr>python src\qbr.py
Traceback (most recent call last):
File "C:\Users\maiqu\Documents\repos\qbr\src\qbr.py", line 8, in
from video import webcam
File "C:\Users\maiqu\Documents\repos\qbr\src\video.py", line 6, in
from colordetection import color_detector
File "C:\Users\maiqu\Documents\repos\qbr\src\colordetection.py", line 8, in
from config import config
File "C:\Users\maiqu\Documents\repos\qbr\src\config.py", line 37, in
config = Config()
File "C:\Users\maiqu\Documents\repos\qbr\src\config.py", line 20, in init
os.mkdir(self.config_dir)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\Users\maiqu/.config/qbr'

C:\Users\maiqu\Documents\repos\qbr>

@kkoomen
Copy link
Owner

kkoomen commented Mar 22, 2021

Ah, yes. I started to make this project just for personal learning and then it received quite some stars in the last 48h. I don't use Windows, but I will add a fix soon. The problem here is that the config dir by default is set to ~/.config/qbr but this doesn't exists on Windows.

@crashoverburn
Copy link
Author

crashoverburn commented Mar 22, 2021 via email

@kkoomen
Copy link
Owner

kkoomen commented Mar 22, 2021

@crashoverburn Since I don't use windows, I decided not to support it my self. if you can change the ~/.config/qbr to be windows compatible and give me a PR, that'd be nice. I rarely supports windows. I only support it in some projects only because other people who use windows helped me out.

@kkoomen kkoomen changed the title Do I need a mac for this ? Trying to run on Windows 10 64 bits with Python and all libraries installed Support for Windows Mar 22, 2021
@ghost
Copy link

ghost commented Mar 22, 2021

So can I do somethink for it to run on windows?
I am making project Lego Mindstorms solve rubicks cube, I have the program, you give it a move like L2 and it will do it but Idk how to scan cube with webcam so I was waiting for this project lol.

@kkoomen
Copy link
Owner

kkoomen commented Mar 22, 2021

@crashoverburn @honnzoun I think in order to make it work, you guys have to replace the following side src/config.py:

self.config_dir = os.path.expanduser('~/.config/qbr')

with

self.config_dir = os.path.expanduser('{}\\qbr\\'.format(os.environ['APPDATA']))

Let me know if this works for you guys.

EDIT: if the above works for Windows, then I'll add a push this to master soon.

@ghost
Copy link

ghost commented Mar 22, 2021

I did replace it then it said no module named i18n so I pip installed it and now it says: "AttributeError: module 'i18n' has no attribute 'load_path'" (I had it installed wrongly now its good)

EDIT: Now it says: AttributeError: module 'cv2.cv2' has no attribute 'freetype'

@kkoomen
Copy link
Owner

kkoomen commented Mar 22, 2021

EDIT: Now it says: AttributeError: module 'cv2.cv2' has no attribute 'freetype'

For this, make sure you run pip3 install opencv-python and then pip3 install opencv-contrib-python. The order here is important.

EDIT: see my comment here for the solution.

@ghost
Copy link

ghost commented Mar 23, 2021

Sorry for being late. But I tryied but still the same
I even reinstalled Python (3.8.5)

@kaptanhawk007
Copy link

EDIT: Now it says: AttributeError: module 'cv2.cv2' has no attribute 'freetype'

For this, make sure you run pip3 install opencv-python and then pip3 install opencv-contrib-python. The order here is important.

still getting the error

@kaptanhawk007
Copy link

Sorry for being late. But I tryied but still the same
I even reinstalled Python (3.8.5)

any solution ?????????

@kkoomen
Copy link
Owner

kkoomen commented Apr 16, 2021

@kaptanhawk007

https://stackoverflow.com/questions/44633378/attributeerror-module-cv2-cv2-has-no-attribute-createlbphfacerecognizer#44641712

This guy says the same thing I mentioned. OP says he's using Windows and other people say that it's working. Installing in the right order should fix the problem. I don't have Windows nor care about supporting it by myself, so you guys have to debug yourself. If you have solutions, feel free to post them or ever better, submit a pull request, I'm happy to merge it, but unfortunately I can't help you guys debug or test.

@cveld
Copy link

cveld commented Oct 17, 2021

Are we sure that opencv-contrib-python is actually providing freetype together with Harfbuzz? On https://stackoverflow.com/questions/47726854/error-module-object-has-no-attribute-freetype user luckiday reports that opencv-contrib-python-4.5.3.56 does not have freetype. He downgraded it to version 4.4.0.46, then it works.
From opencv/opencv-python#117 I got the signal that freetype / harfbuzz was never to be included in opencv.

I worked my way through this procedure to get a custom built opencv locally with freetype and Harfbuzz.
https://github.com/BabaGodPikin/Build-OpenCv-for-Python-with-Extra-Modules-Windows-10
(this takes ages! why does this require many manual steps, and is this not fully automated..........)

Now qbr runs fine on windows. The only thing is that I have two webcams. So I am proceeding in amending the script to pick the one desired.

I also tried qbr on wsl2, but unfortunately wsl2 is not allowing for connecting with a webcam yet.......

@kkoomen
Copy link
Owner

kkoomen commented Nov 5, 2022

Hi. I just released a new version which uses pillow to draw the text and have completely removed the opencv-contrib-python dependency. Reinstall the dependencies with pip3 install -r requirements.txt and then run ./src/qbr.py should be working without the error that freetype doesn't exists.

If someone could let me know if the latest master branch works as expected, that'd be great :)

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

4 participants