amiguet / pymugic

Vizualizing data from the MUGIC IMU
GNU General Public License v3.0
1 stars 0 forks source link

Problem with pygame. (Also, python3, not python.) #1

Open hervebronnimann opened 2 years ago

hervebronnimann commented 2 years ago

First of all, thanks for making this code available!!! This isn't an issue with this code per se, but this requires python3 and this isn't stated anywhere. Still, I'm running into problem and would appreciate help:

$ source venv/bin/activate
(venv) $ pip install -r requirements.txt
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Requirement already satisfied: oscpy==0.6.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (0.6.0)
Requirement already satisfied: pygame==2.1.2 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (2.1.2)`
Requirement already satisfied: PyOpenGL==3.1.6 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (3.1.6)
(venv) $ python3 pymugic.py 
Traceback (most recent call last):
  File "pymugic.py", line 9, in <module>
    import pygame
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pygame/__init__.py", line 83, in <module>
    from pygame.base import *  # pylint: disable=wildcard-import; lgtm[py/polluting-import]
ModuleNotFoundError: No module named 'pygame.base'
amiguet commented 2 years ago

Python3 has been the official version for many years now. Anyway I added a note in the README for people less acquainted with the python ecosystem.

Regarding the ModuleNotFoundError: it seems python is not using the venv you just created.

Try deleting the venv (just delete the directory with this name) and re-creating it, making sure you're using python3 and pip3 all along:

$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install -r requirements.txt
$ python3 pymugic.py