I have tried to install pygame using pip (pip install pygame).
pip doesn’t work (“command not found”) and when I use pip3, I get this error “Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-xncrnbwh/pygame/” (there is more text from the command’s execution, but I have only put the error in here) PROBLEM #1
I DO have pygame installed and I can execute scripts (python or pygame) from within a (simple) IDE – sort of. I can run pygame using python3 in Mu editor (python3 mode), but I can only run the same script using python (NOT python3) in Geany (and from CL). PROBLEM #2
To complicate things, Mu editor is using pygame 1.9.4 (Python3), but Geany (with Python2) is using 2.0.3, and 2.6.0 (with Python3) in Thonny. PROBLEM #3
I hope someone on this forum can help with these problems.
My main goal is to use pygame zero (which I don’t think is very supported in this forum), but I think these other python issues are underlying issues…
Linux, GalliumOS based on Ubuntu (for Chromebook hardware)
Python version? That’s a tough one: different IDEs use different versions! (as noted above), not sure about CL though Yikes!
As for where they were installed, I am pretty sure I use Synaptic or CL (apt) – but I fear that different IDEs would install their own?? (eg. Mu editor)
HOWEVER, everything seem to be working well now! (even though I had multiple problems: pgzrun not working, pygame doesn’t work with both python and python3, pip not working – cannot install modules, …)
Here was my ‘fix’ (but I’m not experienced enough to know WHICH fixed WHAT!
upgraded pip and setup_tools, then reinstalled python package (pgzero) through PIP
(something else, but I forgot?)
Anyway, ‘all’ of my python/IDE/pygame/pgzero problems seem to be fixed! I just wish I knew what was wrong (and why the above ‘fixes’ worked), especially since there was so many (seemingly independent) problems!
I would expect the IDE to use the python install into the system or one that you explicitly installl and then config the IDE to use.
But I’m not a Mu editor user…
Make sure the Path to the Python exe is set up correctly.
Make sure you are using a development environment, and the environment is activated. It is highly recommended to use a dev environment. See my reply for new users here.
I’m using Linux, so it doesn’t have an ‘exe’. No, I have not checked the PATH. But that doesn’t explain why different IDEs use different versions of Python (and Pygame)! Obviously, they don’t all use the PATH to find a working copy.
That also doesn’t explain why I have different versions of Python – I didn’t intentionally install them! As I suggested, maybe each (some?) of the IDEs install their own version?
Each environment is ‘activated’ (they ‘work’) and (as far as I see) they are all set up correctly.
I checked out your ‘new users’ post. Notes:
Linux, so no ‘EXE’ – but will check the PATH for links to binary for Python (the problem is, are there MULTIPLE versions installed, and IF so which one I should use!)
I tried a virtual environment exactly as you suggested (maybe I already saw this post?), and the exact same problem happened
the problem is that PIP didn’t work! Not sure why, too many versions of Python? PIP broken? That’s the problem!
I haven’t tried Pyinstaller. I won’t try it now since I ‘solved’ these problems (see my post above) – but I don’t know WHICH of those steps ‘fixed’ my problem, or why the original problems occurred! I want to know this for future…
Well they do, but they may be looking for something else or alter PATH before loading Python. You cannot evade the use of PATH when executing a program.
Your OS will normally install at most 2. So if you have more, you did install them, maybe not consciously. Especially Mu editor, the way that works makes me suspicious that they build a full environment, with their own Python and especially a separate library (the things you install with pip). BTW, you may want to take into account that in the Mu editor documentation the Linux implementation is deemed experimental. May not be the best to start programming with.
IDEs will not do that, unless (part of) the IDE itself is written in Python. For programs you change or write, the programmer is the one knowing what version of Python the program is written and tested on, so IDEs will leave it to the programmer to supply what Python and versions of library routines to use. To accommodate that, when creating or loading a project (or whatever the IDE calls it) the IDE will allow to select a Python. And e.g. pip accepts an explicit version of a library package to download, as the newest may not be the correct one.
Apparently none of the Python versions you installed, installed pip (“command not found”), otherwise the command would have been found .
Too many versions of Python is very unlikely. pip is used in environments where more Pythons are available, e.g. I have 4 versions on my system. And if pip were so severely broken, the Internet would be buzzing with people complaining, so very unlikely.
PyInstaller turns plain text python programs into an executable program. But by default it does not put all libraries into the one executable file. You have to specify another switch for that.
Thanks for you thorough reply! Lots of good info for me to consider.
A few other points:
I figured that, especially what has been happening (different IDEs using different versions)
For sure. I normally use Geany (which I have used for years), but have been migrating over the years to Atom and VS Code. I started using Mu for two simple reasons: 1) It is ‘native’ to the Raspberry Pi (one of the “preferred” applicatons), 2) I am looking for a good IDE to use with students learning to progarm (I am a teacher).
(FYI, I loosely call Mu, Geany, and Thonny an IDE)
Normally, I would completely agree. But Mu seems to do it, and I believe Monodevelop did it as well (installed and used it’s ‘own’ version of Mono/.NET/C#, although you could point it to a different/newer version)
I may have noted above that PIP3 seemed to work (before, but not now). But (I believe) that PIP was working before, and I could list packages (but then why would there be “command not found”!?) I can’t remember, even with my notes (recording problems as I go) But I still got the error 'Python Setup.py egg_info' Failed with Error Code 1" when using PIP.
Of course! That is why I was so confused about these error message!
Mu has decent code refactoring built-in (the Check button in menu). The menu is simple, especially good for new/young programmers (like Thonny’s simple mode).
The biggest advantage is that Mu can run Pygamezero files natively (without having to go to CLI and use pgzrun). Geany doesn’t do this, and I can’t (yet?) get VS Code to do it.
I still do not think it wise to let beginner programmers work with experimental versions of a program. Of course I do not teach programming and I have no opinion on the advantages of Mu editor that you mention.