Pip3 install pygame not working - installation

I have a Macbook running OS X 10.6 and I am trying to install pygame using pip3 install pygame.
Using python 3.7 and pip 18.0.
Below are the errors from the console.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-install-ftjsil2g/pygame/setup.py", line 609, in <module>
setup(**PACKAGEDATA)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run
_build_ext.run(self)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 309, in run
customize_compiler(self.compiler)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/sysconfig.py", line 170, in customize_compiler
_osx_support.customize_compiler(_config_vars)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/_osx_support.py", line 418, in customize_compiler
_find_appropriate_compiler(_config_vars)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/_osx_support.py", line 191, in _find_appropriate_compiler
"Cannot locate working compiler")
SystemError: Cannot locate working compiler
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-install-ftjsil2g/pygame/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-record-vgz3goci/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/Z6/Z6RVS9IMHG4+tkl202dsTU+++TM/-Tmp-/pip-install-ftjsil2g/pygame/
Edit: Fixed formatting!

So I don't entirely understand what's going on with your error messages but I would recommend checking out this article as it covers setting up Pygame on Mac OSX 10.6-10.9 pretty well.
http://brysonpayne.com/2015/01/10/setting-up-pygame-on-a-mac/
If the above doesn't work, then follow the instructions bellow.
Note: I am covering every step so just skip the ones you have already done
Step 1: Install Python 3 and Pip
Download Python 3.7 here: Python 3.7.0.
Run the installer and make sure to select pip (I can't remember if this is optional or not).
Step 2: Install Pygame
Run the following command to install Pygame with pip:
python3 -m pip install -U pygame --user
Step 3: Test Pygame Installation
Run this command to test if Pygame installed correctly:
python3 -m pygame.examples.aliens

At the moment, 5/1/2020, you cannot install the pygame libraries in python 3.8 with pip install pygame, but you can install them with a particular version of them, still for dev.
You can install Python 3.8 in the command line using this version:
*pip install pygame==2.0.0.dev6*
Latest version:
*pip install pygame==2.0.0.dev10*
And you can check it with
Terminal:
$ python3
>>import pygame
pygame 2.0.0.dev10 (SDL 2.0.12, python 3.8.2)
Hello from the pygame community. https://www.pygame.org/contribute.html

Related

pip3 TypeError: deprecated() got an unexpected keyword argument 'name' [duplicate]

I am trying to install few packages and started getting an error. Then used multiple commands in ubuntu to update few things but errors are similar
pip install -U pip setuptools
or
python3 -m pip install --upgrade pip
or
sudo -H pip3 install --upgrade pip
Following is the error sample
user#machine:~$ pip install cryptography
Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
load_entry_point('pip==20.0.2', 'console_scripts', 'pip')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/usr/lib/python3/dist-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 65, in <module>
vendored("cachecontrol")
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
.
.
.
.
File "<frozen zipimport>", line 259, in load_module
File "/usr/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 46, in <module>
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import SSL, crypto
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/SSL.py", line 19, in <module>
from OpenSSL.crypto import (
File "/home/dhome/.local/lib/python3.8/site-packages/OpenSSL/crypto.py", line 3224, in <module>
utils.deprecated(
TypeError: deprecated() got an unexpected keyword argument 'name'
I have updated the system with apt-get install libffi-dev python-dev python3-dev and
apt-get install build-essential libssl-dev already as suggested in here
Something got broken down in OpenSSL and no command was working with pip afterwards. I was even unable uninstall pip.
I removed installation files manually (most likely not a recommended approach) with
sudo rm -rf /usr/local/lib/python3.8/dist-packages/OpenSSL
sudo rm -rf /usr/local/lib/python3.8/dist-packages/pyOpenSSL-22.1.0.dist-info/
and reinstalled using pip3 install pyOpenSSL==22.0.0. The other version was having some issue as described here.
For me even uninstall of pyOpenSSL was encountering same error TypeError: deprecated() got an unexpected keyword argument 'name'
so first I upgraded pip to 23.0 ,uninstall PyOpenSSL,manually deleted openSSL folder from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages then installed PyOpenSSL 20.0.0, finally issue resolved.

problems installing pip3 install virtualenvwrapper

I am using ubuntu 16.04, what and installed for the first time and I try to install pip3 install virtualenvwrapper for it tells me to install first sudo apt install python3-pip once you install it I run the command pip3 install virtualenvwrapper but it generates the following error.
Collecting virtualenvwrapper
Downloading https://files.pythonhosted.org/packages/c1/6b/2f05d73b2d2f2410b48b90d3783a0034c26afa534a4a95ad5f1178d61191/virtualenvwrapper-4.8.4.tar.gz (334kB)
100% |████████████████████████████████| 337kB 233kB/s
Complete output from command python setup.py egg_info:
Couldn't find index page for 'pbr' (maybe misspelled?)
No local packages or download links found for pbr
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-xwa__f7e/virtualenvwrapper/setup.py", line 7, in <module>
pbr=True,
File "/usr/lib/python3.5/distutils/core.py", line 108, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 269, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 826, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1092, in best_match
return self.obtain(req, installer)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1104, in obtain
return installer(requirement)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 380, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 657, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pbr')
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-xwa__f7e/virtualenvwrapper/

Lektor installation fails on Linux

Lektor crashes on installation on Linux (Mint 19 and Raspbian-armv7l 2018-10) with a 'File not found error'
Python 2.7 and 3.5 are installed.
sudo apt-get install python-dev libssl-dev libffi-dev OK
sudo apt-get install imagemagick OK
curl -sf https://www.getlektor.com/install.sh | sudo sh
This script will install Lektor on your computer.
Installing at:
bin: /usr/local/bin
app: /usr/local/lib/lektor
Continue? [Yn] y -> CRASH !
/usr/bin/python: can't open file './virtualenv.py': [Errno 2] No such file or directory
Traceback (most recent call last):
File "<stdin>", line 148, in <module>
File "<stdin>", line 143, in main
File "<stdin>", line 107, in install
File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
This is a known issue with your version of Lektor:
https://github.com/lektor/lektor/issues/619
WORKAROUND:
For my system, install.sh worked after changing line 124 to this:
Popen([sys.executable, './src/virtualenv.py', lib_dir], cwd=t).wait()

Pip errors after upgrading

After upgrading to pip 18.1 whenever I try to do anything with pip I get this import error:
Traceback (most recent call last):
File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python37\Scripts\pip.exe\__main__.py", line 5, in <module>
ImportError: cannot import name 'main' from 'pip' (C:\Users\asbwi\AppData\Roaming\Python\Python37\site-packages\pip\__init__.py)
pip3 install --upgrade pip setuptools --user
This should solve your issue with pip
or
python -m pip install --upgrade pip==9.0.3 [ This will downgrade the pip version ]
Check the pip version using "**pip --version**"

Cannot install PyMySQL locally within a virtual environment [Errno 13] Permission denied

I'm trying to safely install PyMySQL. I've read many good arguments about why sudo pip install should be avoided, but sometimes it just seems impossible to get away from.
Is there a way to install PyMySQL locally in OSX without using sudo?
(VirtualEnv) : ^.^ :pip install --no-cache-dir --user PyMySQL
Collecting PyMySQL
Downloading PyMySQL-0.8.0-py2.py3-none-any.whl (83kB)
100% |████████████████████████████████| 92kB 1.8MB/s
Installing collected packages: PyMySQL
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip/wheel.py", line 247, in move_wheel_files
prefix=prefix,
File "/Library/Python/2.7/site-packages/pip/locations.py", line 153, in distutils_scheme
i.finalize_options()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 346, in finalize_options
self.create_home_path()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 565, in create_home_path
os.makedirs(path, 0700)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Users/TomNason/Library/Python/2.7'
To install within a virtual env run this command.
pip install --install-option="--prefix=/Users/TomNason/VirtualEnv/lib/python2.7" PyMySQL
Generally- if you cannot install PyMySQL with pip inside a virtual environment (even if you are using the --user option) you can try...
pip install --install-option="--prefix=PATH_TO_YOUR_VIRTUAL_ENV_DIR/lib/PYTHON_VERSION" PyMySQL
This is still a curious situation for me. Any comments on why I would have to explicitely state my python directory are welcome. I thought that the reason for using a virtual environment was that pip will always choose to install there.

Resources