qbr icon indicating copy to clipboard operation
qbr copied to clipboard

Support for Windows

Open crashoverburn opened this issue 3 years ago • 13 comments

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>

crashoverburn avatar Mar 21 '21 22:03 crashoverburn

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.

kkoomen avatar Mar 22 '21 01:03 kkoomen

Great jobCan I change some file on windows to define the work dir ?Bes regards and congratulations for the jobOn 21 Mar 2021 22:31, Kim 金可明 @.***> wrote: 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.

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

crashoverburn avatar Mar 22 '21 01:03 crashoverburn

@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 avatar Mar 22 '21 01:03 kkoomen

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.

ghost avatar Mar 22 '21 07:03 ghost

@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.

kkoomen avatar Mar 22 '21 07:03 kkoomen

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'

ghost avatar Mar 22 '21 07:03 ghost

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.

kkoomen avatar Mar 22 '21 09:03 kkoomen

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

ghost avatar Mar 23 '21 10:03 ghost

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 avatar Apr 16 '21 07:04 kaptanhawk007

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

any solution ?????????

kaptanhawk007 avatar Apr 16 '21 07:04 kaptanhawk007

@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.

kkoomen avatar Apr 16 '21 09:04 kkoomen

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 https://github.com/opencv/opencv-python/issues/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.......

cveld avatar Oct 17 '21 19:10 cveld

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 :)

kkoomen avatar Nov 05 '22 15:11 kkoomen