python3 importing pygame results in PyCObject_AsVoidPtr - python-3.x

I have encountered difficulty putting pygame together with python3 on my MacBookPro.
I installed Python 3.3, and my MacOS is running version 10.7.5.
Then I downloaded pygamev1.9.1 source code, and followed instructions in http://programming.itcarlow.ie/PyGameInstall.pdf
Compilation and installation was smooth until I issued "import pygame" inside python3.
Then I encountered the following "PyCobJect_AsVoidPtr" error (further text following error message):
import pygame
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pygame/init.py", line 95, in
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pygame/base.so, 2): Symbol not found: _PyCObject_AsVoidPtr
Referenced from: /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pygame/base.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pygame/base.so
A search on google indicates this symbol has been removed since Python3.2:
http://mail.python.org/pipermail/python-dev/2011-March/108882.html
Can someone please give me some advice on how to get pygame working on Python3.3?
More so, whereas I am aware the pygame/python3 developers are busy with their work, but I would certainly appreciate it if someone can provide precompiled pygame binaries for python3. I have limited computer skills, and I just want to go ahead and learn Python3 and pygame, and this is seriously stunting my interest.

I notice that you were trying to compile from source, but builds on Python 3.3, to my knowledge, are not yet supported (as of January 2013). In fact, the only binaries I'm aware of for PyGame and Python 3.3 are unofficial builds and Windows only.
You should consider instead using a previous version of Python (e.g. Python 2.7.*), PyGame builds/binaries on which are well-supported. Any points on setting up should be directed to the pygame-users mailing list, if they weren't already.

Related

pygame.error: The video driver did not add any displays

I'm trying to get Pygame running on my Mac OS Monterey. The library installs fine and ends up where it should be. I've written a number of functioning programs with Pygame on my Linux machine and am using them as tests. The problem from what I can gather is that pygame.display can't be initialized for some reason. Every time I run a Pygame program it fails on the call to pygame.display.set_mode().
I am primarily using a wack-a-mole clone for testing. Here is the error I get:
pygame 2.0.1 (SDL 2.0.14, Python 3.8.2) Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last): File "mole_attack.py", line 34, in <module>
WINDOWSURFACE = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
pygame.error: The video driver did not add any displays
Please let me know if anyone needs more info. I tried to be as detailed as possible. Thanks in advance for any help.
The problem was that the latest version of Pygame was 2.1.2 and I was using 2.1.0 which I thought was the latest. I updated Pygame and everything worked fine. I couldn’t find anything definitive on what changed between these versions and why this error existed to begin with. I’ll keep looking and see what I can find out.

Illegal Instruction 4 (Made a mess of python installation, no idea what I'm doing)

I am inexperienced with bash, python, and simply a lot of the basics/fundamentals some might take knowledge of for granted. I am using macOS 10.7.5. After installing numpy but getting error messages when importing in IDLE, I decided to reinstall python 3.7, but am getting several error messages now.
Some time ago, I installed python 3.7 from the python website, and it worked just fine. However, I had a great deal of trouble installing packages. The final straw was when I "successfully" installed numpy, but then I got a string of error messages when trying to import it in IDLE. I decided to try to re-install python, so I deleted python 3.7 and re-installed the same version from the same place.
However, when I tried typing "python3" in the Terminal, I got: "Segmentation Fault: 11". I researched it and understood that it had to do something with memory, so I must have uninstalled/installed wrong. However, I tried typing "python3" again, and got "Illegal Instruction: 4". After several tries, this is the only message I get anymore, and the segmentation fault does not appear.
I have no idea what I'm doing, and I don't know where to start. All I really know is that I've made a mess of the situation. I realize the solution might appear obvious, but I am completely inexperienced and in the dark right now. Thank you for reading this, I hope I can learn from you.
(Please ask for any and all information you might need, as I also don't know what exactly you might want to know.)
EDIT:
I realized when I re-installed Python, I had installed the macOS 10.9+ version. I uninstalled it and installed the correct version (10.6+). IDLE works and so does pip, but now I am getting the original error when I try to import numpy.
This is what I get:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/__init__.py", line 148, in <module>
from . import fft
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/fft/__init__.py", line 6, in <module>
from .fftpack import *
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/fft/fftpack.py", line 44, in <module>
from . import fftpack_lite as fftpack
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/fft/fftpack_lite.cpython-37m-darwin.so, 2): Symbol not found: ___sincos_stret
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/fft/fftpack_lite.cpython-37m-darwin.so
Expected in: /usr/lib/libSystem.B.dylib
in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/numpy/fft/fftpack_lite.cpython-37m-darwin.so```

Post-Caffe install, Ubuntu 16.04 - /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

I am brand new to Linux and have a new PC with Ubuntu 16.04. I am trying to install Caffe using this guide (as well as many others for troubleshooting, but this one is focused on Python 3):
https://yangcha.github.io/Caffe-Conda3/
After days of troubleshooting various errors, and inadequacies on my part, I have finally been able to make and install Caffe, with the caveat that I get this one flag
- Could NOT find Boost
-- Boost version: 1.58.0
-- Found the following Boost libraries:
-- python-py35
I have Anaconda with Python 3.6.3 so I'm not sure why it grabbed 3.5, but the cmake output lists Python 3.5.2 as the interpreter. It also detects Cuda and cudnn and passes the make runtest just fine.
However, when I try to test my pycaffe with
python -c "import caffe;print(caffe.__version__)"
I get the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/caffe-rc5/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, RMSPropSolver, AdaDeltaSolver, AdamSolver, NCCL, Timer
File "/usr/local/caffe-rc5/python/caffe/pycaffe.py", line 13, in <module>
from ._caffe import Net, SGDSolver, NesterovSolver, AdaGradSolver, \
ImportError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name
I found these discussions:
Import cv2 error python
Caffe installation in ubuntu 17.04: Import Error: /usr/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name
https://groups.google.com/forum/#!msg/caffe-users/6K6zxt0RaHg/0CegZ7TyCQAJ
But have been unable to reproduce the various suggested solutions. Note that I strongly prefer to not uninstall Anaconda, and I absolutely, 100%, want nothing to do with python2.
Could somebody please help me find a workaround for this? I'm hoping it's trivial for somebody less Linux-challenged. I apologize in advance for the explicit instructions I might need, as I have only been learning Linux for about a week and am still in very unfamiliar territory. But I'm unfortunately on a timeline for making progress on a CNN project, so I'd really like to get Caffe up and running (albeit per the above conditions; as a passing thought I'd also love to fix the Boost flag and hopefully use python 3.6, but whatever I can do to avoid python2 is fine).
Please let me know if any other information or files might help. Here is a link to my Makefile.config (as far I can tell my Python paths are correct, but again this is all very strange and unfamiliar to me, so it wouldn't surprise me to find out I've gone horribly wrong somewhere).
Makefile.config

Python 3.6 not finding modules that Python 3.5 can find

I am trying to make a discord bot based on this repository https://github.com/sleibrock/discord-bots
It uses Python 3.6, but when I try to use it I get the error
Traceback (most recent call last):
File "Bot.py", line 9, in <module>
from discord.py import Client, Game
ModuleNotFoundError: No module named 'discord'
In python3.5 >>>import discord runs fine.
In python3.6 >>>import discord gives the same error as above.
Any help would be appreciated.
edit: I copied all files from /usr/lib/python3.5/site-packages and /usr/lib64/python3.5/site-packages to the python3.6 counterparts which seems to have fixed the problem. It seems like it wasn't installing anything into the python3.6 folders and was checking the 3.5 folders, making something break with the import.
Python allows for different versions being installed independently of each other. Each one will have its own packages, which make sense because some packages require a minimal (or specific) version, and packages for Python2 could not work in Python3. In addition, packages using compiled C library will be different between 32bits and 64 bits versions.
It is a feature, because it allows you to install some packages only for one of the different versions you have on your system, but it also mean that you have to install them in all the versions you want to use with them.

Python 3.3 + pygame installation

First, I am aware about the existance of a similar older thread, but honestly, I would not ask, if I found any help there.
Being a simple coding enthusiast, I want to playback media in using python. Since there seems to be no simple solution, a lot of people recommend pygame (or pyglet). So, using win 7 x64, I revert to 32bit Python 3.3.5 and download the presumably correct version of pygame from the super secret download site (pygame-1.9.2a0.win32-py3.3). Both installations work seemingly fine, pygame can locate python (path is set correctly), and finishes its install without issues, yet it seems not to install anything. I cannot import pygame, there are no installed libraries to be found. In pure frustration I tried different iterations of versions, python 2.7, x64, older pygame versions. Nothing worked. I suspect, there is something going on, that may not be connected to the pygame installation, but I don't know what.
import pygame
returns
Traceback (most recent call last):
File "C:/***/pygame_test.py", line 1, in <module>
import pygame
ImportError: No module named 'pygame'
Try using Python 3.2.3 instead of 3.3, along with Pygame for that version: that's what I did, and it works flawlessly on the same system as yours.
You should check up with your installation. Are you sure you installed properly. I have checked on 3.4/3.6/2.7 all works fine. Just install the correct binaries based on your system from http://www.lfd.uci.edu/~gohlke/pythonlibs/.
Download pygame using pip, to be sure that the module is placed in the correct path. Else, put the pygame folder in .\pythonX\Lib\site-packages\. Verify the folder is named pygame and not for example pygame-1.9.2a0.win32-py3.3.

Resources