0

I'm getting the following error when trying to install certain Python package on Ubuntu 16.04 LTS. I've googled fixes but none so far have worked and all seem to be very specific to a particular package. Is there a universal fix, can some explain to me what the underlying problem is?

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9w8mswlw/tsne/

The most recent occurrence is when I run pip3 install tsne

The output is as follows

Collecting tsne
  Using cached tsne-0.1.7.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-9w8mswlw/tsne/setup.py", line 18, in <module>
        from Cython.Distutils import build_ext
    ImportError: No module named 'Cython'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9w8mswlw/tsne/
Nick Duddy
  • 910
  • 6
  • 20
  • 36

1 Answers1

2

You need to install the Cython language compiler. This is listed on the project page:

A python (cython) wrapper for Barnes-Hut-SNE aka fast-tsne.

and

Requirements

  • numpy > =1.7.1
  • scipy >= 0.12.0
  • cython >= 0.19.1
  • cblas or openblas. Tested version is v0.2.5 and v0.2.6 (not necessary for OSX).

You can install Cython with

pip install Cython

While the tsne project does list Cython as a setuptools requirement, they unfortunately did not list it as an setup requirement, and assume it is already installed up front.

I filed a bug report with that project; in future point projects to setup_requires with Cython? so that pip install project_depending_on_cython pulls in Cython automatically when installing.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343