Trouble installing pygame. Permissions Mac OS X 10.9.5 - python

I have been struggling to find the correct research to install pygame for about 2 days and would like to ask the community to reach a solution!
My MacBook is a backup of my old MacBook so if that is the essence of the problem, I am open to suggestions to fix it!
On the installation front
donners-mbp-2:~ Donner$ brew list
cmake isl mercurial python smpeg
freetype jpeg mpfr readline sphinx-doc
gcc libmpc numpy sdl sqlite
gdbm libpng openssl sdl_image webp
git libtiff pkg-config sdl_mixer
gmp makedepend portmidi sdl_ttf
upon researching I should use this code in terminal to install however I receive an error message following:
donners-mbp-2:~ Donner$ /usr/local/share/python/pip install hg+http://bitbucket.org/pygame/pygame
donners-mbp-2:~ Donner$ /usr/local/share/python/pip: No such file or directory
Taking a look into my "Home" Directory - AKA Macintosh HD - I have the Library directory within not in my user folder (AKA directly on the main HD).
Should I move that to my user folder then try again?
When running the pygame install here is what is on my command line.
donners-mbp-2:~ Donner$ sudo -H pip install hg+http://bitbucket.org/pygame/pygame
Password:
Collecting hg+http://bitbucket.org/pygame/pygame
Cloning hg http://bitbucket.org/pygame/pygame to /private/tmp/pip-SqL4BW-build
Requirement already satisfied (use --upgrade to upgrade): pygame==1.9.4.dev0 from hg+http://bitbucket.org/pygame/pygame in /usr/local/lib/python2.7/site-packages
When executing a file with:
#!/usr/bin/env python
import pygame
The error is:
/Users/Donner/Desktop/Python/komodo/pygame/pygame1/open_script ; exit;
donners-mbp-2:~ Donner$ /Users/Donner/Desktop/Python/komodo/pygame/pygame1/open_script ; exit;
Traceback (most recent call last):
File "pygame1.py", line 3, in <module>
import pygame
ImportError: No module named pygame
logout
[Process completed]
EDIT: I did a brew doctor in terminal and received this as the output.
donners-mbp-2:~ Donner$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/python2.7/pygame/_camera.h
/usr/local/include/python2.7/pygame/_pygame.h
/usr/local/include/python2.7/pygame/_surface.h
/usr/local/include/python2.7/pygame/bitmask.h
/usr/local/include/python2.7/pygame/camera.h
/usr/local/include/python2.7/pygame/fastevents.h
/usr/local/include/python2.7/pygame/font.h
/usr/local/include/python2.7/pygame/freetype.h
/usr/local/include/python2.7/pygame/mask.h
/usr/local/include/python2.7/pygame/mixer.h
/usr/local/include/python2.7/pygame/pgarrinter.h
/usr/local/include/python2.7/pygame/pgbufferproxy.h
/usr/local/include/python2.7/pygame/pgcompat.h
/usr/local/include/python2.7/pygame/pgopengl.h
/usr/local/include/python2.7/pygame/pygame.h
/usr/local/include/python2.7/pygame/scrap.h
/usr/local/include/python2.7/pygame/surface.h
Warning: You are using macOS 10.9.
We (and Apple) do not provide support for this old version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:
2to3
2to3-2.7
easy_install
easy_install-2.7
git
git-cvsserver
git-receive-pack
git-shell
git-upload-archive
git-upload-pack
idle
idle2.7
pydoc
pydoc2.7
python
python-config
python2.7
python2.7-config
pythonw
pythonw2.7
smtpd.py
smtpd2.7.py
Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
Thank you for any help/suggestions!

(Posted on behalf of the OP).
This is solved.
I followed this to show hidden files in my $PATH and establish a new $PATH. https://coolestguidesontheplanet.com/add-shell-path-osx/
Then un-installed and reinstalled pygame, following the comments here: https://www.reddit.com/r/Python/comments/2jfj1w/how_to_install_pygame_on_osx_1095/. Specifically the comment by redditor PigBoyOhBoy (with some adjustments for Python 2.7 rather than Python 3).

Related

How to install Subversion with python bindings on Mac

I'm doing:
$ brew install subversion --with-python
Yet, homebrew reports:
Warning: subversion: this formula has no --with-python option so it will be ignored!
It goes on to install subversion, as that was only a warning, but I need the Python bindings too.
I tried --with-python in other positions, but it does not make any difference.
Here's all the output:
Warning: subversion: this formula has no --with-python option so it will be ignored!
==> Downloading https://homebrew.bintray.com/bottles/subversion-1.10.2.high_sierra.bottle.tar.gz
Already downloaded: /Users/paul/Library/Caches/Homebrew/downloads/cd34819a835db41e326680b8e94b4343ee0d98f68456b42c03fd1895c77b65c7--subversion-1.10.2.high_sierra.bottle.tar.gz
==> Pouring subversion-1.10.2.high_sierra.bottle.tar.gz
==> Caveats
svntools have been installed to:
/usr/local/opt/subversion/libexec
The perl bindings are located in various subdirectories of:
/usr/local/opt/subversion/lib/perl5
If you wish to use the Ruby bindings you may need to add:
/usr/local/lib/ruby
to your RUBYLIB.
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/subversion/1.10.2: 244 files, 30.4MB
Other info: I'm on macOS 10.13.6. Homebrew was upgraded today (no upgrades pending). There's a info page https://formulae.brew.sh/formula/subversion that suggests that --with-python is a real option, but that's not something the install command agrees with. At least on my computer. Swig is install on my mac (v3.0.12) via brew.
https://formulae.brew.sh/formula/subversion is out of date. The --with-python argument is not supported because the formula does the Python steps by default now.

Error installing Python 2 via Homebrew on MacOS Mojave

I'm having a lot of trouble with installing Python 2.7 on the MacOS 10.14 Mojave Beta.
Yes, I know that Python 2 comes pre-installed on the Mac, but I need a framework build of Python for my task.
I've tried re-installing the command line tools and then installing Python 2.7 as suggested here and here, but am still having issues - below is my output:
NickLaptop:~ nicholasarner$ brew reinstall python#2
==> Reinstalling python#2
==> Downloading https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2-2.7.15.tar.xz
==> ./configure --prefix=/usr/local/Cellar/python#2/2.7.15_1 --enable-ipv6 --datarootdir=/usr/l
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python#2/2.7.15_1
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python#2/2.7.15_1/share/python#
==> Downloading https://files.pythonhosted.org/packages/1a/04/d6f1159feaccdfc508517dba1929eb93a
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2--setuptools-39.2.0.zip
==> Downloading https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2--pip-10.0.1.tar.gz
==> Downloading https://files.pythonhosted.org/packages/2a/fb/aefe5d5dbc3f4fe1e815bcdb05cbaab19
Already downloaded: /Users/nicholasarner/Library/Caches/Homebrew/python#2--wheel-0.31.1.tar.gz
==> make html
Last 15 lines from /Users/nicholasarner/Library/Logs/Homebrew/python#2/05.make:
return build_main(argv)
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/cmd/build.py", line 22, in build_main
from sphinx import cmdline
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/cmdline.py", line 23, in <module>
from sphinx.application import Sphinx
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/application.py", line 29, in <module>
from sphinx.config import Config
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/config.py", line 21, in <module>
from sphinx.util import logging
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/util/__init__.py", line 33, in <module>
from sphinx.util import logging
File "/usr/local/Cellar/sphinx-doc/1.7.5_1/libexec/lib/python2.7/site-packages/sphinx/util/logging.py", line 106, in <module>
class SphinxLoggerAdapter(logging.LoggerAdapter):
AttributeError: 'module' object has no attribute 'LoggerAdapter'
make: *** [build] Error 1
Do not report this issue to Homebrew/brew or Homebrew/core!
These open issues may also help:
python 3.7.0 https://github.com/Homebrew/homebrew-core/pull/29490
python upgrade failing https://github.com/Homebrew/homebrew-core/issues/29214
app-engine-python 1.9.70 https://github.com/Homebrew/homebrew-core/pull/28858
molecule: Use correct `docker` python package dependency https://github.com/Homebrew/homebrew-core/pull/28635
[root] formula does not link against python#2 correctly. https://github.com/Homebrew/homebrew-core/issues/29377
clingo add support for lua, use python 3 https://github.com/Homebrew/homebrew-core/pull/28057
OSError: [Errno 1] Operation not permitted for python#2 –with-tcl-tk https://github.com/Homebrew/homebrew-core/issues/28168
Error: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
Error: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues
Any help is appreciated!
EDIT Please don't suggest Anaconda! For what I'm working on, I specifically need a framework built version of Python via Brew.
EDIT 2 - I tried reinstalling Sphinx, which happened with no problems. Upon doing that, I tried running install python#2 again, but had the same issue as before.
Below is the output of running brew doctor
NickLaptop:~ nicholasarner$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
/Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
/usr/local/CrossPack-AVR/bin/libusb-config
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libFLAC.8.2.0.dylib
/usr/local/lib/libcdt.5.dylib
/usr/local/lib/libcgraph.6.dylib
/usr/local/lib/libcsnd6.6.0.dylib
/usr/local/lib/libfltk.1.1.dylib
/usr/local/lib/libfltk.1.3.dylib
/usr/local/lib/libfltk_forms.1.3.dylib
/usr/local/lib/libfltk_images.1.1.dylib
/usr/local/lib/libfltk_images.1.3.dylib
/usr/local/lib/libfluidsynth.1.dylib
/usr/local/lib/libgraph.5.dylib
/usr/local/lib/libgvc.6.dylib
/usr/local/lib/libgvpr.2.dylib
/usr/local/lib/liblo.0.dylib
/usr/local/lib/libluajit-5.1.2.0.2.dylib
/usr/local/lib/libmpadec.dylib
/usr/local/lib/libpathplan.4.dylib
/usr/local/lib/libpng12.0.dylib
/usr/local/lib/librealsense.1.12.1.dylib
/usr/local/lib/libsfml-audio.2.0.dylib
/usr/local/lib/libsfml-graphics.2.0.dylib
/usr/local/lib/libsfml-network.2.0.dylib
/usr/local/lib/libsfml-system.2.0.dylib
/usr/local/lib/libsfml-window.2.0.dylib
/usr/local/lib/libsndfile.1.dylib
/usr/local/lib/libwiiuse.dylib
/usr/local/lib/libxdot.4.dylib
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/graphviz/arith.h
/usr/local/include/graphviz/cdt.h
/usr/local/include/graphviz/cgraph.h
/usr/local/include/graphviz/color.h
/usr/local/include/graphviz/geom.h
/usr/local/include/graphviz/graph.h
/usr/local/include/graphviz/graphviz_version.h
/usr/local/include/graphviz/gvc.h
/usr/local/include/graphviz/gvcext.h
/usr/local/include/graphviz/gvcjob.h
/usr/local/include/graphviz/gvcommon.h
/usr/local/include/graphviz/gvconfig.h
/usr/local/include/graphviz/gvplugin.h
/usr/local/include/graphviz/gvplugin_device.h
/usr/local/include/graphviz/gvplugin_layout.h
/usr/local/include/graphviz/gvplugin_loadimage.h
/usr/local/include/graphviz/gvplugin_render.h
/usr/local/include/graphviz/gvplugin_textlayout.h
/usr/local/include/graphviz/gvpr.h
/usr/local/include/graphviz/pack.h
/usr/local/include/graphviz/pathgeom.h
/usr/local/include/graphviz/pathplan.h
/usr/local/include/graphviz/textpara.h
/usr/local/include/graphviz/types.h
/usr/local/include/graphviz/usershape.h
/usr/local/include/graphviz/xdot.h
/usr/local/include/jack/control.h
/usr/local/include/jack/intclient.h
/usr/local/include/jack/jack.h
/usr/local/include/jack/jslist.h
/usr/local/include/jack/metadata.h
/usr/local/include/jack/midiport.h
/usr/local/include/jack/net.h
/usr/local/include/jack/ringbuffer.h
/usr/local/include/jack/session.h
/usr/local/include/jack/statistics.h
/usr/local/include/jack/systemdeps.h
/usr/local/include/jack/thread.h
/usr/local/include/jack/transport.h
/usr/local/include/jack/types.h
/usr/local/include/jack/uuid.h
/usr/local/include/jack/weakjack.h
/usr/local/include/jack/weakmacros.h
/usr/local/include/librealsense/rs.h
/usr/local/include/librealsense/rsutil.h
/usr/local/include/runt.h
/usr/local/include/sndfile.h
/usr/local/include/soundpipe.h
/usr/local/include/sporth.h
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/liblo.la
/usr/local/lib/libsndfile.la
Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .pc files:
/usr/local/lib/pkgconfig/jack.pc
/usr/local/lib/pkgconfig/libcdt.pc
/usr/local/lib/pkgconfig/libcgraph.pc
/usr/local/lib/pkgconfig/libgraph.pc
/usr/local/lib/pkgconfig/libgvc.pc
/usr/local/lib/pkgconfig/libgvpr.pc
/usr/local/lib/pkgconfig/libpathplan.pc
/usr/local/lib/pkgconfig/libxdot.pc
/usr/local/lib/pkgconfig/sndfile.pc
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/liblua.a
/usr/local/lib/librunt.a
/usr/local/lib/libsndfile.a
/usr/local/lib/libsoundpipe.a
/usr/local/lib/libsporth.a
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
lua
libsndfile
ruby
Warning: You are using macOS 10.14.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/bin/git-remote-keybase
/usr/local/bin/keybase
/usr/local/bin/lua
/usr/local/bin/lua-5.2
/usr/local/bin/lua5.2
/usr/local/bin/luac
/usr/local/bin/luac-5.2
/usr/local/bin/luac5.2
/usr/local/bin/luarocks
/usr/local/bin/luarocks-5.2
/usr/local/bin/luarocks-admin
/usr/local/bin/luarocks-admin-5.2
/usr/local/etc/bash_completion.d/_brew_services
/usr/local/etc/fonts/conf.d/10-hinting-slight.conf
/usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
/usr/local/etc/fonts/conf.d/20-unhint-small-vera.conf
/usr/local/etc/fonts/conf.d/30-metric-aliases.conf
/usr/local/etc/fonts/conf.d/30-urw-aliases.conf
/usr/local/etc/fonts/conf.d/40-nonlatin.conf
/usr/local/etc/fonts/conf.d/45-latin.conf
/usr/local/etc/fonts/conf.d/49-sansserif.conf
/usr/local/etc/fonts/conf.d/50-user.conf
/usr/local/etc/fonts/conf.d/51-local.conf
/usr/local/etc/fonts/conf.d/60-latin.conf
/usr/local/etc/fonts/conf.d/65-fonts-persian.conf
/usr/local/etc/fonts/conf.d/65-nonlatin.conf
/usr/local/etc/fonts/conf.d/69-unifont.conf
/usr/local/etc/fonts/conf.d/80-delicious.conf
/usr/local/etc/fonts/conf.d/90-synthetic.conf
/usr/local/include/lauxlib.h
/usr/local/include/lua.h
/usr/local/include/lua.hpp
/usr/local/include/lua5.2
/usr/local/include/luaconf.h
/usr/local/include/lualib.h
/usr/local/opt/qt5
Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
brew install harfbuzz mono
Run `brew missing` for more details.
This is the output when running brew config:
HOMEBREW_VERSION: 1.6.9-39-g376f67b
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 376f67bf2c8893a06bf1e42a2375d58e9d8c2670
Last commit: 2 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 69b99b69ff3a9c686b9d9fb0102927c5dd2f373b
Core tap last commit: 3 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3_2/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.1 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_131
macOS: 10.14-x86_64
CLT: 10.0.0.0.1.1529074627
CLT headers: 10.0.0.0.1.1529074627
Xcode: 10.0 => /Applications/Xcode-beta.app/Contents/Developer
XQuartz: 2.7.11 => /opt/X11
I had the same problem.
I was able to fix it by completely uninstalling and reinstalling Python after following step by step in this answer: How to fix broken python 2.7.11 after OSx updates
After the reinstallation the problem was gone
As I read you output - this is not a problem with python directly it is a problem with sphinx which builds the docs. I would go for the following steps:
brew update && brew upgrade
brew install sphinx (maybe this gives a better error message or solves the problem if sphinx is installed before)
brew reinstall python#2
If this is not working: Did you reinstalled the commandline tools after upgrading to mac os 10.14? (xcode-select --install). If not installed/updated before do it and retry.
If this all is not working could you please execute brew doctor and post the output so we can better see whats going on with your homebrew instane?
Maybe it could be a option to make an roll back to a stable version of Mac OS (10.13) ?
I'd suggest you used the Anaconda Distribution of python. Anaconda offers both python 2.7 and python 3.6 with easy to use python installers for both versions. The Anaconda page explains how to install and run python on your mac.

os 10.11.6 pip install permission error

I am a CS beginner taking udemy python course and trying to install pip in order to use matplotlib, pandas and so on in pylab.
I use IDLE 3.4.2 and latest version Pycharm
Tried
1. "pip installed pylab"(version not satisfies the requirement pylab,no matching distribution found for pylab);
2.same result with sudo before the first one;
3.sudo easy_install matplotlib(succeeded in terminal, but still no matplotlib module in shell) ;
4.brew install python 3(succeeded , but still no matplotlib module in shell, and every command looks like still for 2.7)
5.Anaconda Package based on preinstalling Macports (same result as 3)
6.On cloud9.io, still can't import matplotlib
Then tried to uninstall both 2 and 3 python then install
7.brew rm -rf/Library/Frameworks/Python.framework/Versions/2.7
(error:no keg argument)
Downloaded Xcode but "block compressed payload operation failed"
Result of "brew doctor":
Warning: "config" scripts exist outside your system or Homebrew directories.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
Warning: Python is installed at /Library/Frameworks/Python.framework
Warning: You have MacPorts or Fink installed:
/opt/local/bin/port
Warning: You have unlinked kegs in your Cellar
Warning: /usr/bin occurs before /usr/local/bin
Thanks for reading!
Answer in detailed direction will be appreciated as I am just a beginner having tons of stuff to learn from you.
Really frustrated by now.

Errors installing Matplotlib - clang

I've tried to install Matplot lib but I'm still struggling to get past errors.
I've installed numpy and psipy but have the following error when I use easy_install (there is a similar error with pip).
And yes, I've installed the command line tools in Xcode in a bid to solve the 'gcc-4.2 not found' problem.
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor',
'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units',
'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid',
'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext',
'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
warning: no files found matching 'KNOWN_BUGS'
warning: no files found matching 'INTERACTIVE'
warning: no files found matching 'MANIFEST'
warning: no files found matching '__init__.py'
warning: no files found matching 'examples/data/*'
warning: no files found matching 'lib/mpl_toolkits'
warning: no files found matching 'LICENSE*' under directory 'license'
gcc-4.2 not found, using clang instead
In file included from src/ft2font.cpp:3:
src/ft2font.h:16:10: fatal error: 'ft2build.h' file not found
#include <ft2build.h>
^
1 error generated.
error: Setup script exited with error: command 'clang' failed with exit status 1
I recently had this issue as well, but I was using pip. If you have homebrew installed you can solve it by running the following commands:
brew install freetype
brew install libpng
brew link freetype
pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev
theres actually an easier way! First see if X11 libraries are installed (ls /usr/X11/include)
If they aren't you may need to install X11
If they are then a simple fix is this:
cd /usr/X11/include
sudo ln -s freetype2/freetype
Basically for some reason its looking for the freetype library at /usr/X11 and its actually in the subfolder in freetype2. Odd - but it does then compile this way.
I did the following and it worked for me
sudo apt install libfreetype6-dev
pip install matplotlib
You're missing freetype2, or at least the development version. It's looking for ft2build.h, which is a freetype2 header file.
You can either try installing freetype2 from source, or just a package manager like macports, fink or homebrew to install it (for package managers, make sure you pick the development version if that's available).
But if you are going the route of package managers, you could also install matplotlib that way. And there may be binaries for OS X that include freetype2, so that may be even easier than installing from source.
The reason easy_install and pip don't install freetype2 for you, is that it's not a Python package.
== Correction ==
freetype2 should be available, not just where easy_install or pip expect it. On my Mac, I can ft2build.h in /usr/X11/include. So, you'll need to set the CFLAGS variable to that directory (and probably LDFLAGS to /usr/X11/lib`) to get the installation working. Now, with easy_install and pip, I'm not 100% sure how to do that. Try e.g.
CFLAGS=-I/usr/X11/include LDFLAGS=-L/usr/X11/lib easy_install matplotlib
Or, just download the matplotlib source, adjust setup.py and build it yourself.

Installing Graphviz on Os X 10.5.8

I'm trying to install Graphviz 2.14.1 on osX 10.5.8
I installed Graphviz from the Universal Binary here:
http://www.ryandesign.com/graphviz/
$ svn co https://networkx.lanl.gov/svn/pygraphviz/trunk pygraphviz
- Fingerprint: 43:8e:fa:75:00:60:67:07:fd:04:3c:e7:bf:25:86:fd:66:b3:f6:cb
(R)eject, accept (t)emporarily or accept (p)ermanently? t
A pygraphviz/pygraphviz
A pygraphviz/pygraphviz/graphviz.i
A pygraphviz/pygraphviz/graphviz.py
A pygraphviz/pygraphviz/tests
A pygraphviz/pygraphviz/tests/graph.txt
A pygraphviz/pygraphviz/tests/attributes.txt
A pygraphviz/pygraphviz/tests/__init__.py
A pygraphviz/pygraphviz/tests/test.py
A pygraphviz/pygraphviz/tests/layout_draw.txt
A pygraphviz/pygraphviz/graphviz_wrap.c
A pygraphviz/pygraphviz/__init__.py
A pygraphviz/pygraphviz/release.py
A pygraphviz/pygraphviz/agraph.py
A pygraphviz/INSTALL.txt
A pygraphviz/doc
A pygraphviz/doc/source
A pygraphviz/doc/source/contents.rst
A pygraphviz/doc/source/examples.rst
A pygraphviz/doc/source/static
A pygraphviz/doc/source/static/contents.png
A pygraphviz/doc/source/static/navigation.png
A pygraphviz/doc/source/static/sphinxdoc.css
A pygraphviz/doc/source/static/empty.txt
A pygraphviz/doc/source/tutorial.rst
A pygraphviz/doc/source/conf.py
A pygraphviz/doc/source/install.rst
A pygraphviz/doc/source/download.rst
A pygraphviz/doc/source/reference
A pygraphviz/doc/source/reference/news.rst
A pygraphviz/doc/source/reference/credits.rst
A pygraphviz/doc/source/reference/related.rst
A pygraphviz/doc/source/reference/api_notes.rst
A pygraphviz/doc/source/reference/history.rst
A pygraphviz/doc/source/reference/agraph.rst
A pygraphviz/doc/source/reference/legal.rst
A pygraphviz/doc/source/reference/faq.rst
A pygraphviz/doc/source/reference/index.rst
A pygraphviz/doc/source/templates
A pygraphviz/doc/source/templates/layout.html
A pygraphviz/doc/source/templates/indexsidebar.html
A pygraphviz/doc/source/templates/index.html
A pygraphviz/doc/sphinxext
A pygraphviz/doc/sphinxext/only_directives.py
A pygraphviz/doc/Makefile
A pygraphviz/setup.py
A pygraphviz/setup_egg.py
A pygraphviz/setup_extra.py
A pygraphviz/MANIFEST.in
A pygraphviz/README.txt
A pygraphviz/examples
A pygraphviz/examples/miles.py
A pygraphviz/examples/simple.py
A pygraphviz/examples/star.py
A pygraphviz/examples/django_simple.py
A pygraphviz/examples/subgraph.py
A pygraphviz/examples/attributes.py
A pygraphviz/examples/miles_dat.txt.gz
A pygraphviz/setup.cfg
U pygraphviz
Checked out revision 1947.
Bryan#bryan-wheelocks-macbook-pro-15 Tue Dec 21 07:25:18 ~/Downloads
$ cd pygraphviz/
Bryan#bryan-wheelocks-macbook-pro-15 Tue Dec 21 07:25:22 ~/Downloads/pygraphviz
$ python setup.py install
Trying pkg-config
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
Trying dotneato-config
Failed to find dotneato-config
Your graphviz installation could not be found.
Either the graphviz package is missing on incomplete
(binary packages graphviz-dev or graphviz-devel missing?).
If you think your installation is correct you will need to manually
change the include_path and library_path variables in setup.py to
point to the correct locations of your graphviz installation.
The current setting of library_path and include_path is:
library_path=None
include_path=None
Traceback (most recent call last):
File "setup.py", line 78, in <module>
raise OSError,"Error locating graphviz."
OSError: Error locating graphviz.
Here is the path to Graphviz:
$ ls -la /usr/local/lib/
drwxrwxr-x 40 root wheel 1360 Dec 21 06:22 graphviz
$ python setup.py install --library_path /usr/local/lib/graphviz/
Trying pkg-config
/bin/sh: pkg-config: command not found
/bin/sh: pkg-config: command not found
Trying dotneato-config
Failed to find dotneato-config
Your graphviz installation could not be found.
Either the graphviz package is missing on incomplete
(binary packages graphviz-dev or graphviz-devel missing?).
If you think your installation is correct you will need to manually
change the include_path and library_path variables in setup.py to
point to the correct locations of your graphviz installation.
The current setting of library_path and include_path is:
library_path=None
include_path=None
Traceback (most recent call last):
File "setup.py", line 78, in <module>
raise OSError,"Error locating graphviz."
OSError: Error locating graphviz.
I was unsuccessful in finding the binary packages graphviz-dev or graphviz-devel
What do I need to do to get this installed?
It seems like you are missing the "pkg-config" package. You can install it with Homebrew
brew install pkg-config
2.14.1 is a very old version of graphviz. You may have better success using the official OS X installer package for 2.26 (at this writing) here. Then you will likely need to edit the pygraphiz setup.py to use the proper library_path and include_path. Most likely you will need to uncomment the /usr/local/lib/graphviz and usr/local/include/graphviz versions but use ls /usr/local to find out for sure.
On the other hand, with so many dependent libraries and packages involved, this is a perfect case for using a 3rd-party package manager like MacPorts which will manage all of the dependencies for you and allow you to easily update as new releases become available. Once you have installed the base MacPorts files, you can install it all with:
$ sudo port selfupdate
# either
$ sudo port install py26-pygraphviz # with MacPorts python2.6
# ... or
$ sudo port install py27-pygraphviz # with MacPorts python2.7
As Ned said,
Locate your setup.py file for graphviz. In my case, it was located at /Users/*my_username*/build/pygraphviz/setup.py
Finally, uncomment the lines corresponding to the Mac OSX paths for library_path and include_path. These are the lines containing: /usr/local/lib/graphviz and usr/local/include/graphviz

Categories