1

I've installed python 3.8.7 on my mid 2009 macbook pro,and can't seem to properly install pygame on it. I've gone into terminal and installed it using the command "pip3 install pygame" which seemed to work fine, but when I try to import it in python it comes up with the error message "image not found". If anyone could help it would be greatly appreciated.

Error stack trace

Traceback (most recent call last): File "/Users/user/Documents/check.py", 
line 1, in <module> import pygame File 
"/Users/user/Library/Python/3.8/lib/python/site-packages/pygame/__init__.py", 
line 81, in <module> from pygame.base import * # pylint: disable=wildcard- 
import; lgtm[py/polluting-import] ImportError: 
dlopen(/Users/user/Library/Python/3.8/lib/python/site- 
packages/pygame/base.cpython-38-darwin.soLibrary not loaded: 
/System/Library/Frameworks/Metal.framework/Versions/A/Metal Referenced from: 
/Users/user/Library/Python/3.8/lib/python/site-packages/pygame/base.cpython- 
38-darwin.so Reason: image not found   
  • 1
    Ive not tried to load an image I've just imported pygame – Alix Addison Jan 08 '21 at 20:30
  • Does this answer your question? [How to import all images from a user specified folder in python using pygame](https://stackoverflow.com/questions/22420127/how-to-import-all-images-from-a-user-specified-folder-in-python-using-pygame) – demokritos Jan 08 '21 at 20:40
  • I don't think it's about images cause I've not tried to import an image – Alix Addison Jan 08 '21 at 20:43
  • 1
    Please post the _full_ error message including traceback, else it's hard to pinpoint the problem. – xdurch0 Jan 08 '21 at 20:43
  • maybe pygame didn't install correctly. Half of my problems are solved by uninstalling and reinstalling things so try that. –  Jan 08 '21 at 20:49
  • It's too long I'll have to post in two parts – Alix Addison Jan 08 '21 at 20:51
  • Traceback (most recent call last): File "/Users/user/Documents/check.py", line 1, in import pygame File "/Users/user/Library/Python/3.8/lib/python/site-packages/pygame/__init__.py", line 81, in from pygame.base import * # pylint: disable=wildcard-import; lgtm[py/polluting-import] ImportError: dlopen(/Users/user/Library/Python/3.8/lib/python/site-packages/pygame/base.cpython-38-darwin.so, 2): – Alix Addison Jan 08 '21 at 20:52
  • Library not loaded: /System/Library/Frameworks/Metal.framework/Versions/A/Metal Referenced from: /Users/user/Library/Python/3.8/lib/python/site-packages/pygame/base.cpython-38-darwin.so Reason: image not found – Alix Addison Jan 08 '21 at 20:52
  • I've installed it and unistalled it like 1000 times – Alix Addison Jan 08 '21 at 20:54
  • @AlixAddison Try `pip install --no-cache-dir ` –  Jan 08 '21 at 23:07

1 Answers1

-1

as user "ModoUnreal" said in that post (Error while import pygame) "A. Check if you have a 64 or 32 bit version pygame and make sure your version of python is the same.

B. Use something like pip install or any other type of method to install pygame.

C. Install a previous version of pygame and python, you might have some more luck with that.

The error is basically saying that a class in pygame called image could not be found. Obviously pygame has not been installed properly so I would suggest using the above methods to install it again.

I hope this helps!"

icecube
  • 111
  • 2
  • 16
  • How do I check what version of pygame I have – Alix Addison Jan 08 '21 at 20:37
  • that should help - (https://stackoverflow.com/questions/1345632/determine-if-an-executable-or-library-is-32-or-64-bits-on-windows ) [ or you could just use pip uninstall pygame and then install the correct version ] – icecube Jan 08 '21 at 20:40
  • That's confused me even more – Alix Addison Jan 08 '21 at 20:42
  • what version of python do you have? (32 bit or 64 bit) – icecube Jan 08 '21 at 20:44
  • I have 64 but version 3.8.7 – Alix Addison Jan 08 '21 at 20:56
  • if you cannot check the version of library just simply run "pip uninstall pygame" and then install it correctly ([link](https://www.webucator.com/blog/2015/03/installing-the-windows-64-bit-version-of-pygame/)) – icecube Jan 08 '21 at 21:00
  • then It propably won't be the solution in point A, try the other options maybe one of them will solve the problem. – icecube Jan 08 '21 at 21:06
  • "Unfortunately, Pygame doesn't have an official 64-bit installer, so they recommend you use the 32-bit version of Python" and that could be helpful too – icecube Jan 08 '21 at 21:18