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

A little bug that I ran into #34

Open
cpeeler2023 opened this issue May 11, 2023 · 15 comments
Open

A little bug that I ran into #34

cpeeler2023 opened this issue May 11, 2023 · 15 comments

Comments

@cpeeler2023
Copy link

First off, this is an amazing project. I used it to also make my own mechanical Rubix Cube solver and the scanner works great. I modified it to fit exactly what I needed, and it was easy to follow.

When I was working on installing it, one problem kept occurring. I ran the installation on multiple computers and got the same errors. Maybe this was just on my computer but I think it could also happen on others (or I could just be wrong, not sure). This was the error I was receiving:
Traceback (most recent call last):
File "/Users/
__________/qbr/./src/qbr.py", line 8, in
from video import webcam
File "/Users/qbr/src/video.py", line 6, in
from colordetection import color_detector
File "/Users/
/qbr/src/colordetection.py", line 8, in
from config import config
File "/Users//qbr/src/config.py", line 37, in
config = Config()
^^^^^^^^
File "/Users/
/qbr/src/config.py", line 20, in init
os.mkdir(self.config_dir)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/________/.config/qbr'

I figured out how to solve the problem, but I thought it anyone else runs into the same problem, this might help.

1: Go to config.py, then on line 11 change "/.config/qbr" to "/qbr/src"
I belive that the way that it is structured right now does not get the correct file, but the qbr/src selects the correct file

2: The next step I did was move the demo photos from outside the src files into it moving it from the qbr file to src. I also think this is because it is not finding the photos due to its location.

I worked on this with a partner who helped me figure some of this stuff out so I could be wrong, but it worked for me and it may come in handy for some if running into a similar problem.

@kkoomen
Copy link
Owner

kkoomen commented May 11, 2023

Hi,

Please provide the following information:

  • your system (linux/windows/macos)
  • python version
  • are you logged in as a root user?
  • are you running this project inside a docker environment?
  • open a new shell with python3 and show me the output of: import os; os.path.expanduser('~/.config/qbr'), what do you get?

@Jezze84
Copy link

Jezze84 commented Sep 12, 2023

Hey, I had this exact same issue and the exact same error message. I'm on a MacBook and even after I tried @cpeeler2023 solution, I continued receiving it. I'm on Python version 3.11.5. I would be so happy if you could help me fix this as it would be a great help for my science fair project and I am happy to give you any other details you need.

@kkoomen
Copy link
Owner

kkoomen commented Sep 17, 2023

@Jezze84 Please provide me the above information I initially asked @cpeeler2023 to give me. Also include the whole error message itself.

@Jezze84
Copy link

Jezze84 commented Sep 17, 2023

Thank you so much for responding! Here's all the specifications:

  • System: macOS
  • Python version: 3.11.5
  • Root User?: I was not but I just enabled it
  • Docker Environment?: I'm not exactly sure but I've been running the commands and python executables through Terminal but if you mean does the command line have (env) in front of in then yes it does.
  • Lastly when I run "import os; os.path.expanduser('~/.config/qbr')" I get "/Users/______/.config/qbr"

Another problem that may be helpful to know is that when I run "source ./env/bin/activate" on its own it will give me "zsh: permission denied" but it doesn't occur for me when I run the installation commands and then the ./src/qbr.py command.

I often get "ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects"

and after I run that set of commands and then run "./src/qbr.py" I always get the same response as @cpeeler2023 which is:

Traceback (most recent call last):
File "/Users//qbr/./src/qbr.py", line 8, in
from video import webcam
File "/Users/
/qbr/src/video.py", line 6, in
from colordetection import color_detector
File "/Users//qbr/src/colordetection.py", line 8, in
from config import config
File "/Users/
/qbr/src/config.py", line 37, in
config = Config()
^^^^^^^^
File "/Users//qbr/src/config.py", line 20, in init
os.mkdir(self.config_dir)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/
/.config/qbr'

So if any of this helps I would really appreciate some feedback. Thank you!!!

@kkoomen
Copy link
Owner

kkoomen commented Sep 30, 2023

@Jezze84 Sorry for the late reply, I was very busy recently.

Regarding your path problem, please provide me the output of the following commands:

  • python3 -c "import os; print(os.path.join(os.getenv('HOME'), '.config/qbr'))"
  • echo $USER
  • echo $HOME

Regarding the other error "ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects", I do not get the error by myself. I was able to reproduce the error on an ubuntu VPS, but not on my own macOS. For linux users, I've updated the README to require the following prerequisites:

For linux users, make sure to install the following prerequisites:

$ sudo apt-get install python3-dev build-essential

Rearding macOS, I even removed all my pip3 packages and completely reinstalled python3 on my system. It might be the way how you initially installed python3 on your system. I personally installed python3 through brew install python3 and thus doesn't seem to have any problems.

Perhaps you can try installing pip3 install python3-dev (or python-dev if python3-dev doesn't exist). Does that fix this install issue?

@Jezze84
Copy link

Jezze84 commented Oct 22, 2023

@kkoomen No worries about your late reply, in fact it's the same reason it's taken me a long time to get back to you because I've also been super busy.

Regarding the outputs you wanted me to provide you with here they are (in order of what you asked):

  • /Users/examplename/.config/qbr
  • examplename
  • /Users/examplename

(The "examplename" are all the exact same name and format I just censored them because idk if its safe to share that information publicly)

In regards to the "ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects" and the solutions you suggested: I don't know how to go about reinstalling python3 since I've read that its not safe to complexly uninstall python 3 on Macs and that it could harm the system. But if you think that could be the key issue then I would be happy to reinstall it with brew install python3 or pip3 install python3-dev but you would have to guide me through the process because again I'm not sure if uninstalling will harm my system or not.

@kkoomen
Copy link
Owner

kkoomen commented Oct 26, 2023

@Jezze84 You confirm whether you've installed python3 through brew by doing which python3, which in my case outputs:

$ which python3
/opt/homebrew/opt/python@3/Frameworks/Python.framework/Versions/Current/bin/python3

if this outputs something starting with /opt/homebrew/ then you have installed it through brew for sure. If it is not that then you don't have to do anything, just ignore it. I don't really know how to fix this issue to be honest for now.

@Jezze84
Copy link

Jezze84 commented Oct 27, 2023

@kkoomen I used the command you gave me and I received /Library/Frameworks/Python.framework/Versions/3.11/bin/python3. This is because I probably installed it with pip and not brew but do you uninstalling python 3 and reinstalling with brew could fix the path problem I have? If so, then how would I go about reinstalling as to not harm my system.

@kkoomen
Copy link
Owner

kkoomen commented Oct 27, 2023

@Jezze84 First of all, please provide me with the output of the following command:

python3 -c "import os; print(os.path.expanduser('~'))"

Second, now that I'm reading your initial problem again:

Now that I read your initial question again

I often get "ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects"

and after I run that set of commands and then run "./src/qbr.py" I always get the same response as @cpeeler2023 which is:

Traceback (most recent call last):
File "/Users//qbr/./src/qbr.py", line 8, in
from video import webcam
File "/Users//qbr/src/video.py", line 6, in
from colordetection import color_detector
File "/Users//qbr/src/colordetection.py", line 8, in
from config import config
File "/Users//qbr/src/config.py", line 37, in
config = Config()
^^^^^^^^
File "/Users//qbr/src/config.py", line 20, in init
os.mkdir(self.config_dir)
FileNotFoundError: [Errno 2] No such file or directory: '/Users//.config/qbr'

You're saying with a set of commands you can get it to work again but apparently the config directory isn't expanded correctly, so perhaps if I just fix the config then everything is solved.

@Jezze84
Copy link

Jezze84 commented Nov 13, 2023

@kkoomen Again sorry for the late response but here it is:

/Users/bryanjones
bryanjones@Bryans-MacBook-Pro ~ %

@kkoomen
Copy link
Owner

kkoomen commented Nov 24, 2023

@Jezze84 Please pull from the master branch and run ./src/qbr.py and see if it works now. If not, please report any errors here.

@Jezze84
Copy link

Jezze84 commented Nov 24, 2023

@kkoomen Instead of just updating the program by pulling the changes from the master branch I was dumb and just reinstalled the whole thing. Regardless, it did update the changes you made such as the misplaced parenthesis and changing pillow to 10.01 which seems to have resolved that initial error I had because that no longer comes up when installing or trying to run source ./env/bin/activate and then ./src/qbr.py but now I get a new (although much simpler) error:

Traceback (most recent call last):
  File "/Users/bryanjones/qbr/./src/qbr.py", line 6, in <module>
    import kociemba
ModuleNotFoundError: No module named 'kociemba'

If you know how to fix this I figured asking here first but I'll continue trying to resolve this on my own. I think all I have to do is go in and install the kociemba program off GitHub and direct it there but if you know how to fix this I would be very appreciative. Anyways thanks for all the help!

@kkoomen
Copy link
Owner

kkoomen commented Nov 24, 2023

Just run pip3 install -r requirements.txt, as this file contains the kociemba package as a dependency for the project.

@Jezze84
Copy link

Jezze84 commented Nov 26, 2023

I did and I got the same results. I did some testing and when I install pip3 install -r requirements.txt and then do pip list to check which modules are installed I don't see any of the modules listed in the requirements.txt file. I looked up a bunch of tutorials and guides and I think the reason that they're not installing is because of a PATH issue with the virtual environment or the wrong version of python. I tried installing the modules individually and this did get rid of the ModuleNotFoundError: No module named 'kociemba' but then I got:

 Traceback (most recent call last):
  File "/Users/________/qbr/./src/qbr.py", line 8, in <module>
    from video import webcam
  File "/Users/_________/qbr/src/video.py", line 5, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'

And when I try to install this individually I get the error:

ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)
ERROR: No matching distribution found for cv2

Again, I don't know if this is just the PATH being messed up because its in a virtual environment or because it is the wrong version of Python which the modules are installing to but as I try to troubleshoot this error I'll update. EDIT: In case you ask when I run python --version in the qbr virtual environment created with the source ./env/bin/activate it gives me 3.11.5

@kkoomen
Copy link
Owner

kkoomen commented Nov 26, 2023

Error such as No module named 'XX' simply means you have to install it through pip3 install XX.
I don't know what is wrong with your local environment, but after you've cloned the repository, you should be able to follow the installation instructions as described in the README, this should work cross platform though.

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