Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install fails with FileNotFoundError: setup.py

When running pip install, I'm getting errors like this:

$ pip install pycairo
Downloading/unpacking pycairo
  You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
  Downloading pycairo-1.10.0.tar.bz2 (246kB): 246kB downloaded
  Running setup.py egg_info for package pycairo
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
    FileNotFoundError: [Errno 2] No such file or directory: '/home/naught101/.virtualenvs/virtualenv-3/build/pycairo/setup.py'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

FileNotFoundError: [Errno 2] No such file or directory: '/home/naught101/.virtualenvs/virtualenv-3/build/pycairo/setup.py'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/naught101/.virtualenvs/virtualenv-3/build/pycairo
Storing complete log in /home/naught101/.pip/pip.log

This is happening for pycairo, sip.

$ pip --version
pip 1.4.1 from /home/naught101/.virtualenvs/virtualenv-3/lib/python3.3/site-packages (python 3.3)
like image 227
naught101 Avatar asked Oct 01 '13 23:10

naught101


1 Answers

pycairo is not built by setuptools, and therefore can't be installed by pip.

As the INSTALL documentation says:

Install Procedure
-----------------
$ ./waf --help     # shows available waf options
$ ./waf configure  # use --prefix and --libdir if necessary
                   # --prefix=/usr --libdir=/usr/lib64  for Fedora 64-bit
$ ./waf build
$ ./waf install

Use
$ python3 ./waf ...
if you have python2 and python3 installed, and the default is python 2.

You can still use pip to fetch it:

$ pip install --download=. pycairo
Downloading/unpacking pycairo
  Downloading pycairo-1.10.0.tar.bz2 (246kB): 246kB downloaded
$ tar xf pycairo-1.10.0.tar.bz2
$ cd pycairo-1.10.0
$ python ./waf etc.

Just make sure you use the Python from your virtualenv, and pass the right options to the configure command (--prefix=$VIRTUAL_ENV should be sufficient, but don't quote me on that; you might also have to set the PYTHON environment variable to the path to your virtualenv Python, or other things).


Another option is to use an alternate set of Cairo bindings, like cairocffi. But that's obviously a big change, which may not be appropriate.

like image 185
abarnert Avatar answered Oct 28 '22 19:10

abarnert