I'm trying to install Pygame. I am running Windows 7 with Enthought Python Distribution. I successfully installed pip, but when I try to install Pygame using pip, I get the following error:
"Could not install requirement Pygame because of HTTP error HTTP error
400: Bad request for URL ..."
I can't find anything about this issue with a Google search, but I did find another Stack Overflow question that prompted the asker to use the following command:
pip install hg+http://bitbucket.org/pygame/pygame
This gave me the following error:
Cannot find command hg
I'm not sure what else to do, as everything I find with a Google search is for Mac, so I don't know how well I can follow those instructions on Windows.
Steps to install PyGame using pip
Install build dependencies (on linux):
sudo apt-get build-dep python-pygame
Install mercurial to use hg (on linux):
sudo apt-get install mercurial
On Windows you can use the installer: Download
Use pip to install PyGame:
pip install hg+http://bitbucket.org/pygame/pygame
If the above gives freetype-config: not found error (on Linux), then try sudo apt-get install libfreetype6-dev and then repeat 3.
Alternative way:
# Grab source
hg clone https://bitbucket.org/pygame/pygame
# Finally build and install
cd pygame
python setup.py build
sudo python setup.py install
Try doing this:
sudo apt-get install mercurial
sudo pip install hg+http://bitbucket.org/pygame/pygame
An update to this may be required, as it stands in version 1.9.1 it should simply install using:
pip install pygame
However, it look like there is a bug with their pypi repository, see:
https://bitbucket.org/pygame/pygame/issues/59/pygame-has-no-pypi-page-and-cant-be
So, if you want the most recent release, you have to point directly at the ftp file ala:
pip install http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz
I suppose this will be fixed in the 1.9.2 release but for now this works.
I would note that the answer supplied by Pratyush works as well, but requires the user to install mercurial if they don't have it and downloads the trunk version, so really, not ideal unless you absolutely need it.
Caveat: I'm not familiar with the Enthought Distribution, so this might not help.
As you're trying to install on Windows, if you don't want to have to mess around with C compilers, there are pre-built binary wheels for pygame here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
Select a package appropriate to you python version[0] and Windows architecture [1]. Download to C:\Users\User\Download\pip install E:\env\pygame-1.9.2a0-cp27-none-win_amd64.whl and install with pip install E:\env\pygame-1.9.2a0-cp27-none-win_amd64.whl
Mercurial binaries can be found on the same page, if you would like to install from source. This method would mean compiling pygame from source, for which you probably want to use this compiler package.
[0] python --version
[1] powershell "gwmi win32_operatingsystem | select osarchitecture"
The command below worked for me on Mac OS X El Capitan:
pip3 install pygame
Install on MAC:
brew install homebrew/python/pygame
Just
sudo pip install pygame
worked for me
Had this issue on macOS Sierra, where apt-get doesn't work.
Managed to solve the issue through the following steps:
First I had to install the Mercurial via Brew:
brew install mercurial
Then, I had to install Pygame dependencies:
brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
Finally I used pip3 to install Pygame:
pip3 install pygame
Hope this helps!
Try
python3 -m pip install -U pygame --user
This worked twice for me on windows 7 and windows 10
The most current, the best way to install pygame is always available at:
https://www.pygame.org/wiki/GettingStarted
How to use pip depends on the operating system. So unless you have always updated and tested answers for 15 different operating systems then just send people to that page. All answers to this question are wrong for various different operating systems.
Currently, for windows, this is the way to install it in the cmd prompt. (If you already have pip installed, and people know what pip is... best just send people to the GettingStarted page).
py -m pip install pygame --user
I did use these instructions here from the official site.
But i had to change the python3 part of the command to just py.
Try: python -m pip install pygame
Or: py -m pip install pygame
Try pip install pygame or pip3 install pygame.
These should work for you.
If this does not work for you put -m before pip and python before
-m.
If putting -m does not work try reinstalling python
If you are working on windows, the command below should work fine
pip install pygame
If you are working on Linux, the command below should work fine
sudo apt-get install python-pygame
Type this in command prompt
pip install pygame
or
py -m pip install pygame
WINDOWS
If you are on a windows 10 device then you should use this command but first make sure you have Python installed from https://python.org, if you do run this in command prompt
py --version
and then whatever version it says you have (which you downloaded) keep it in mind we will use it later for now just incase try to upgrade pip incase you are on a outdated version I will be using 3.9 for the version for the rest of this as an example
py -3.9 -m pip --upgrade pip
After that if you have it already satisfied or it upgraded run this command in command prompt
py -3.9 -m pip install pygame
And wait for it to download
And to make sure it worked run this
py -3.9 -m pygame --version
If it shows the version you downloaded it!
MacOS
For MacOS do the same but then run this command to install it
python3 -m pip install -U pygame --user
or if it wont work
py -3.9 -m pip install -U pygame --user ( or just pip3 )
to see if it worked run this
python3 -m pygame.examples.aliens
or
py -3.9 -m pygame.examples.aliens
I hope this helped
I have never used Enthought distribution, but you could try to use Anaconda distribution which is also great too.
Anaconda Distribution (Any OS):
From the docs:
Update conda to the current version.
Type the following:
conda update conda
If a newer version of conda is available, type y to update:
Proceed ([y]/n)? y
Check to see if a package you have not installed named
“pygame” is available from the Anaconda repository (must be
connected to the Internet):
conda search pygame
Conda displays a list of all packages with
that name on the Anaconda repository, so we know it is available.
Install this package into the current environment:
conda install pygame
Check to see if the newly installed
program is in this environment:
conda list
Install on Windows (both python 2.7 and 3.7):
pip install pygame
Install on raspberry pi:
sudo pip3 install pygame (python 3.7)
sudo pip install pygame (python 2.7)
I think if you go to Command Prompt and type
py -m pip install pygame
that's what works for me
Here is a way: sudo install pygame Rasberry pi has it ready-installed
Install python 3.8 from python.org
Then install pygame (2.0) like this
pip install pygame==2.0.0.dev10
Make sure script path is registered in environment variables,
Make sure the python path is registered in environment variables,
also you dont have to enter entire url just write like this(windows only I dont use mac)
pip
pip install pygame
hope it work
command to install pygame is:
pip install pygame
run it in command prompt
Try doing this for python3:
python3 -m pip install pygame==1.9.6
and this for python2:
python -m pip install pygame==1.9.6
You don't have to type in the entire url. Just simply go to command prompt (windows) or terminal (mac) and then type in:
[windows] pip install pygame
[mac] python -m install pygame
hopefully that works :)
To install pygame with pip, use the following commands in the Command Prompt on Windows.
py -m pip download pygame
then...
py -m pip install pygame
You only have to do the download pygame one if it doesn't work when you use the install pygame command by itself.
You type py -m to show that it is using the module pip, which can be accessed through the command prompt.
This is for Windows. For Mac OS, use python -m pip install pygame
I know that there are already lot's of answers, but if you want to download a specific version of pygame, you can use pip:
pip install pygame==1.9.6
Pygame 1.9.6 is the latest version at the time of writing.
Pygame tells you how to install it here, in my personal experience this is what I do on windows to install it, open up command prompt and type python -m pip install pygame if that fails, check if you have more than one version of python installed if so you need to specify what version for example python3.5 -m pip install pygame the reason we do this from command prompt is that in the Python shell it doesn't understand what pip install is just to break it down a little python -m calls a python module in this case we want pip the next two arguments are what we want pip to do and what module/addon we want the action to be applied too
Related
I'm trying to install Pygame. I am running Windows 7 with Enthought Python Distribution. I successfully installed pip, but when I try to install Pygame using pip, I get the following error:
"Could not install requirement Pygame because of HTTP error HTTP error
400: Bad request for URL ..."
I can't find anything about this issue with a Google search, but I did find another Stack Overflow question that prompted the asker to use the following command:
pip install hg+http://bitbucket.org/pygame/pygame
This gave me the following error:
Cannot find command hg
I'm not sure what else to do, as everything I find with a Google search is for Mac, so I don't know how well I can follow those instructions on Windows.
Steps to install PyGame using pip
Install build dependencies (on linux):
sudo apt-get build-dep python-pygame
Install mercurial to use hg (on linux):
sudo apt-get install mercurial
On Windows you can use the installer: Download
Use pip to install PyGame:
pip install hg+http://bitbucket.org/pygame/pygame
If the above gives freetype-config: not found error (on Linux), then try sudo apt-get install libfreetype6-dev and then repeat 3.
Alternative way:
# Grab source
hg clone https://bitbucket.org/pygame/pygame
# Finally build and install
cd pygame
python setup.py build
sudo python setup.py install
Try doing this:
sudo apt-get install mercurial
sudo pip install hg+http://bitbucket.org/pygame/pygame
An update to this may be required, as it stands in version 1.9.1 it should simply install using:
pip install pygame
However, it look like there is a bug with their pypi repository, see:
https://bitbucket.org/pygame/pygame/issues/59/pygame-has-no-pypi-page-and-cant-be
So, if you want the most recent release, you have to point directly at the ftp file ala:
pip install http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz
I suppose this will be fixed in the 1.9.2 release but for now this works.
I would note that the answer supplied by Pratyush works as well, but requires the user to install mercurial if they don't have it and downloads the trunk version, so really, not ideal unless you absolutely need it.
Caveat: I'm not familiar with the Enthought Distribution, so this might not help.
As you're trying to install on Windows, if you don't want to have to mess around with C compilers, there are pre-built binary wheels for pygame here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
Select a package appropriate to you python version[0] and Windows architecture [1]. Download to C:\Users\User\Download\pip install E:\env\pygame-1.9.2a0-cp27-none-win_amd64.whl and install with pip install E:\env\pygame-1.9.2a0-cp27-none-win_amd64.whl
Mercurial binaries can be found on the same page, if you would like to install from source. This method would mean compiling pygame from source, for which you probably want to use this compiler package.
[0] python --version
[1] powershell "gwmi win32_operatingsystem | select osarchitecture"
The command below worked for me on Mac OS X El Capitan:
pip3 install pygame
Install on MAC:
brew install homebrew/python/pygame
Just
sudo pip install pygame
worked for me
Had this issue on macOS Sierra, where apt-get doesn't work.
Managed to solve the issue through the following steps:
First I had to install the Mercurial via Brew:
brew install mercurial
Then, I had to install Pygame dependencies:
brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
Finally I used pip3 to install Pygame:
pip3 install pygame
Hope this helps!
Try
python3 -m pip install -U pygame --user
This worked twice for me on windows 7 and windows 10
The most current, the best way to install pygame is always available at:
https://www.pygame.org/wiki/GettingStarted
How to use pip depends on the operating system. So unless you have always updated and tested answers for 15 different operating systems then just send people to that page. All answers to this question are wrong for various different operating systems.
Currently, for windows, this is the way to install it in the cmd prompt. (If you already have pip installed, and people know what pip is... best just send people to the GettingStarted page).
py -m pip install pygame --user
I did use these instructions here from the official site.
But i had to change the python3 part of the command to just py.
Try: python -m pip install pygame
Or: py -m pip install pygame
Try pip install pygame or pip3 install pygame.
These should work for you.
If this does not work for you put -m before pip and python before
-m.
If putting -m does not work try reinstalling python
If you are working on windows, the command below should work fine
pip install pygame
If you are working on Linux, the command below should work fine
sudo apt-get install python-pygame
Type this in command prompt
pip install pygame
or
py -m pip install pygame
WINDOWS
If you are on a windows 10 device then you should use this command but first make sure you have Python installed from https://python.org, if you do run this in command prompt
py --version
and then whatever version it says you have (which you downloaded) keep it in mind we will use it later for now just incase try to upgrade pip incase you are on a outdated version I will be using 3.9 for the version for the rest of this as an example
py -3.9 -m pip --upgrade pip
After that if you have it already satisfied or it upgraded run this command in command prompt
py -3.9 -m pip install pygame
And wait for it to download
And to make sure it worked run this
py -3.9 -m pygame --version
If it shows the version you downloaded it!
MacOS
For MacOS do the same but then run this command to install it
python3 -m pip install -U pygame --user
or if it wont work
py -3.9 -m pip install -U pygame --user ( or just pip3 )
to see if it worked run this
python3 -m pygame.examples.aliens
or
py -3.9 -m pygame.examples.aliens
I hope this helped
I have never used Enthought distribution, but you could try to use Anaconda distribution which is also great too.
Anaconda Distribution (Any OS):
From the docs:
Update conda to the current version.
Type the following:
conda update conda
If a newer version of conda is available, type y to update:
Proceed ([y]/n)? y
Check to see if a package you have not installed named
“pygame” is available from the Anaconda repository (must be
connected to the Internet):
conda search pygame
Conda displays a list of all packages with
that name on the Anaconda repository, so we know it is available.
Install this package into the current environment:
conda install pygame
Check to see if the newly installed
program is in this environment:
conda list
Install on Windows (both python 2.7 and 3.7):
pip install pygame
Install on raspberry pi:
sudo pip3 install pygame (python 3.7)
sudo pip install pygame (python 2.7)
I think if you go to Command Prompt and type
py -m pip install pygame
that's what works for me
Here is a way: sudo install pygame Rasberry pi has it ready-installed
Install python 3.8 from python.org
Then install pygame (2.0) like this
pip install pygame==2.0.0.dev10
Make sure script path is registered in environment variables,
Make sure the python path is registered in environment variables,
also you dont have to enter entire url just write like this(windows only I dont use mac)
pip
pip install pygame
hope it work
command to install pygame is:
pip install pygame
run it in command prompt
Try doing this for python3:
python3 -m pip install pygame==1.9.6
and this for python2:
python -m pip install pygame==1.9.6
You don't have to type in the entire url. Just simply go to command prompt (windows) or terminal (mac) and then type in:
[windows] pip install pygame
[mac] python -m install pygame
hopefully that works :)
To install pygame with pip, use the following commands in the Command Prompt on Windows.
py -m pip download pygame
then...
py -m pip install pygame
You only have to do the download pygame one if it doesn't work when you use the install pygame command by itself.
You type py -m to show that it is using the module pip, which can be accessed through the command prompt.
This is for Windows. For Mac OS, use python -m pip install pygame
I know that there are already lot's of answers, but if you want to download a specific version of pygame, you can use pip:
pip install pygame==1.9.6
Pygame 1.9.6 is the latest version at the time of writing.
Pygame tells you how to install it here, in my personal experience this is what I do on windows to install it, open up command prompt and type python -m pip install pygame if that fails, check if you have more than one version of python installed if so you need to specify what version for example python3.5 -m pip install pygame the reason we do this from command prompt is that in the Python shell it doesn't understand what pip install is just to break it down a little python -m calls a python module in this case we want pip the next two arguments are what we want pip to do and what module/addon we want the action to be applied too
I'm trying to install pygame on my mac, when I import pygame, below error returned
Traceback (most recent call last): File "<pyshell#0>", line 1,
in <module> import pygame File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95,
in <module> from pygame.base import * ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found.
Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper.
I have seen it is a architecture problem, however I'm not aware of how to install 32bit python.
Thanks in advance
EDIT: I realized that these steps were originally intended for python3. It should still work for python2, but I can't confirm, it's just the best answer I have.
Assuming you are using the newest macOS, here are the steps I used to install pygame. Try and uninstall what you installed for pygame previously, I'm not sure how this could affect it. This will also install the IDLE program, a python IDE developed by python, if you don't already have it.
If you have an older mac, click the source link at the bottom, which we provide instructions for older macs, which would involve downloading programs like xcode.
Install homebrew. Go into terminal and paste
ruby -e "$(curl -fsSL https<nolink>://raw.githubusercontent.com/Homebrew/install/master/install)"
then hit enter.
Paste the following into terminal, hitting enter after each line:
brew install python (brew install python3 for python3 users)
brew install mercurial
brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
brew tap homebrew/headonly (if you have any trouble here, try brew install --HEAD smpeg instead)
brew install smpeg
sudo -H pip install hg+http<nolink>://bitbucket.org/pygame/pygame (You will have to enter your password, and you must be an admin. Python3 users should use sudo -H pip3 install hg+http<nolink>://bitbucket.org/pygame/pygame)
Source (although some info was updated)
For me actually, in 03/2020 with the latest OS / Python etc. I used all commands except for the last one which did not work. I simply run this and SUCCESS(!):
pip3 install pygame
I had to use these instructions in order for it to work on MAC OS 10.14.4 with Python 3.8 on date 6/2/20, assuming you already have Python installed.
brew install mercurial
brew install sdl sdl_image sdl_mixer sdl_ttf portmidi
brew install smpeg
pip install https://github.com/pygame/pygame/archive/1.9.4.zip
I have installed nltk on python3.5 version using command:
sudo apt-get install python3-nltk
when this did not work, I also tried using pip
when I tried checking the installations on python3 prompt it is giving me the error as this:
enter image description here
how can I resolve this error?
You can install NLTK through PIP. First of all you have to install pip for python3.
sudo apt-get install python3-pip
then check if pip installed successfully by running:
pip3 -V
and you have to take something like this
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
After use pip3 to install nltk by running:
sudo pip3 install -U nltk
In Python 2.X I used MySQLdb module. But recently I've started to port my application to Python 3.X and now indeed this module is no longer working. This is what I tried to do:
$ pip3 install MySQLdb
$ pip3 install PyMySQL
$ pip3 install mysql-connector-python
But none of these commands (taken from different stackoverflow threads) works. So I need some help.
try the following code for installing sql connector for python3
pip install --allow-external mysql-connector-python mysql-connector-python
it worked for me...
For context, it on a remote server which has a firewall. I'm setting up my environment through a proxy. I have ruby 1.8.7. When I try to gem install..
sudo gem install --http-proxy <host address>:<port> json
I get the following error:
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/json-1.8.1 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
Since I was unsure what the problem is, I googled and found these
gem install: Failed to build gem native extension (can't find header files) - the instructions here seem to be specific to the gem being installed.
How to install json gem - Failed to build gem native extension This seems to be slightly different error.
Any hints? Thanks!
Modern era update, as stated by mimoralea:
In case that you are using ruby 2.0 or 2.2 (thanks #patrick-davey).
sudo apt-get install ruby2.0-dev
sudo apt-get install ruby2.2-dev
sudo apt-get install ruby2.3-dev
or, generic way:
sudo apt-get install ruby-dev
or
sudo apt-get install ruby`ruby -e 'puts RUBY_VERSION[/\d+\.\d+/]'`-dev
The first link you’ve posted is exactly your case: there is no ruby development environment installed. Development env is needed to compile ruby extensions, which are mostly written in C. Proxy has nothing to do with the problem: everything is downloaded fine, just compilation fails.
I would suggest you to install ruby-dev (ruby-devel for rpm-based distros) package onto you target machine.
gcc package might be needed as well.
Try:
$ sudo apt-get install ruby-dev
Or, for Redhat distro:
$ sudo yum install ruby-devel
Or, for [open]SuSE:
$ sudo zypper install ruby-devel
For Xcode 11 on macOS 10.14, this can happen even after installing Xcode and installing command-line tools and accepting the license with
sudo xcode-select --install
sudo xcodebuild -license accept
The issue is that Xcode 11 ships the macOS 10.15 SDK which includes headers for ruby2.6, but not for macOS 10.14's ruby2.3. You can verify that this is your problem by running
ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyhdrdir"]'
which on macOS 10.14 with Xcode 11 prints the non-existent path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0
However, Xcode 11 installs a macOS 10.14 SDK within /Library/Developer/CommandLineTools/SDKs/MacOS10.14.sdk. It isn't necessary to pollute the system directories by installing the old header files as suggested in other answers. Instead, by selecting that SDK, the appropriate ruby2.3 headers will be found:
sudo xcode-select --switch /Library/Developer/CommandLineTools
ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyhdrdir"]'
This should now correctly print
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0
Likewise, gem install should work while that SDK is selected.
To switch back to the current Xcode SDK, use
sudo xcode-select --switch /Applications/Xcode.app
In case that you are using ruby 2.0 or 2.2 (thanks #patrick-davey) or 2.3 (thanks #juanitofatas).
sudo apt-get install ruby-dev
sudo apt-get install ruby2.0-dev
sudo apt-get install ruby2.2-dev
sudo apt-get install ruby2.3-dev
And you get the pattern here...
I also encountered this problem because I install Ruby on Ubuntu via brightbox, and I thought ruby-dev is the trunk of ruby. So I did not install. Install ruby2.3-dev fixes it:
sudo apt-get install ruby2.3-dev
For those who are getting this on Mac OS X you may need to run the following command to install the XCode command-line tools, even if you already have XCode installed:
sudo xcode-select --install
Also you must agree the terms and conditions of XCode by running the following command:
sudo xcodebuild -license
I had a similar problem using cygwin to run the following command:
$ gem install rerun
I solved it by installing the following cygwin packages:
ruby-devel
libffi-devel
gcc-core
gcc-g++
make
automake1.15
Most voted solution didn't work on my machine (linux mint 18.04).
After a careful look, i found that g++ was missing.
Solved with
sudo apt-get install g++
in case you use SUSE
sudo yast2 -i ruby-devel
Xcode 11 / macOS Catalina
On Xcode 11 / macOS Catalina, the header files are no longer in the old location and the old /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg file is no longer available.
Instead, the headers are now installed to the /usr/include directory of the current SDK path:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
Most of this directory can be found by using the output of xcrun --show-sdk-path. And if you add this path to the CPATH environment variable, then build scripts (including those called via bundle) will generally be able to find it.
I resolved this by setting my CPATH in my .zshrc file:
export CPATH="$(xcrun --show-sdk-path)/usr/include"
After opening a new shell (or running source .zshrc), I no longer receive the error message mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h and the rubygems install properly.
Note on Building to Non-macOS Platforms
If you are building to non-macOS platforms, such as iOS/tvOS/watchOS, this change will attempt to include the macOS SDK in those platforms, causing build errors. To resolve, either don't set CPATH environment variable on login, or temporarily set it to blank when running xcodebuild like so:
CPATH="" xcodebuild --some-args
In Fedora 21 and up, you simply open a terminal and install the Ruby Development files as root.
dnf install ruby-devel
On Mac 10.14, the header files don't seem to be installed in the correct place. Rather than changing paths like the other fixes, I was able to just run this:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Follow the instructions and it resolved this problem for me.
You may need to install gcc after install ruby-devel
Xcode -> Preferences -> Locations
change Command Line Tools to Xcode 11.2.1
You need to install the entire ruby and not just the minimum package. The correct command to use is:
sudo apt install ruby-full
The following command will also not install a complete ruby:
sudo apt-get install ruby2.3-dev
For Ubuntu 18, after checking log file mentioned while install
Results logged to /var/canvas/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nio4r-2.5.2/gem_make.out
with
less /var/canvas/vendor/bundle/ruby/2.5.0/extensions/x86_64-linux/2.5.0/nio4r-2.5.2/gem_make.out
I noticed that make is not found. So installed make by
sudo apt-get install make
everything worked.
I faced a similar issue on Xcode 12 with macOS 10.15 and cocoapods. Just make sure that the xcode-select command points to the SDK you want to build against. It should build without issues afterwards.
BEFORE you follow the tip from Joki's answer (below) and IF :
you have MacOS 10.14.6
at /Library/Developer/CommandLineTools/SDKs/ you have folders
MacOSX.sdk(symbolic), MacOSX10.14.sdk, MacOSX10.15.sdk
Move MacOSX10.15.sdk to anywhere (admin privileges needs)
Delete symbolic link (admin privileges needs)
At /Library/Developer/CommandLineTools/SDKs/ create another symbolic link now to MacOSX10.14.sdk folder using (admin privileges needs)
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk MacOSX.sdk
Now you can follow Joki's answer
WARNING!
If you move MacOSX10.15.sdk folder to /Library/Developer/CommandLineTools/SDKs/ again, the command
ruby -rrbconfig -e 'puts RbConfig::CONFIG["rubyhdrdir"]'
will show MacOSX10.15.sdk folder like default again, nowadays I dunno how to fix it! My suggestion, compress the folder and put the original folder until fix will be available.
macOS RubyMine Gem installation failure
My problem with this error message was when trying to install a Gem via RubyMine. It didn't like that I had changed the global Ruby version with rbenv, so I fixed it by changing back to the system default Ruby version with:
rbenv global system
and restarted RubyMine.
sudo apt-get --reinstall install ruby
try it for ubuntu 16.04