Update: Pygame >=1.9.2 should be installable via pip
…
…for the major platforms (Windows included).
According to the Getting Started guide, the steps for installation should be as simple as what the OP had attempted (way back in 2016):
pip install --user pygame
After installation, you can check if it was installed correctly by running one of the examples:
python -m pygame.examples.aliens
Why didn’t this work before?
I was kinda curious as to why the OP was unable to install pygame
back when this question was asked, so I looked into the history of pygame
releases on pypi and noticed that the latest version available as of May 2016 would have been version 1.8.1
, which was released in 2008 (yikes).
Not only that, but it didn’t have any installable wheels, which explains why the OP contains that error from pip about being unable to find any versions to download.
Previous Answer (Still kinda relevant)
See this link which provides windows binaries ready for installation (but only for pygame versions less than 2.0.0)pygame
is not distributed via pip
.
…Or follow the following instructions for manual installation of pygame (version 1.9.4 and higher)
- Install python
- Make sure you have python on your PATH
- Download the appropriate wheel from this link
- Install pip using this tutorial
- Finally, use these commands to install pygame wheel with pip
-
Python 2 (usually called pip)
pip install file.whl
-
Python 3 (usually called pip3)
pip3 install file.whl
Sometimes you get an error when you’re trying to install a Python package
using pip. It looks like this:
Could not find a version that satisfies the requirement (from versions:)
No matching distribution found for
Some probable reasons for this error are:
-
PyPI server isn’t responding to your requests. It can happen either because
the PyPI server is down or because it has blacklisted your IP address. This
happened to me once when I was trying installing packages on a server.
This can be fixed by using a proxy with pip. See the solution below. -
You’re running an older pip (especially on Mac). This can be fixed by
upgrading your pip.
See this post on Stack Overflow.
Thanks to Anupam Jain who pointed this in a comment. -
The package you’re trying to install is not available for your Python version.
-
The package is not available for your operating system. This is a rare case
and only happens when the package is not pure-Python, i.e. it’s been
partially written in C or Cython. Such a package needs to be compiled for
every operating system (Windows/Mac/Linux) and architecture (32-bit/64-bit).
Suppose a package has only been compiled for Windows 64-bit, then you’ll get
this error if you try to install it on Windows 32-bit, or any other
OS. -
The package is not present on PyPI server. In this case pip will not work. So
you’ll have to download and install the package manually from Github or wherever
it is available.
Solution¶
I had this issue because PyPI server had blacklisted the IP
of my hosting provider, the obvious solution was to make pip
install via a proxy.
But to see if that’s also the case with you, you can test it like this:
$ curl https://pypi.org
The requestors Network has been blacklisted due to excessive request volume.
If you are a hosting customer, please contact your hosting company's support.
If you are the hosting company, please contact infrastructure-staff@python.org to resolve
If you see the message similar to above, that means your IP has also been
blacklisted by https://pypi.org.
If you don’t see this message then the reason for the pip error could be that you’re using
an older version. See this post on Stack Overflow
for a solution.
Anyways, this can be fixed by using a proxy with pip.
Supplying a proxy address to pip
is easy:
$ pip install -r requirements.txt --proxy address:port
Above, address
and port
are IP address and port of the proxy.
To find proxies, just search Google for proxy list.
Other things that I tried¶
These are some other things that I tried to get rid of this issue.
Although they didn’t work for me, but they might work for you.
- Changing DNS resolver of my server.
This makes sense if your server’s DNS resolver can’t find PyPI servers. - Reconfiguring SSL, reinstalling CA certificates.
This makes sense if you don’t have updated CA certificates which are used by
PyPI servers. - Downloading packages using
wget
.
This is an alternative way to install Python packages. Download them viawget
and then install them usingpython setup.py install
. In my case, the server was
blacklisted by PyPI so I was getting a 403 Forbidden error. - Downloading packages using
curl
.
Alternative towget
. In my case I didn’t get a 403 error but rather it just
created invalid tarball files, instead of actually downloading them. - Downloading packages using
git
orhg
.
If your desired packages havegit
orhg
repositories that you can clone, this
is a good workaround.
Every time i try and download pygame, this is what i get:
C:Users——>python3 -m pip install pygame==2.0.2.dev2
Collecting pygame==2.0.2.dev2
Downloading pygame-2.0.2.dev2.tar.gz (5.7 MB)
|████████████████████████████████| 5.7 MB 1.3 MB/s
ERROR: Command errored out with exit status 1:
command: ‘C:Users——AppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0python.exe’ -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:Users——AppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912setup.py'»‘»‘; file='»‘»‘C:Users——AppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912setup.py'»‘»‘;f = getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file) if os.path.exists(file) else io.StringIO(‘»‘»‘from setuptools import setup; setup()'»‘»‘);code = f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ egg_info —egg-base ‘C:Users——AppDataLocalTemppip-pip-egg-info-10n8kp0k’
cwd: C:Users——AppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912
Complete output (79 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:Users-----AppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912setup.py", line 322, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:Users-----AppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912buildconfigconfig.py", line 221, in main
deps = CFG.main(**kwds)
File "C:Users-----AppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912buildconfigconfig_win.py", line 574, in main
return setup_prebuilt_sdl2(prebuilt_dir)
File "C:UsersSilasAppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912buildconfigconfig_win.py", line 499, in setup_prebuilt_sdl2
DEPS.configure()
File "C:UsersSilasAppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912buildconfigconfig_win.py", line 336, in configure
from . import vstools
File "C:UsersSilasAppDataLocalTemppip-install-85ltizv2pygame_5aecdc50663342dfbd64a44c04743912buildconfigvstools.py", line 11, in <module>
compiler.initialize()
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.10_3.10.194.0_x64__qbz5n2kfra8p0libdistutilsmsvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.10_3.10.194.0_x64__qbz5n2kfra8p0libsite-packagessetuptoolsmsvc.py", line 140, in msvc9_query_vcvarsall
return EnvironmentInfo(arch, ver).return_env()
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.10_3.10.194.0_x64__qbz5n2kfra8p0libsite-packagessetuptoolsmsvc.py", line 1740, in return_env
[self.VCIncludes,
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.10_3.10.194.0_x64__qbz5n2kfra8p0libsite-packagessetuptoolsmsvc.py", line 1282, in VCIncludes
return [join(self.si.VCInstallDir, 'Include'),
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.10_3.10.194.0_x64__qbz5n2kfra8p0libsite-packagessetuptoolsmsvc.py", line 840, in VCInstallDir
raise distutils.errors.DistutilsPlatformError(msg)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.2 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
Making dir :prebuilt_downloads:
Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.16-VC.zip 13d952c333f3c2ebe9b7bc0075b4ad2f784e7584
Unzipping :prebuilt_downloadsSDL2-devel-2.0.16-VC.zip:
Downloading... https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip 137f86474691f4e12e76e07d58d5920c8d844d5b
Unzipping :prebuilt_downloadsSDL2_image-devel-2.0.5-VC.zip:
Downloading... https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip 1436df41ebc47ac36e02ec9bda5699e80ff9bd27
Unzipping :prebuilt_downloadsSDL2_ttf-devel-2.0.15-VC.zip:
Downloading... https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip 9097148f4529cf19f805ccd007618dec280f0ecc
Unzipping :prebuilt_downloadsSDL2_mixer-devel-2.0.4-VC.zip:
Downloading... https://www.ijg.org/files/jpegsr9d.zip ed10aa2b5a0fcfe74f8a6f7611aeb346b06a1f99
Unzipping :prebuilt_downloadsjpegsr9d.zip:
Downloading... https://pygame.org/ftp/prebuilt-x64-pygame-1.9.2-20150922.zip 3a5af3427b3aa13a0aaf5c4cb08daaed341613ed
Unzipping :prebuilt_downloadsprebuilt-x64-pygame-1.9.2-20150922.zip:
copying into .prebuilt-x64
Path for SDL: prebuilt-x64SDL2-2.0.16
...Library directory for SDL: prebuilt-x64/SDL2-2.0.16/lib/x64
...Include directory for SDL: prebuilt-x64/SDL2-2.0.16/include
Path for FONT: prebuilt-x64SDL2_ttf-2.0.15
...Library directory for FONT: prebuilt-x64/SDL2_ttf-2.0.15/lib/x64
...Include directory for FONT: prebuilt-x64/SDL2_ttf-2.0.15/include
Path for IMAGE: prebuilt-x64SDL2_image-2.0.5
...Library directory for IMAGE: prebuilt-x64/SDL2_image-2.0.5/lib/x64
...Include directory for IMAGE: prebuilt-x64/SDL2_image-2.0.5/include
Path for MIXER: prebuilt-x64SDL2_mixer-2.0.4
...Library directory for MIXER: prebuilt-x64/SDL2_mixer-2.0.4/lib/x64
...Include directory for MIXER: prebuilt-x64/SDL2_mixer-2.0.4/include
Path for PORTMIDI: prebuilt-x64
...Library directory for PORTMIDI: prebuilt-x64/lib
...Include directory for PORTMIDI: prebuilt-x64/include
DLL for SDL2: prebuilt-x64/SDL2-2.0.16/lib/x64/SDL2.dll
DLL for SDL2_ttf: prebuilt-x64/SDL2_ttf-2.0.15/lib/x64/SDL2_ttf.dll
DLL for SDL2_image: prebuilt-x64/SDL2_image-2.0.5/lib/x64/SDL2_image.dll
DLL for SDL2_mixer: prebuilt-x64/SDL2_mixer-2.0.4/lib/x64/SDL2_mixer.dll
DLL for portmidi: prebuilt-x64/lib/portmidi.dll
Path for FREETYPE not found.
...Found include dir but no library dir in prebuilt-x64.
Path for PNG not found.
...Found include dir but no library dir in prebuilt-x64.
Path for JPEG not found.
...Found include dir but no library dir in prebuilt-x64.
DLL for freetype: prebuilt-x64/SDL2_ttf-2.0.15/lib/x64/libfreetype-6.dll
---
For help with compilation see:
https://www.pygame.org/wiki/CompileWindows
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/a9/7c/d6d95935e801cf83566ee34b2f597a8214e340466b0364b4db5a2f05bc16/pygame-2.0.2.dev2.tar.gz#sha256=8d5ffc089075b68ca948a88c0678a9d6bf5fed69676fee221fb562f4a788611b (from https://pypi.org/simple/pygame/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pygame==2.0.2.dev2 (from versions: 1.9.2rc1, 1.9.2, 1.9.3, 1.9.4.dev0, 1.9.4rc1, 1.9.4, 1.9.5rc1, 1.9.5rc2, 1.9.5, 1.9.6rc1, 1.9.6rc2, 1.9.6, 2.0.0.dev1, 2.0.0.dev2, 2.0.0.dev3, 2.0.0.dev4, 2.0.0.dev6, 2.0.0.dev8, 2.0.0.dev10, 2.0.0.dev12, 2.0.0.dev14, 2.0.0.dev16, 2.0.0.dev18, 2.0.0.dev20, 2.0.0.dev22, 2.0.0.dev24, 2.0.0, 2.0.1.dev1, 2.0.1, 2.0.2.dev2)
ERROR: No matching distribution found for pygame==2.0.2.dev2
i’ve tried different versions, commands, etc and nothing works.
i need help
I have seen a few related questions, and I’ve tried all of their recommendations:
- I’m using anaconda, so I downgraded from 3.7 to 3.6
- I upgraded pip using curl https://bootstrap.pypa.io/get-pip.py | sudo python
- I installed the latest version of openssl (1.1.1)
- I updated all Anaconda libraries
- I am connected to the Internet (obviously, since I’m posting here) and not behind a firewall.
And yet, every time I run «pip install » or «pip install ==» I get the following error:
ERROR: Could not find a version that satisfies the requirement (from versions: none)
ERROR: No matching distribution found for
I’m on a Mac, Mojave v10.14.4
I recently installed prodigy.ai, which seemed to replace a bunch of packages with (perhaps) older versions, but I still cannot figure out how to fix this issue. The one thing I haven’t tried is uninstalling Anaconda and reinstalling it.
Thanks for any help on this.
asked Apr 26, 2019 at 18:10
11
Yes, it happened to me also.
A common case in this procedure is to check if you have not made a typo when entering the package name.
answered Jun 18, 2019 at 9:15
simhumilecosimhumileco
6577 silver badges14 bronze badges
Original: https://lwebapp.com/en/post/pip-install-error-guide
Question
When we use Python to develop, we usually use some useful third-party libraries. It is recommended to use pip to install, such as installing pandas
python -m pip install pandas
Enter fullscreen mode
Exit fullscreen mode
Under normal circumstances, there is no problem, but some small partners will encounter installation failures such as pip installation of third-party libraries and errors, pip install stuck and other installation failures.
For example, the following is the code that pip installs a third-party library to report an error
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...
Enter fullscreen mode
Exit fullscreen mode
I will summarize here the solutions for the failure of Python to install third-party libraries.
Solution
Option 1
The Python environment factor reports an error, check whether Python and pip under your computer are installed normally
# Print the current Python version
python --version
Enter fullscreen mode
Exit fullscreen mode
If the Python version information is printed out normally after running the above command, it means that it is normal. If an error is reported, it may be that the environment variables are not configured when installing Python under Windows. You can configure the Python environment variables, or directly reinstall Python to the C drive, so that there will be no problem with environment variables.
# print pip version
python -m pip --version
Enter fullscreen mode
Exit fullscreen mode
If the pip version information is printed out normally after running the above command, it means that it is normal. If an error is reported, you can use this command to install and upgrade
python -m ensurepip --upgrade
Enter fullscreen mode
Exit fullscreen mode
If you can’t run pip yet, you can also install pip manually
- Open https://bootstrap.pypa.io/get-pip.py
- Right click on the page — save as — save anywhere
- Execute
python get-pip.py
on the command line of the directory where the get-pip.py file is located
Another advantage of manually installing pip is that you can directly use global pip to install dependent packages, such as
pip install pandas
Enter fullscreen mode
Exit fullscreen mode
Option 2
Although pip is installed normally, sometimes it will prompt you that the version of pip is too low
WARNING: You are using pip version 22.0.3; however, version 22.0.4 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Enter fullscreen mode
Exit fullscreen mode
Run the following command to upgrade pip
python -m pip install --upgrade pip
Enter fullscreen mode
Exit fullscreen mode
Option 3
The third-party package name or version number is entered incorrectly. For example, I install a package called padas
in the command line terminal
python -m pip install padas
Enter fullscreen mode
Exit fullscreen mode
The following error will appear
ERROR: Could not find a version that satisfies the requirement padas (from versions: none)
ERROR: No matching distribution found for padas
Enter fullscreen mode
Exit fullscreen mode
The error tells me that I typed padas
, that the package and its version number cannot be found. At this time, you need to check whether the package name is entered correctly, the correct one should be pandas
. (Of course, after the article is published, some developers may have released this package, which is only for demonstration)
There is also a problem that the version number may not exist. For example, I install a higher version of pandas
python -m pip install pandas==6.5
Enter fullscreen mode
Exit fullscreen mode
The following error will appear
ERROR: Could not find a version that satisfies the requirement pandas==6.5 (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0 , 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12 .0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1 , 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23 .0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0 , 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2 .1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.0rc0, 1.4.0 , 1.4.1)
ERROR: No matching distribution found for pandas==6.5
Enter fullscreen mode
Exit fullscreen mode
Obviously, this version number cannot be found, and it tells you all the version numbers that can be installed. We only need to select a version number that we need, or install the latest version by default without specifying a version number.
Option 4
The network quality and communication speed are different in different place, and the pip installation of dependencies will also encounter network timeout problems, such as the following errors
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.org', port=443): Read timed out.
Enter fullscreen mode
Exit fullscreen mode
It indicates that the network has timed out, and there is a problem connecting to pypi.org
. This is the website hosting the python dependencies, and all pip packages are published on it.
We can set a longer timeout, because the network in most places is not completely unconnectable, but the speed is a bit slow. Here the --default-timeout
is set to 200s
python -m pip --default-timeout=200 install pandas
Enter fullscreen mode
Exit fullscreen mode
Set a little more timeout, go have a cup of tea and wait for a while, and it may be downloaded.
Option 5
If you haven’t downloaded it after drinking tea, then consider changing the mirror source. For example, we switch to the mirror source of Tsinghua University.
# --index-url can be abbreviated as -i
python -m pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ pandas
Enter fullscreen mode
Exit fullscreen mode
In addition to the official source and Tsinghua mirror source
- Tsinghua:
https://pypi.tuna.tsinghua.edu.cn/simple/
- Official:
https://pypi.org/
There are other mirror sources you can try
- Aliyun:
https://mirrors.aliyun.com/pypi/simple/
- Douban:
https://pypi.douban.com/simple/
- Beijing Foreign Studies University
https://mirrors.bfsu.edu.cn/pypi/web/simple/
Option 6
In addition to switching mirror sources, pip officially provides a variety of ways to install dependent packages
- Download the dependency package in advance, and then install it directly from the local path
For example, we can download the pandas distribution package file from the pip official website, and then execute the installation command in the directory where the local dependency package is located.
Install from Source Distribution
python -m pip install pandas-1.4.1.tar.gz
Enter fullscreen mode
Exit fullscreen mode
or install from Built Distributions
# Buildpacks for Windows platforms only
python -m pip install pandas-1.4.1-cp310-cp310-win_amd64.whl
Enter fullscreen mode
Exit fullscreen mode
List of all pandas distributions: pandas download files
- To install from any VCS (version control systems), use the following command format
python -m pip install -e "vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir"
Enter fullscreen mode
Exit fullscreen mode
- vcs: version control system name
- protocol: protocol
- repo_url: repository url
- egg: package name
- subdirectory: If the package is not in the project root directory, specify the subdirectory name
For example, install the pandas library directly from github
python -m pip install git+https://github.com/pandas-dev/pandas.git#egg=pandas
Enter fullscreen mode
Exit fullscreen mode
This method will pull the latest code from github for local construction, which takes a long time, and is usually the development version.
pip supports a lot of version control systems and protocols, see VCS Support
- Installation from github also supports manual local installation, clone the github repository of the dependent package directly, and execute it in the project directory
python setup.py install
Enter fullscreen mode
Exit fullscreen mode
In this way, the library built by this project is directly installed. In essence, it is similar to the remote method of using github. It needs to be compiled locally. It is usually used in the local development stage, or if you want to try the latest features of the project.
However, if you have network problems through pip install, this way of installing through github usually also has certain network problems.
Option 7
I have tried several of the above solutions, but none of them can perfectly meet my needs.
- Although a long timeout is set, sometimes the network is very slow, and no matter how long the timeout is, it is a waste of time.
- Compared with the official website, the mirror source has a slightly delayed synchronization time. The official
pypi.org
dependency package is the most stable. The same problem is also common in the npm package management of front-end development. The mirror source sometimes has unpredictable errors, and it is often fixed by switching to the official source (refer to NPM Install Error Guide). - If you directly download the source package to build, because many Python libraries are written by foreigners, the website is not in your country, the download speed is very slow when visiting other countries’ websites, downloading from github is just as slow (refer to GitHub Clone Is Very Slow).
We can consider some more scientific ways to surf the Internet to speed up access to the official website. After the acceleration, directly use pip install
to install any third-party library. Basically, it can be completed in a few seconds. There is no need to set a timeout period, no need to switch mirror sources, and no need to worry about the delay of the installation package version. If you want to download the source package from the pip official website or installing Python third-party libraries remotely using github is very fast.
In addition, there are the following benefits
- When you access some Python third-party library documents, you can also speed up access, such as pandas official website
https://pandas.pydata.org/
- When you go to github to learn the source code of open source projects, and use
git clone
to pull github open source projects, the speed is significantly improved - The technical documents searched by Google are often more accurate, and the top of the search results are the highly praised answers on stackoverflow, which are very useful
- Visit some other great tech sites
Recommend a more scientific way on this Official Website ➜
If you don’t understand, please refer to my Hard-earned Experience ➜
Reference
- pip Install Third-Party Library Error
- Python official website
- Python installation dependencies
- pip Installation
- NPM Install Reports an Error and Freezes, NPM Installation Guide
- Python install Github package, offline package and online package