I'm trying to install the pysox package using pip (easy_install throws exactly the same error) on Ubuntu 12.04.2 LTS.
$ pip install pysox
[...]
building 'pysox.sox' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c pysox/sox.c -o build/temp.linux-x86_64-2.7/pysox/sox.o
pysox/sox.c:227:17: fatal error: sox.h: No such file or directory
My system has installed:
$ dpkg --list | grep sox
ii libsox-fmt-all 14.3.2-3 All SoX format libraries
ii libsox-fmt-alsa 14.3.2-3 SoX alsa format I/O library
ii libsox-fmt-ao 14.3.2-3 SoX Libao format I/O library
ii libsox-fmt-base 14.3.2-3 Minimal set of SoX format libraries
ii libsox-fmt-ffmpeg 14.3.2-3 SoX ffmpeg format library
ii libsox-fmt-mp3 14.3.2-3 SoX MP3 format library
ii libsox-fmt-oss 14.3.2-3 SoX OSS format I/O library
ii libsox-fmt-pulse 14.3.2-3 SoX PulseAudio format I/O library
ii libsox1b 14.3.2-3 SoX library of audio effects and processing
ii sox 14.3.2-3 Swiss army knife of sound processing
as well as the libasound2-plugins and libasound2-python packages. I even pulled the SoX source and added ~/sox/src/sox.h to my PATH, all to no avail. It's true that a find does not locate a sox.h, even though my binaries all seem in order. the pysox source does not seem contain sox.h either.
The pysox offical page states "Specifically you need sox.h in your include path and libsox.so and libsox.a in your link path."
But apart from compiling everything from source, I don't see how I can have those files just from the binary packages. Is it not possible to use normal package managers for this install, do I need to compile, link & include everything myself?
How does one install pysox properly on Debian/Ubuntu?
In case it helps, I had the same issue but got errors using:
sudo apt-get install libasound2-plugins libasound2-python libsox-fmt-all libsox-dev sox
I did get it to work though by dropping the libasound requests, which no longer appear to be available.
This is what worked for me... the process, I think, was:
pip3 install sox
sudo apt-get install sox libsox-fmt-all
sudo apt-get install sox libsox-dev
pip3 install pysox
Only took me about 11 hours to work that out.
Okay, this was to be expected: forgot to install the dev package for SoX, namely libsox-dev. It wasn't obvious to me at first because the standard package is sox, and the lib packages are all prefaced with libsox-fmt (and there is very little documentation on this).
anyway, this is everything you'll need on a Debian machine to get the proper files in place for pip/easy_install to package manage your modules properly for SoX:
sudo apt-get install libasound2-plugins libasound2-python libsox-fmt-all libsox-dev sox
Related
Most of the cx_Oracle 5.2.1 version builds are for Windows and Linux. How do I install/get an install for a Solaris 11 Sparc?
I tried to install using the following: cx_Oracle-5.2.1.tar.gz from sourceforge.net
But resulted in the following error:
/tmp/cx_Oracle-5.2.1$ python setup.py build
running build
running build_ext
building 'cx_Oracle' extension
creating build
creating build/temp.solaris-2.11-sun4v.32bit-2.7-11g
cc -DNDEBUG -KPIC -DPIC -I/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/demo -I/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/public -I/usr/include/python2.7 -c cx_Oracle.c -o build/temp.solaris-2.11-sun4v.32bit-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.2.1
unable to execute 'cc': No such file or directory
error: command 'cc' failed with exit status 1
Please advise.
Oracle (nor Sun, for that matter) did not include a compiler in the Solaris OS installation image. The Solaris Studio compiler is available for download, and of course you can also go the GCC route (UNIX Packages web site offers installable packages of GCC and various libraries needed for dependences for a modest fee.)
The original post is quote old though, and the solution as of now is to simply install the cx_oracle package from the 11.3 or 11.4 IPS.
I do not know the exact reason for the error you are getting. It looks, however, like the "cc" compiler is not installed. You should be able to find that package and install it. Or you will need to adjust your configuration to use gcc instead. This link may help:
http://www.unix.com/solaris/114262-command-cc-failed-even-though-gcc-installed.html
I want to install the pyvlfeat package. It requires Boost.Python.
When I run the command
python.exe setup.py build
I receive the following message:
C:\Users\alex\Anaconda\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -IC:\Users\A
lexkow\AppData\Roaming\Python\Python27\site-packages\numpy\core\include -Ivlfeat
/ -IC:\Users\alex\Anaconda\include -IC:\Users\alex\Anaconda\PC -c vlfeat/m
ser/vl_erfill.cpp -o build\temp.win-amd64-2.7\Release\vlfeat\mser\vl_erfill.o -m
sse2 -O2 -fPIC -w
In file included from vlfeat/mser/vl_erfill.cpp:7:0:
vlfeat/mser/../py_vlfeat.h:18:28: fatal error: boost/python.hpp: No such file or
directory
Which tells me Boost.Python is not installed correctly on my computer, or that I don't launch the python install command correctly.
The package INSTALL instructions are :
Building the Module on a Unix System --
The C++ wrappers require Boost.Python to be installed:
$ sudo apt-get install boost-python1.35-dev
pyvlfeat uses distutils, so to build the library:
$ python setup.py build
As I am on Windows I can't sudo apt-get, so I downloaded boost 1.57.0 and extracted it into
C:\Program Files\boost\boost_1_57_0
It did not change the result. And now I don't know what I should do:
When I read the documentation
The section 3: "No-Install Quick Start" explains how to build an extension module called extending and test it by running a Python script called test_extending.py. I don't think that is what I want to achieve and it seems outdated because it talks about the bjam build driver.
The section 4: "Installing Boost.Python on your system" looks more interresting, but it says the information is in the Getting Started Guide, and it is not.
How to install Boost.Python on Windows 7 in order to install a python package ? ?
I am looking at the setup.py file. It looks like you can set BOOST_PATH at the top. You should set that to the correct path to the Boost you downloaded, I think.
I have this problem:
No module named _imagingft
I have installed PIL, but it still does not work. I use OSX.
I'm trying to install this module for Django Simple Captcha.
Installing Pillow over existing PIL solved the issue for me:
$ sudo easy_install PIL
$ sudo easy_install Pillow
The suggest of Cristopher works very well for me.
Details follow:
1. Uninstall existing Python Imaging Library
Download and extract the source version (from here
http://effbot.org/downloads/Imaging-1.1.6.tar.gz)
Install freetype2 library (you need freetype cause _imagingft
handles TrueType fonts for captcha)
Modify setup.py (in PIL extracted source folder)to match the
freetype2 library (e.g. on my VPS with Centos I've changed line 'FREETYPE_ROOT = None'
to 'FREETYPE_ROOT = "/usr/local/include"')
Build PIL (python setup.py build) and verify that Freetype2 support
is ok
Install PIL (python setup.py build)
After installing you could verify existence of library, opening
python console and typing 'import instructions for _imagingft
library'.
If you use ubuntu you can use following manual:
http://helloworld.infobart.com/compiling-pil-on-ubuntu-natty
Thanks to a combination of resources (credit at the end) I've put together the following script, which works for me but YMMV. (Please check it carefully before running. It may have bugs that'll eat your liver, shave your cat, and run your car on leaded fuel):
#!/bin/bash
pip-2.6 uninstall PIL
# Just in case there's a virtualenv someplace:
pip uninstall PIL
# And forcibly clean up PIL as well
rm -rf /Library/Python/2.6/site-packages/PIL*
if [ ! -d "/usr/X11/include/freetype2" ];then
echo "You need to have XCode installed with the freetype libraries"
exit 1
fi
# Ok we're good to install ...
# Freetype is installed by XCode, so let's link to that for PIL's
# setup.py to know where to find things
ln -s /usr/X11/include/freetype2 /usr/local/include/
ln -s /usr/X11/include/ft2build.h /usr/local/include/
ln -s /usr/X11/lib/libfreetype.6.dylib /usr/local/lib/
ln -s /usr/X11/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.dylib
pip-2.6 install PIL
# OR
# pip-2.6 install http://effbot.org/downloads/Imaging-1.1.7.tar.gz
Credits:
http://groups.google.com/group/python-virtualenv/browse_thread/thread/d42f8fd2c52e88b7
The stuff above
Looks like your PIL install didn't support Freetype. You may be missing some Freetype libraries and so your PIL install skipped support for it.
Freetype is the technology for handling fonts.
I was struggling with this myself. The solution is to install Pillow instead of PIL.
Excerpts From https://pypi.python.org/pypi/Pillow/2.0.0:
Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL
is the Python Imaging Library by Fredrik Lundh and Contributors.
PIL is not setuptools compatible. ... Also, PIL's current bi-yearly
(or greater) release schedule is too infrequent to accomodate the
large number and frequency of issues reported.
The binary distribution for Windows also includes _imagingft. You no longer need to build your own from sources.
Download the installer packages from: https://pypi.python.org/pypi/Pillow/2.0.0#downloads
Or simply install with pip install pillow
I ran into a similar problem and the following solution worked for me, hence, I figured I would post it. Hopefully, it will help someone else while they try out the numerous solutions.
Firstly, I think some of the solutions up here will also work and I did use some of the above solutions as a spring board for my own.
[My Setup]
I run in my development virtual environment.
Mac OS X 10.7
pip
Django 1.3.1
XCode 4.2.1
I found that freetype2 is already included with your Mac OS X installation in /usr/X11/include
I am not sure if it is installed with XCode or just comes by default but from what I read and understood there are some patent issues which expired in 2010 which is why Apple does not 'turn on' the font library by default.
I had already installed libjpeg prior to install PIL using HomeBrew.
$ brew install libjpeg
Initially, I installed PIL using pip, but later uninstalled it and instead chose to install Pillow
Believe me or not, that just worked for me.
$ pip install Pillow
It seems like Pillow does the hairy work for you of linking and including the source from /usr/X11/lib as is show below in the installation procedure output:
Running setup.py install for Pillow
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/usr/x11/include/freetype2 -IlibImaging -I/opt/local/include -I/usr/x11/include -I/Users//.virtualenvs/canoe_django_env/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _imaging.c -o build/temp.macosx-10.7-intel-2.7/_imaging.o
I hope this helps as it worked for me.
Sincerely.
Solution without modifying PIL source code:
install freetype2-dev package
export FREETYPE_ROOT=$(pkg-config --variable=libdir freetype2) # you can change to {path-to-freetype-library} if pkg-config is not available
install latest PIL version (pip install https://bitbucket.org/effbot/pil-2009-raclette/get/6a64b3083e35.tar.bz2)
Related PIL issue.
Another possible solution, if you're using Homebrew:
brew install freetype
brew install Pillow
I am running Enthought Python 2.7 as well as default Python 2.7, Xcode 4.5.1 in Mac OS 10.8.2. I am trying to develop a speech to text converter in Python. I use Enthought Python as it allows me to record in 16000Hz, 1 Channel using pyaudio, which is needed for pocketsphinx to work.
I am trying to setup pocketsphinx using brew install pocketsphinx.
I get the following errors
Even manual installation using make and using default python results in same errors
Using brew doctor, I get
How do I successfully install pocketsphinx?
Here is my config.log
Homebrew logs pocketsphinx, sphinxbase
According to the log you have outdated version of the libsndfile installed. You have a header sndfile.h, but not sndfile.pc pkg-config file:
configure:14532: checking for SNDFILE
configure:14540: $PKG_CONFIG --exists --print-errors "sndfile"
Package sndfile was not found in the pkg-config search path.
Perhaps you should add the directory containing `sndfile.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sndfile' found
configure:14543: $? = 1
configure:14558: $PKG_CONFIG --exists --print-errors "sndfile"
Package sndfile was not found in the pkg-config search path.
Perhaps you should add the directory containing `sndfile.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sndfile' found
configure:14561: $? = 1
No package 'sndfile' found
configure:14589: result: no
configure:14603: checking sndfile.h usability
configure:14603: gcc -std=gnu99 -c -g -O2 -Wall -
I/Library/Frameworks/Python.framework/Versions/7.3/include/python2.7 -
I/Library/Frameworks/Python.framework/Versions/7.3/include/python2.7 conftest.c >&5
configure:14603: $? = 0
configure:14603: result: yes
To solve this problem either remove the header to not confuse the configure or install newer sndfile with pkg-config support.
Actually that should be fixed in sphinxbase as well, a bug report would be welcome.
numpy.distutils.system_info.BlasNotFoundError:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
Which tar do I need to download off this site?
I've tried the fortrans, but I keep getting this error (after setting the environment variable obviously).
If you need to use the latest versions of SciPy rather than the packaged version, without going through the hassle of building BLAS and LAPACK, you can follow the below procedure.
Install linear algebra libraries from repository (for Ubuntu),
sudo apt-get install gfortran libopenblas-dev liblapack-dev
Then install SciPy, (after downloading the SciPy source): python setup.py install or
pip install scipy
As the case may be.
The SciPy webpage used to provide build and installation instructions, but the instructions there now rely on OS binary distributions. To build SciPy (and NumPy) on operating systems without precompiled packages of the required libraries, you must build and then statically link to the Fortran libraries BLAS and LAPACK:
mkdir -p ~/src/
cd ~/src/
wget http://www.netlib.org/blas/blas.tgz
tar xzf blas.tgz
cd BLAS-*
## NOTE: The selected Fortran compiler must be consistent for BLAS, LAPACK, NumPy, and SciPy.
## For GNU compiler on 32-bit systems:
#g77 -O2 -fno-second-underscore -c *.f # with g77
#gfortran -O2 -std=legacy -fno-second-underscore -c *.f # with gfortran
## OR for GNU compiler on 64-bit systems:
#g77 -O3 -m64 -fno-second-underscore -fPIC -c *.f # with g77
gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f # with gfortran
## OR for Intel compiler:
#ifort -FI -w90 -w95 -cm -O3 -unroll -c *.f
# Continue below irrespective of compiler:
ar r libfblas.a *.o
ranlib libfblas.a
rm -rf *.o
export BLAS=~/src/BLAS-*/libfblas.a
Execute only one of the five g77/gfortran/ifort commands. I have commented out all, but the gfortran which I use. The subsequent LAPACK installation requires a Fortran 90 compiler, and since both installs should use the same Fortran compiler, g77 should not be used for BLAS.
Next, you'll need to install the LAPACK stuff. The SciPy webpage's instructions helped me here as well, but I had to modify them to suit my environment:
mkdir -p ~/src
cd ~/src/
wget http://www.netlib.org/lapack/lapack.tgz
tar xzf lapack.tgz
cd lapack-*/
cp INSTALL/make.inc.gfortran make.inc # On Linux with lapack-3.2.1 or newer
make lapacklib
make clean
export LAPACK=~/src/lapack-*/liblapack.a
Update on 3-Sep-2015:
Verified some comments today (thanks to all): Before running make lapacklib edit the make.inc file and add -fPIC option to OPTS and NOOPT settings. If you are on a 64bit architecture or want to compile for one, also add -m64. It is important that BLAS and LAPACK are compiled with these options set to the same values. If you forget the -fPIC SciPy will actually give you an error about missing symbols and will recommend this switch. The specific section of make.inc looks like this in my setup:
FORTRAN = gfortran
OPTS = -O2 -frecursive -fPIC -m64
DRVOPTS = $(OPTS)
NOOPT = -O0 -frecursive -fPIC -m64
LOADER = gfortran
On old machines (e.g. RedHat 5), gfortran might be installed in an older version (e.g. 4.1.2) and does not understand option -frecursive. Simply remove it from the make.inc file in such cases.
The lapack test target of the Makefile fails in my setup because it cannot find the blas libraries. If you are thorough you can temporarily move the blas library to the specified location to test the lapack. I'm a lazy person, so I trust the devs to have it working and verify only in SciPy.
On Fedora, this works:
yum install lapack lapack-devel blas blas-devel
pip install numpy
pip install scipy
Remember to install 'lapack-devel' and 'blas-devel' in addition to 'blas' and 'lapack' otherwise you'll get the error you mentioned or the "numpy.distutils.system_info.LapackNotFoundError" error.
I guess you are talking about installation in Ubuntu. Just use:
apt-get install python-numpy python-scipy
That should take care of the BLAS libraries compiling as well. Else, compiling the BLAS libraries is very difficult.
For Windows users there is a nice binary package by Chris (warning: it's a pretty large download, 191 MB):
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy-stack
Following the instructions given by 'cfi' works for me, although there are a few pieces they left out that you might need:
1) Your lapack directory, after unzipping, may be called lapack-X-Y (some version number), so you can just rename that to LAPACK.
cd ~/src
mv lapack-[tab] LAPACK
2) In that directory, you may need to do:
cd ~/src/LAPACK
cp lapack_LINUX.a libflapack.a
Try using
sudo apt-get install python3-scipy