1

I want to install Pyquery 1.2.4 version, but when I try

 pip install pyquery==1.2.4

I face with

  Compile failed: command 'gcc' failed with exit status 1
    creating tmp
    cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitXZJM6c.c -o tmp/xmlXPathInitXZJM6c.o
    /tmp/xmlXPathInitXZJM6c.c:1:26: error: libxml/xpath.h: No such file or directory
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-cmQUrb/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-YFpKDF-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-cmQUrb/lxml

    No matching distribution found for python-pyquery

I know it because my Python version (2.6), and I can't update it to 2.7 because of yum

How can I resolve this problem?

Yuseferi
  • 7,931
  • 11
  • 67
  • 103
  • 1
    Try this: `sudo apt-get install libxml2-dev libxslt1-dev python-dev` –  Jan 17 '16 at 14:16

3 Answers3

3

You may possibly be missing XML dependencies which your GCC compiler is spitting out at you, which can be installed with the following:

yum install libxslt-devel libxml2-devel libxml2 libxslt

After installing each the development and release dependencies, try:

pip install pyquery==1.2.4

Which should successfully execute. You should be also able to update Python with the following method: here. (Probably depends on your OS version.)

The above method explains:

yum install -y centos-release-SCL 
yum install -y python27

Okay for centos 6.4 also On apu.0xdata.loc, after this install was done

$ which python 
/usr/local/bin/python

$ python -V
Python 2.7.3

$ ls -ltr /usr/local/bin/pyth*
lrwxrwxrwx 1 root root      24 Jan 30  2013 /usr/local/bin/python -> /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 6162289 Sep  3 00:59 /usr/local/bin/python2.7
-rwxr-xr-x 1 root root    1624 Sep  3 01:00 /usr/local/bin/python2.7-config

So yum will use '/usr/bin/python' which is 2.6

$ /usr/bin/python -V
Python 2.6.6

"python" will give you python 2.7.

"python2.7" will give you python 2.7.

"easy_install" and "easy_install-2.7" will easy install for python 2.7. While separate files, they both seem to install into /usr/local/lib/python2.7/site-packages/

  • I am on centos and I try them with yum install but ** * updates: mirror.city.net.tr No package install available. No package libxml2-dev available. No package libxslt1-dev available. No package python-dev a** – Yuseferi Jan 17 '16 at 14:20
  • @zhilevan Try running: `yum list | grep xml`, and see if the packages are there, with a different name. –  Jan 17 '16 at 14:24
  • @zhilevan They should be somewhat similar to: `libxml2-devel` and `libxslt-devel`. –  Jan 17 '16 at 14:27
  • @zhilevan All went well? –  Jan 17 '16 at 15:29
  • tnx for your answer, you answer help me to find my way, before this step I try to `yum install python-lxml` and try your answer and everything work correctly, tnx – Yuseferi Jan 17 '16 at 17:18
  • @zhilevan Great news! Have fun. –  Jan 18 '16 at 01:33
1

You are missing some OS related dependencies.

Try this:

apt-get install libxml2-dev libxslt1-dev python-dev
Avihoo Mamka
  • 4,656
  • 3
  • 31
  • 44
0

Or try this:

sudo apt install libxml2-dev libxslt1-dev python-dev

Or so:

sudo apt install python-pyquery
alex10
  • 2,726
  • 3
  • 22
  • 35
  • I am on centos and I try them with yum install but ** * updates: mirror.city.net.tr No package install available. No package libxml2-dev available. No package libxslt1-dev available. No package python-dev a** my problem is because my python version, – Yuseferi Jan 17 '16 at 14:21