Frage

In my dev environment, due to some networking problems, when I run:

(my-virt-env)$ pip install lxml

It always fails due to:

Downloading/unpacking lxml
  Downloading lxml-3.1.2.tar.gz (3.3Mb): 1.2Mb downloaded
Exception:
Traceback (most recent call last):
  blablabla
error: [Errno 104] Connection reset by peer

Then I downloaded lxml-3.1.2.tar.gz from somewhere else and used an usb key to copy it over. Is there anyway I can tell pip not bother to go to the Internet for this package, just install it via the local tar.gz? So I can do something like:

(my-virt-env)$ pip install ${local_path}/lxml*.tar.gz

tried this command, I get very long error message:

pip install /home/shengjie/Downloads/lxml-3.1.2.tar.gz 
Unpacking /home/shengjie/Downloads/lxml-3.1.2.tar.gz
  Running setup.py egg_info for package from file:///home/shengjie/Downloads/lxml-3.1.2.tar.gz
    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
      warnings.warn(msg)
    Building lxml version 3.1.2.
    Building without Cython.
    ERROR: /bin/sh: 1: xslt-config: not found

    ** make sure the development packages of libxml2 and libxslt are installed **
    ......................
    bla bla bla
    ......................

/tmp/pip-Vg13dM-build/src/lxml/includes/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1


I am running Ubuntu, I know you can run `apt-get install python-lxml` and get it installed on your box. But that doesn't work for my case as I want install it in my virtual env: `my-virt-env`. 
War es hilfreich?

Lösung 2

What I'm seeing is that it's complaining that the DEV version of libxml2 and libxslt are missing.

Do an apt-get installation of those 2 packages, libxml2-dev and libxslt-dev, and perform your pip installation again and see how that goes.

Andere Tipps

You can do it, the command is:

pip install --no-index --find-links=file:///[absolute path to your tar.gz]
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top