I am using openpyxl python package in my application. I am getting the following message when using the same.
/usr/local/lib/python2.7/dist-packages/openpyxl/init.py:31:
UserWarning: The installed version of lxml is too old to be used with
openpyxl
warnings.warn("The installed version of lxml is too old to be used with openpyxl")
Openpyxl requires lxml version 3.2.5 or above, and the version in my machine is 3.2.0. When I try to upgrade lxml to the latest version ie
3.3.5, it is getting interrupted with the following message.
i686-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-i686-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.7/lxml/etree.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'i686-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of lxml
Replacing /usr/lib/python2.7/dist-packages/lxml
Replacing /usr/lib/python2.7/dist-packages/lxml-3.2.0.egg-info
Cleaning up...
Removing temporary dir /tmp/pip_build_root...
Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip_build_root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ov0PUy-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/lxml
I need help in resolving the issue.
PS:- I have already installed lxml dependent packages python-dev, libxml2-dev and libxslt1-dev in my machine.
sudo pip install --upgrade lxml
On Ubuntu (and other Debian derivatives), before you build some piece of software, ensure that its build dependencies are installed. Using your example, run this:
sudo apt-get build-dep python-lxml
That is likely going to require a whole bunch of packages, one of which is zlib1g-dev, as mentioned.
I think what you're missing is zlib1g-dev.
sudo apt-get install zlib1g-dev
Running above command will solve the issue.
Related
I am running Centos7 with Python 3.6. I am trying to install pycrypto with the command "pip3 install pycrypto". I also installed the dev tools, so gcc is installed. I am getting the following output.
What am I missing?
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/src
gcc -pthread -Wno-unused-result -Wsign-compare -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.6m -c src/MD2.c -o build/temp.linux-x86_64-3.6/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-h6pl3s2f/pycrypto/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-9fjag3e5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-h6pl3s2f/pycrypto/
That did not work, but I did find the answer in the article.
I ran "yum -y install python3-devel" and this fixed my issue. I was then able to install pycrypto.
I also had the same issue for CentOS.
However, it turned out I was missing one of the dependencies.
sudo yum install gcc
sudo yum install gcc-c++
sudo yum install python-devel
sudo pip install pycrypto
I am running mysql#8.x version on my MacOS, I have installed mysql and mysql-connector-o with brew. Currently brew link with mysql.
Running Django project on my python3 virtual env I am receiving following error -
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'.
Did you install mysqlclient or MySQL-python?
and on installing the mysqlclient using pip, I am reciving following error
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -Dversion_info=(1,3,13,'final',0) -D__version__=1.3.13 -I/usr/local/Cellar/mysql/8.0.12/include/mysql -I/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c _mysql.c -o build/temp.macosx-10.13-x86_64-3.6/_mysql.o
clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk build/temp.macosx-10.13-x86_64-3.6/_mysql.o -L/usr/local/Cellar/mysql/8.0.12/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-x86_64-3.6/_mysql.cpython-36m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Volumes/Samsung_T5/Work/python/repos/venv3/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-kf2fkhtc/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-qwpjjw3e/install-record.txt --single-version-externally-managed --compile --install-headers /Volumes/Samsung_T5/Work/python/repos/venv3/bin/../include/site/python3.6/mysqlclient" failed with error code 1 in /private/tmp/pip-install-kf2fkhtc/mysqlclient/
As jordanm pointed it out, the issue was exactly with the missing openssl libraries, for which I followed these steps to fix my issue -
Installing openssl
brew install openssl
Now
pip install mysqlclient should work.
If it doesn't and still shows the same error library not found for -lssl, you could also try to link against brew's openssl:
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install mysqlclient
if this still does not work, you might need to use the --no-cache option of pip, e.g.
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install mysqlclient
After installing openssl via Homebrew I placed
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
in my .bash_profile and ran
source .bash_profile
and then
pip install mysqlclient
Im trying to install lxml within a virtualenv with sudo pip install lxml and also sudo pip install --upgrade lxml but getting the following in both cases:
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,
relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes
-D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -lxslt
-lexslt -lxml2 -lz -lm -o build/lib.linux-x86_64-2.7/lxml/etree.so
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools,
tokenize;__file__='/tmp/pip_build_root/lxml/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),
__file__, 'exec'))" install --record /tmp/pip-nmFOYf-record/install-record.txt
--single-version-externally-managed --compile failed with error code 1 in
/tmp/pip_build_root/lxml
Storing debug log for failure in /root/.pip/pip.log
I have tried all the posted solutions here, which implies that I have libxml2-dev, libxslt-dev and python-dev installed and I also installed build-essential
I'm currently running Linux Mint 17 Debian Based which uses apt-get as package manager.
python-lxml was already preinstalled.
lxml depends on various C libraries, and you have to have those C libraries installed—including their development files (headers, .so or .a libraries, etc.)—to build lxml. The installation docs explain what prerequisites you need to build on your particular platform.
This error:
/usr/bin/ld: cannot find -lz
… means that the prerequisite you're missing is libz, aka zlib.
Since you're not on Windows, it's incredibly unlikely that you actually don't have zlib at all… but pretty plausible that you don't have the development files for zlib. On some platforms, most notably many linux distros, packages are typically split into separate pieces. For example, the parts of zlib needed at runtime may be in a package named zlib, while the parts needed for building other programs that need zlib in a package named zlib-dev or zlib-devel. The exact details depend on your exact platform.
That being said, if you don't have the zlib development files, you probably don't have the libxml2 or libxslt development files either, because I don't know of any platform where installing those wouldn't have pulled in the zlib files as well.
At any rate, since you haven't told us what platform you're one (and distro, if linux), I don't know what package manager to use, what the packages are named, etc., but do whatever's appropriate for your platform.
Also:
I already have python-lxml installed
You really shouldn't install the same package both with your distro's package manager and with pip; that's a great way to confuse yourself.
But at any rate, most likely you installed python-lxml from a binary package, not from source, which means you didn't need the build requirements. Now you're trying to build it from source, which means you do.
On an ubuntu based linux distro you can use:
sudo apt-get install zlib1g-dev
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Installing SciPy with pip
I want to install a new version of SciPy which is 0.11.0 and the current version which I have is 0.9.0.
It is installed by this command:
sudo apt-get install python-scipy
I have tried installing 0.11.0 from sources, but I could not.
Is there already an apt-get for 0.11.0?
EDIT 1
Following is the error when I build from source or do an easy install.
Setup script exited with error: Command "/usr/bin/g77 -g -Wall -g -Wall -shared
build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -
ldfftpack -lfftpack -lg2c -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so"
failed with exit status 1
/usr/lib/pymodules/python2.7/numpy/distutils/misc_util.py:251: RuntimeWarning: Parent
module 'numpy.distutils' not found while handling absolute import
from numpy.distutils import log
EDIT 2
That issue has been resolved, and the error is now the following.
gcc: build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.c
/usr/bin/g77 -g -Wall -g -Wall -shared build/temp.linux-x86_64-2.7/build/src.linux-
x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/drfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-
2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -ldfftpack -lfftpack -lg2c -o
build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
error: Command "/usr/bin/g77 -g -Wall -g -Wall -shared build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/_fftpackmodule.o build/temp.linux-
x86_64-2.7/scipy/fftpack/src/zfft.o build/temp.linux-x86_64-
2.7/scipy/fftpack/src/drfft.o build/temp.linux-x86_64-2.7/scipy/fftpack/src/zrfft.o
build/temp.linux-x86_64-2.7/scipy/fftpack/src/zfftnd.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dct.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/scipy/fftpack/src/dst.o build/temp.linux-x86_64-
2.7/build/src.linux-x86_64-2.7/fortranobject.o -Lbuild/temp.linux-x86_64-2.7 -
ldfftpack -lfftpack -lg2c -o build/lib.linux-x86_64-2.7/scipy/fftpack/_fftpack.so"
failed with exit status 1
EDIT 3
I have asked this question [here], but the issue is not solved yet.
Any thoughts?
If you have all the basic prerequisites installed as described in the INSTALL.txt file, it should be fairly straightforward by doing a:
sudo python setupy.py install
from within the directory where you extracted the scipy0.11.0 tarball. This should make the library inside your current default Python version.
You can check whether you have the prerequisites by just running:
sudo apt-get install python python-dev libatlas3-base-dev gcc gfortran g++
as explained again in the INSTALL.TXT.
I'm having a ton of trouble installing modules. At first I thought I had messed with my python installation on mac os x but I installed a virtual machine and ubuntu 11.04 and have similar troubles. Why are both os x and ubuntu failing with the same error?
For example I can't install tkinter with it failing:
Installing collected packages: tkinter-pypy
Running setup.py install for tkinter-pypy
building '_tkinter' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DWITH_APPINIT -I/usr/include/tcl -I/usr/include/tk -I/usr/include/python2.7 -c src/_tkinter.c -o build/temp.linux-i686-2.7/src/_tkinter.o
src/_tkinter.c:74:17: fatal error: tcl.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pfm/build/tkinter-pypy/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-sMB5Wi-record/install-record.txt:
running install
running build
running build_ext
building '_tkinter' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DWITH_APPINIT -I/usr/include/tcl -I/usr/include/tk -I/usr/include/python2.7 -c src/_tkinter.c -o build/temp.linux-i686-2.7/src/_tkinter.o
src/_tkinter.c:74:17: fatal error: tcl.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/pfm/build/tkinter-pypy/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-sMB5Wi-record/install-record.txt failed with error code 1
Storing complete log in /home/pfm/.pip/pip.log
I encountered exactly the same problem when trying to install tkinter-pypy on Ubuntu 11.04. The error message shows that it's looking for tcl.h file in /usr/include/tcl, but it's not there. I have to install the dev version of the tcl library (I installed tcl8.4-dev).
sudo apt-get install tcl8.4-dev
This installs the header files to /usr/include/tcl8.4. I then created a symlink /usr/include/tcl pointing to that. I also installed the dev version of the tk library (e.g. tk8.4-dev) which installed the tk.h header (needed too by tkinter-pypy) in the /usr/include/tcl directory.
After these steps, tkinter-pypy can be installed successfully.
Not sure about the error, but Tkinter should be available with your Python install. Have you tried to import Tkinter. On a related note I'd definitely recommend using setuptools (aka. easy_install) or one of the other similar installation tools.
EDIT
If Tkinter is still not available, then, on Linux, try locate lib-tk and adding it to your python path
import sys;
sys.path.append(PATH_TO_TK)
Then check out the Wiki to get the setup to stick: http://wiki.python.org/moin/TkInter
Another EDIT
A simple work around might be to install IDLE, which depends on Tkinter (noted by the OP).