I`m having some issues installing Pygame. I am running a 64 bit Windows 8 system, with a 32 bit version of Python 3.4.
Here is how I have been trying to install it so far:
I have visited http://pygame.org/download.shtml and downloaded the file called pygame-1.9.2a0.win32-py3.2.msi.
I have executed the file and selected 'Install for all users'.
At this point it asks me to select a Python location into which I should install Pygame. I then select 'Will be installed on local hard drive' from the dropdown. A text box asks me to input an alternate Python location. This is set to C:\PythonX. I set it to my Python location - C:\Python34.
I finish the installer and go to the shell. I input import pygame into the command line. It gives the following error:
Traceback (most recent call last): File "", line 1, in
import pygame File "C:\Python34\lib\site-packages\pygame__init__.py", line 95, in
from pygame.base import * ImportError: DLL load failed: The specified module could not be found.
If I look in the Python34 file after the install, I find the Pygame folder in the location C:\Python34\Lib\site-packages\pygame.
Any help would be greatly appreciated.
Installing from MSI and not pip make sure you get the correct version that matches your set up of Python.
you are running a 64 bit Windows 8 system, with a 32 bit version of Python 3.4.
you downloaded the 32 bit version of Pygame for Python 3.2 you need the one for the Python 3.4 version.
This one from official bitbucket should work as it is the correct version for python 3.4 32 bit compatibility.
https://bitbucket.org/pygame/pygame/downloads/pygame-1.9.2a0-hg_5974ff8dae3c+.win32-py3.4.msi
Related
I have downloaded pygame for 64 bit and when I try to import pygame , I keep on getting the following error.
Traceback (most recent call last):
File "D:\Python\test 2\test_2.py", line 4, in <module>
import pygame
ImportError: No module named 'pygame'
Note
According to http://www.pygame.org/download.shtml
NOTE: if you
had pygame 1.7.1 installed already, please uninstall it first. Either
using the uninstall feature - or remove the files:
c:\python25\lib\site-packages\pygame
Direct download link for python
Downoad link for python 2.7.11 ===> Here
Direct download link for pygame
Download link for pygame ===> Here
Make sure you install the correct python version and pygame version.Dont mix up the two.
The links I have provided are ONLY for windows and not any other operating system.
Well, you need to make sure you are downloading the correct version of pygame with python. Try redownloading pygame, and when your downloading it should say if it finds the proper python in the directory, if it doesn't theres a problem with the version you/your downloaded/downloading.
I want to have Python 3 support in OpenCV, so I read that I need to build my own version with it.
I downloaded OpenCV 3 beta from SourceForge, then I used CMake to create a project, and then compiled it with Visual Studio.
It has created lot's of files (not actually the same structure as in precompiled folder from Sourceforge), and also a cv2.pyd. I placed this file into Python34\lib\site-packages, and tried import cv2 in python console, but it says
Traceback (most recent call last):
File "", line 1, in
ImportError: DLL load failed: Module not found.
What I did wrong?
Thanks.
If you want to avoid building your own version, Christoph Gohlke maintains Windows binaries for many Python packages, including the production version of OpenCV 3.0 with Python 3.x bindings, released 4 June 2015:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
To install, just download the 64-bit or 32-bit .whl file appropriate for your system, then run pip install [filename]. Then the instruction import cv2 should work in your Python 3.x interpreter.
So I'm using python 3.3 and recently I have tried to install wxpython and wxwidgets.
Synaptic package manager shows that wxversion, wxtools and wxgtk2.8 are all installed. When I use the python idle I get an import error however when I use iPython (command line with auto complete etc...) it happily runs the code.
What's going on?
Error Message:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module> import wx
ImportError: No module named 'wx'
IPython must be running Python 2.x because wxPython 2.8.x ONLY works with Python 2.x. If you want to use wxPython in Python 3, you have to use wxPython 2.9-Phoenix. Please note the Phoenix is kind of alpha in that ONLY the core widgets are currently available in it.
You can read more about it and download it from here:
http://wiki.wxpython.org/ProjectPhoenix
in your python shell at the very top, it will tell you what bit your python runs on. It's either 32bit or 64 bit. now once you have that info wxpython has two different bit varients depending on what python version your running, again either 32bit or 64 bit. If you have the python 32bit version you must use the wxpthon 32bit for the import to work.
I had this mistake also and figured it out this way. Good Luck!!
First let's See what version of Python we're running:
python --version
Looks like we have Python running version 3.
Python 3.3.0
That won't work.
Remove Python 3:
sudo apt-get remove python3
Let's reinstall Python but version 2.7:
sudo apt-get install python2.7 wx-common python-wxtools python-wxgtk3.0
I have this issue where I try to import cv2 on Python and get the following error message.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.
I do understand there are many posts about this where it is suggested that the bitness of the package is different from the Python package.
However, everything I am running is 64 bits. I am on Windows 7 64 bits, I have the winpython 2.7.3.3, 64 bits distribution, and I compiled OpenCV in 64 bits with the instruction provided here and placed the cv2.pyd DLL file in the Lib/site-packages folder of the Python interpreter.
Unfortunately, the suggestion of using the 32 bits version of Python isn't working for me any more as I have to handle NumPy arrays too large for 32 bits.
The only thing missing was to add the new NumPy binaries path (C:\opencv\build\bin\Release) to the Windows PATH environment variable, restart the Python interpreter.
Everything seems to be working fine now!
The ImportError message is a bit misleading because of the reference to Win32, whereas the problem was simply the OpenCV DLLs were not found.
This problem was solved by adding the path the OpenCV binaries to the Windows PATH environment variable (as an example, on my computer this path is: C:\opencv\build\bin\Release).
You could try installing the 32 bit version of OpenCV.
I just hit this and the problem was that the package had at one point been installed in the per-user packages directory. (On Windows.) aka %AppData%\Python. So Python was looking there first, finding an old 32-bit version of the .pyd file, and failing with the listed error. Unfortunately pip uninstall by itself wasn't enough to clean this, and at this time pip 10.0.1 doesn't seem to have a --user parameter for uninstall, only for install.
tl;dr Deleting the old .pyd from %AppData%\python\python27\site-packages resolved this problem for me.
Or you have to rebuild the cv2 module for Windows 64 bit.
This error can also appear when Python versions are mixed:
For example, if any of the DLL file to be loaded has been compiled using Python 2.7.16 and you try to import with Python 2.7.15 the error ImportError: DLL load failed: %1 is not a valid Win32 application. is thrown.
This is at least what I've found to be the problem in my case.
All you have to do is copy the cv2.pyd file from the x86 folder (C:\opencv\build\python\2.7\x86\ for example) to C:\Python27\Lib\site-packages\, not from the x64 folder.
I had the same error as the one mentioned in previous answers, but it happens only when I use pyinstaller.
I did the following in my Poetry venv:
poetry run python -m pip install pypiwin32
And it worked for me. I am using
python 3.8.10
pyinstaller 4.7
# Those are the versions that worked for me
pypiwin32 223
pywin32 303
pywin32-ctypes 0.2.0
When I had this error, it went away after I my computer crashed and restarted. Try closing and reopening your IDE. If that doesn't work, try restarting your computer. I had just installed the libraries at that point without restarting PyCharm when I got this error.
I never closed PyCharm first to test, because my blasted computer keeps crashing randomly... I am working on that one, but it at least it solved this problem... little victories... :).
I've been trying to install PyGame with little success. I downloaded the
pygame-1.9.1release-python.org-32bit-py2.7-macosx10.3.dmg
version of PyGame from this link and installed it using the wizard, but when I typed import pygame into the IDLE I got the following message.
$ import pygame
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
What did I do wrong?
Also, what are the prerequisites for PyGame? I'm doing all this on a new computer and I've hardly downloaded anything.
I'm running OS X Version 10.8.2.
I know this thread is a little old, but thought I'd share my experience on this subject...
I'm using a 64-bit MacBook Pro running OS Mavericks and python 2.7.
Steps:
If you've installed a few different versions of pygame while trying to get the darn thing to import and work successfully, make sure you delete/uninstall all of these to get a fresh start. I did a simple search in the terminal to see where all of the various pygame folders where located:
In Terminal: sudo find / -iname "pygame"
The results show a list of all the pygame directories, these are the folders that you want to delete. Note, I created a new tab in terminal to do this so I can reference the directories from the search on the previous tab and easily copy each directory without having to do another search to remember where they are:
In Terminal: sudo rm -R -i path/pygame
Also note, you can take the -i out of the above code and it won't confirm the deletion of certain files, but BE REALLY CAREFUL when deleting full directories from the terminal.
Once your machine is clean of all previous pygame installations, make sure you have python 2.7 from python.org, NOT IDLE (default Mac Python Interpreter)! This is very important. I use PyCharm and it rocks! Also, choose the version that works on a 32-bit machine and 64-bit machine - this way you won't have issues with the pygame 32-bit installer on your 64-bit machine. I tried same installation process but with the 64-bit only python 2.7 installation and it didn't work. Link provided below:
Download 32/64-bit Python 2.7
Next, download the 32-bit pygame file for OS X 10.3 and beyond and run the mpkg file created from the dmg. Link provided below.
Download pygame 1.910 release for python 2.7
You should now have a working pygame installation in your python 2.7 package library. Enjoy.
Did you install python from python.org? Or use the one that came with OS X?
If you used the one supplied by Apple, you must download the one from python.org first, then install using that package. Or you can try the Lion-pygame package (the link is at the bottom of the Macintosh section of the download page), but it may be incompatible.
Did you download python 64-bit or python 32-bit?
This can cause major problems if you don't have the right one, if you have 64-bit you can download pygame 64-bit from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame