How can i solve my error during importing pygame [duplicate] - python

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).

Related

pip3 on python3.9 fails on 'HTMLParser' object has no attribute 'unescape' [duplicate]

This question already has answers here:
Why is 'pip3 install netifaces' failing on Debian 10 Buster?
(4 answers)
Closed 2 years ago.
After installing (ubuntu) python3.9, installing some packages with pip failes on:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 14, in <module>
from setuptools.dist import Distribution, Feature
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 24, in <module>
from setuptools.depends import Require
File "/usr/lib/python3/dist-packages/setuptools/depends.py", line 7, in <module>
from .py33compat import Bytecode
File "/usr/lib/python3/dist-packages/setuptools/py33compat.py", line 54, in <module>
unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)
AttributeError: 'HTMLParser' object has no attribute 'unescape'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
After some trial and error I upgraded, pip, distlib and setuptools and it solved it. Not sure which of those is causing it. (On the last two I found issues 1 2 of other sites)
It is caused by removing unescape from HTMLParser in python3.9, which seems to break setuptools.
pip3 install --upgrade setuptools
If it does not work, try also:
pip3 install --upgrade pip
pip3 install --upgrade distlib
Note from #seb comment: The default pip3 may not be the python you are using. If so, try pip of your specific version used (e.g. pip3.9)

How to install pygame on msys2?

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

can not install specific version of nltk

for a specific reason I need to install nltk 2.09b in python 2.7 version. But whenever I execute the following command,
pip2 install nltk==2.0b9
I get the following error:
Collecting nltk==2.0b9
Using cached https://files.pythonhosted.org/packages/ea/b3/4c5157bf034437905fbbd3c80e58c8b4a22cf3400db0bdf19dae3079a732/nltk-2.0b9.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/var/folders/3b/yskb8jks10lf_pqvv1sy7v740000gn/T/pip-install-63jdDZ/nltk/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3b/yskb8jks10lf_pqvv1sy7v740000gn/T/pip-install-63jdDZ/nltk/
But if I run without any version specification I don't get an error. like the following:
pip2 install nltk;
How can I solve this issue?
First thing: using anaconda, you probably have a recent enough pip and setuptools and should use conda itself to update those. With anaconda, conda install is the primary resource for installing anaconda-provided packages. Then, "2.0b9" is a beta release (as indicated by the "b9") and might suffer from a configuration problem for the install. The setup.py file is not located at the root of the downloaded archive file, I suppose that creates the problem.
Use this
pip3.6 install nltk==version

Read the Docs: Distutils2 error during installation

I try to install local instance of Read the Docs on my Win10
When I follow this documentation:
http://docs.readthedocs.io/en/latest/install.html
and type:
pip install -r requirements.txt
I get this error:
Collecting Distutils2==1.0a3 (from -r requirements/pip.txt (line 65))
Using cached Distutils2-1.0a3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\setup.py", line 9, in <module>
from distutils2.util import find_packages
File "C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\distutils2\util.py", line 174
except KeyError, var:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\USER\AppData\Local\Temp\pip-build-xseiavup\Distutils2\
Anyone know this error?
My pip version: 8.1.2;
python: 3.5
Is it possible you are running the Python 2 pip? The error message clearly indicates that the code is being executed under Python 3 but has Python 2 syntax. Do you get better results with
python -m pip install -r requirements.txt
I wonder? If not then verify that
python
runs version 3.5 ...
Oh. I just checked and the disutils2 page on PyPI says
Distutils2 development is stopped.
tl;dr: keep using setuptools and pip for now, don’t use distutils2.
It looks like there was never a Python 3 version. Looks like you might need to update your code.

pip install hyperopt and hyperas fail

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

Categories

Resources