I want to install pygame 1.9.6 on msys2 using pip for python2.7. The problem is that i'm getting an error when i try to install it with 'pip install pygame'.
This is the error:
Processing d:/msys64/home/desolaser/pygame-1.9.6.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:/users/desola~1/appdata/local/temp/pip-req-build-tn9xwt/setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "buildconfig/config.py", line 210, in main
deps = CFG.main(**kwds)
File "buildconfig/config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "buildconfig/download_win_prebuilt.py", line 303, in ask
'\nDownload prebuilts to "%s" and copy to %s? [Y/n]' % (download_dir, dest_str))
EOFError: EOF when reading a line
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:/users/desola~1/appdata/local/temp/pip-req-build-tn9xwt/
I tried doing the same in python3 with 'pip3 install pygame' but i get the same error.
It is possible to install pygame on msys2?
I had this error as well. You can install it from a wheel file.
First install wheel into python using pip.
pip install wheel
Go to this page
https://pypi.org/project/pygame/#files
or
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
They have built wheel files for pygame for 32 and 64 bit, depending on which type of python you have installed. So for 32-bit python version 3.7, on windows, you would download
pygame-1.9.6-cp37-cp37-win32.whl
Then install the wheel file
pip install C:/some-dir/pygame-1.9.6-cp37-cp37-win32.whl
Related
This is the full script:
(venv) ubuntu#ubuntu:~$ pip install wxPython
Collecting wxPython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-jlwwpkvj/wxpython_66c7996a596740a4b92c4f3a3724336d/setup.py", line 27, in <module>
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
File "/tmp/pip-install-jlwwpkvj/wxpython_66c7996a596740a4b92c4f3a3724336d/buildtools/config.py", line 30, in <module>
from attrdict import AttrDict
File "/home/ubuntu/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/attrdict/__init__.py", line 5, in <module>
from attrdict.mapping import AttrMap
File "/home/ubuntu/PycharmProjects/pythonProject/venv/lib/python3.10/site-packages/attrdict/mapping.py", line 4, in <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) ubuntu#ubuntu:~$
I think cause of the problem is virtuel machine. I can download packages on my host OS.
I am using UTM for ubuntu.
I try updating pip and setuptolls. I reinstalled differently ubuntu for multiple times.
I am searcing forums for weeks and still nothing.
You need to use an older version of Python (I am guessing 3.9). The best option is probably to set it up in virtualenv like this:
sudo apt update
sudo apt install python3.9
sudo apt-get install python3.9-dev python3.9-venv
python3.9 -m venv myenv
source venv/bin/activate
pip install wxPython
Try to download the wheel (*.whl) file for that package and then:
pip install <wheel file path>
This question already has answers here:
Unable to install pygame on Python via pip (Windows 10)
(6 answers)
Closed 2 years ago.
I try to install pygame in my pycharm Terminal using pip install pygame, but i got this error you can see beneath
Collecting pygame
Using cached https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x86"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\lvdbruinhorst\AppData\Local\Temp\pip-install-ja0kww2k\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\lvdbruinhorst\AppData\Local\Temp\pip-install-ja0kww2k\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\lvdbruinhorst\AppData\Local\Temp\pip-install-ja0kww2k\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\lvdbruinhorst\AppData\Local\Temp\pip-install-ja0kww2k\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\lvdbruinhorst\AppData\Local\Temp\pip-install-ja0kww2k\pygame\
i also make a path in my systemvariables
I tried to install pygame from the PyCharm Terminal and it worked for me so there must be a different problem. Try to install this wheel file
pygame-1.9.6-cp27-cp27m-macosx_10_11_intel.whl, and then go to the directory it is installed and run python -m pip install pygame-1.9.6-cp27-cp27m-macosx_10_11_intel.whl in the command prompt or pycharm's terminal
If you have multiple python versions you should use py -3.X -m pip install pygame-1.9.6-cp27-cp27m-macosx_10_11_intel.whl.
If that doesn't work try updating pip wheel and setuptools.
python -m pip install --upgrade pip wheel setuptools
If anyone has a better answer or knows what the problem is exactly please post it (I'm just guessing what could have gone wrong).
When I run
sudo pip3 install PyAutoGUI
I receive the following error
[root#localhost Projects]# sudo pip install pyautogui
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip install --user` instead.
Collecting pyautogui
Using cached PyAutoGUI-0.9.36.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-ywXbn7/pyautogui/setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "pyautogui/__init__.py", line 115, in <module>
from . import _pyautogui_x11 as platformModule
File "pyautogui/_pyautogui_x11.py", line 7, in <module>
from Xlib.display import Display
ImportError: No module named Xlib.display
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ywXbn7/pyautogui/
I have followed other troubleshooting advice by installing Pillow and Display and using just the pip command.
I have also attempted installation of PyAutoGUI by cloning the package from GitHub and installing that way, however the following error message is returned:
[root#localhost Projects]# git clone https://github.com/asweigart/pyautogui
Cloning into 'pyautogui'...
remote: Counting objects: 1079, done.
remote: Total 1079 (delta 0), reused 0 (delta 0), pack-reused 1079
Receiving objects: 100% (1079/1079), 2.03 MiB | 697.00 KiB/s, done.
Resolving deltas: 100% (733/733), done.
[root#localhost Projects]# cd pyautogui
[root#localhost pyautogui]# sudo python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 6, in <module>
version=__import__('pyautogui').__version__,
File "/home/luke/Projects/pyautogui/pyautogui/__init__.py", line 115, in <module>
from . import _pyautogui_x11 as platformModule
File "/home/luke/Projects/pyautogui/pyautogui/_pyautogui_x11.py", line 160, in <module>
_display = Display(os.environ['DISPLAY'])
File "/usr/local/lib/python3.6/site-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/usr/local/lib/python3.6/site-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/usr/local/lib/python3.6/site-packages/Xlib/protocol/display.py", line 129, in __init__
raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'No protocol specified\n'
I am following the instructions from Chapter 18 of Automate the Boring Stuff with the commands slightly altered to suit Fedora 27 Workstation.
This answer is tested on Fedora 30.
First install dependencies
sudo dnf install scrot
sudo dnf install python3-tkinter
sudo dnf install python3-devel.x86_64
Then install PyAutoGUI with pip (without sudo/root)
pip3 install --user python3-xlib
pip3 install --user pyautogui
Note:
PyAutoGUI seems to require X, which is not default in Ferodra 30, but can be chosen at the login screen. Look for Xorg.
(Side note: When installing software, it is recommended to use sudo, if you are logged on as root, there is no need for sudo)
I was trying to install hyperopt, but I got the following error:
Collecting hyperopt
Using cached hyperopt-0.0.2.tar.gz
Complete output from command python setup.py egg_info:
DEBUG:root:distribute_setup.py not found, defaulting to system setuptools
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-gmhldfe7/hyperopt/setup.py", line 119, in <module>
if package_data is None: package_data = find_package_data(packages)
File "/tmp/pip-build-gmhldfe7/hyperopt/setup.py", line 102, in find_package_data
for subdir in find_subdirectories(package):
File "/tmp/pip-build-gmhldfe7/hyperopt/setup.py", line 73, in find_subdirectories
subdirectories = os.walk(package_to_path(package)).next()[1]
AttributeError: 'generator' object has no attribute 'next'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-gmhldfe7/hyperopt/
And I got the same error when intalling hyperas. But I can install ggplot successfully by using pip command. I am using Ubuntu 14.04 and Python 3.5.
Thanks.
This is a bug in hyperopt. generator.next was renamed to generator.__next__ which can be invoked with next(generator) in Python3.
Here is the PEP detailing the change.
Looks like it was fixed in master but never released. You can install from git (which means github as well) by doing the following:
pip install git+https://github.com/hyperopt/hyperopt.git
I managed to install pip but when I use pip to install the downloaded wheel, it prints:
C:\Python34\Scripts\pip install pygame-1.9.2a0-cp34-none-win_amd64.whl
Requirement 'pygame-1.9.2a0-cp34-none-win_amd64.whl' looks like a filename, but the file does not exist
pygame-1.9.2a0-cp34-none-win_amd64.whl is not a supported wheel on this platform
The file is in the same folder (Scripts) with pip.
I did try to use the wheel tool too:
C:\Python34\Scripts\wheel install pygame-1.9.2a0-cp34-none-win_amd64.whl
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 358, in main
args.func(args)
File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 301, in install_f
args.wheel_dirs, args.force, args.list_files)
File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 202, in install
raise WheelError("No such wheel file: {}".format(req))
wheel.tool.WheelError: No such wheel file: pygame-1.9.2a0-cp34-none-win_amd64.whl
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python34\Scripts\wheel.exe\__main__.py", line 9, in <module>
File "C:\Python34\lib\site-packages\wheel\tool\__init__.py", line 361, in main
sys.stderr.write(e.message + "\n")
AttributeError: 'WheelError' object has no attribute 'message'
I use PowerShell, please help!
Use pip to install wheel files using the full path:
C:\Python34\Scripts\pip install C:\Python34\Scripts\pygame-1.9.2a0-cp34-none-win_amd64.whl
Without the path the name is seen as a requirement rather than a already-downloaded file. This should work for wheel files that support your current Python architecture. You can verify your architecture with:
C:\Python34\python.exe -c "import distutils.util; print(distutils.util.get_platform())"
This should print win_amd6. If it prints win32 instead, you have a 32-bit Python binary and need to pick a different wheel.
pip install pygame-1.9.2a0-cp27-none-win_amd64.whl
this worked on my computer with Python2.7.3(64bit) while other versions not worked.
Install wheel support for pip:
pip install wheel
Install the downloaded wheel:
pip install path/to/pygame-1.9.2a0-cp34-none-win_amd64.whl
I had to remove the 64bit python and install the 32bit version to solve this issue.
c:\python34\scripts\pip install c:\users\USER\downloads\pygame-1.9.2a0-cp34-none-win32.whl
Unpacking c:\users\USER\downloads\pygame-1.9.2a0-cp34-none-win32.whl
Installing collected packages: pygame
Successfully installed pygame
Cleaning up...
Worked fine with 32bit :)