问题
Using the command pip install textract
I'm unable to install textract on my Ubuntu 16.04, Python 2.
I get the following error:
Collecting textract
Requirement already satisfied: python-pptx==0.6.5 in ./anaconda2/lib/python2.7/site-packages (from textract) (0.6.5)
Requirement already satisfied: docx2txt==0.6 in ./anaconda2/lib/python2.7/site-packages (from textract) (0.6)
Requirement already satisfied: six==1.10.0 in ./anaconda2/lib/python2.7/site-packages (from textract) (1.10.0)
Requirement already satisfied: xlrd==1.0.0 in ./anaconda2/lib/python2.7/site-packages (from textract) (1.0.0)
Requirement already satisfied: beautifulsoup4==4.5.3 in ./anaconda2/lib/python2.7/site-packages (from textract) (4.5.3)
Requirement already satisfied: argcomplete==1.8.2 in ./anaconda2/lib/python2.7/site-packages (from textract) (1.8.2)
Requirement already satisfied: EbookLib==0.15 in ./anaconda2/lib/python2.7/site-packages (from textract) (0.15)
Collecting pocketsphinx==0.1.3 (from textract)
Using cached https://files.pythonhosted.org/packages/93/5f/a968e5d53d25e32deb78c3e169fd8612ecf53cc76e32cb40e19be35696af/pocketsphinx-0.1.3.tar.bz2
Collecting chardet==2.3.0 (from textract)
Using cached https://files.pythonhosted.org/packages/7e/5c/605ca2daa5cf21c87690d8fe6ab05a6f2278c451f4ede6456dd26453f4bd/chardet-2.3.0-py2.py3-none-any.whl
Requirement already satisfied: SpeechRecognition==3.6.3 in ./anaconda2/lib/python2.7/site-packages (from textract) (3.6.3)
Requirement already satisfied: Pillow>=2.6.1 in ./anaconda2/lib/python2.7/site-packages (from python-pptx==0.6.5->textract) (5.0.0)
Requirement already satisfied: XlsxWriter>=0.5.7 in ./anaconda2/lib/python2.7/site-packages (from python-pptx==0.6.5->textract) (1.0.2)
Requirement already satisfied: lxml>=3.1.0 in ./anaconda2/lib/python2.7/site-packages (from python-pptx==0.6.5->textract) (4.1.1)
Building wheels for collected packages: pocketsphinx
Running setup.py bdist_wheel for pocketsphinx ... error
Complete output from command /home/satyam/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-L5494L/pocketsphinx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-JVTDy9 --python-tag cp27:
running bdist_wheel
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/swig
creating build/temp.linux-x86_64-2.7/swig/sphinxbase
creating build/temp.linux-x86_64-2.7/deps
creating build/temp.linux-x86_64-2.7/deps/sphinxbase
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad
gcc -pthread -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/include/python2.7 -c swig/sphinxbase/ad_wrap.c -o build/temp.linux-x86_64-2.7/swig/sphinxbase/ad_wrap.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
gcc -pthread -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/include/python2.7 -c deps/sphinxbase/src/libsphinxad/ad_pulse.c -o build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad/ad_pulse.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
deps/sphinxbase/src/libsphinxad/ad_pulse.c:44:30: fatal error: pulse/pulseaudio.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pocketsphinx
Running setup.py clean for pocketsphinx
Failed to build pocketsphinx
boto3 1.7.6 requires botocore<1.11.0,>=1.10.6, which is not installed.
s3transfer 0.1.13 requires botocore<2.0.0,>=1.3.0, which is not installed.
grin 1.2.1 requires argparse>=1.1, which is not installed.
tensorflow-gpu 1.2.0 has requirement markdown==2.2.0, but you'll have markdown 2.6.11 which is incompatible.
requests 2.18.4 has requirement chardet<3.1.0,>=3.0.2, but you'll have chardet 2.3.0 which is incompatible.
Installing collected packages: pocketsphinx, chardet, textract
Running setup.py install for pocketsphinx ... error
Complete output from command /home/satyam/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-L5494L/pocketsphinx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-Dy07hO/install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/swig
creating build/temp.linux-x86_64-2.7/swig/sphinxbase
creating build/temp.linux-x86_64-2.7/deps
creating build/temp.linux-x86_64-2.7/deps/sphinxbase
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad
gcc -pthread -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/include/python2.7 -c swig/sphinxbase/ad_wrap.c -o build/temp.linux-x86_64-2.7/swig/sphinxbase/ad_wrap.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
gcc -pthread -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/include/python2.7 -c deps/sphinxbase/src/libsphinxad/ad_pulse.c -o build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad/ad_pulse.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
deps/sphinxbase/src/libsphinxad/ad_pulse.c:44:30: fatal error: pulse/pulseaudio.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/home/satyam/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-L5494L/pocketsphinx/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-Dy07hO/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-L5494L/pocketsphinx/
When I try, sudo apt-get install libpulse-dev
, I get the following error:
The following packages have unmet dependencies: libpulse-dev : Depends: libglib2.0-dev but it is not going to be installed E: Unable to correct problems, you have held broken packages.
Thogh, I tried installing with 'aptitude', libpulse-dev gets installed but the error for textract with aptitude is that it is not able to locate that package.
回答1:
Please install the following:
sudo apt-get install libglib2.0-0=2.48.0-1ubuntu4
sudo apt-get install libglib2.0-dev
sudo apt-get install libpulse-dev
sudo apt-get install swig
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-de
If the above command doesn't work, it's fine
sudo easy_install greenlet
sudo easy_install gevent
pip install textract
回答2:
Even i had the similar issue for python 3.5 with chardet version conflict where it was asking version above 3.0.1 but it was going to 2.3 because of multiple libraries with different versions. I resolved it by creating virtual env to run my particular project, this should be the approach if you have package requirement for only specific tasks.
来源:https://stackoverflow.com/questions/50421921/unable-to-install-textract