pythonubuntuc9.io

Install python package zipline on cloud 9 environment Support workspace python


I am trying to install python on the cloud 9 environment.

I simply did below, from the installation tutorial:

pip install zipline

However, I get:

Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_ubuntu/zipline
Storing debug log for failure in /home/ubuntu/.pip/pip.log

My full log looks like the following:

------------------------------------------------------------
/usr/bin/pip run on Tue Sep 13 06:28:52 2016
Downloading/unpacking zipline
  Getting page https://pypi.python.org/simple/zipline/
  URLs to search for versions for zipline:
  * https://pypi.python.org/simple/zipline/
  Analyzing links from page https://pypi.python.org/simple/zipline/
    Found link https://pypi.python.org/packages/06/8e/8355df80f313706418ee9db3521c6f0578426d92b6dcddf396d58c4de2e6/zipline-1.0.2.tar.gz#md5=4c7958ad131ebbeeec7d4399bdeff12b (from https://pypi.python.org/simple/zipline/), version: 1.0.2
    Found link https://pypi.python.org/packages/17/d3/8c58193ec8052d86ff67c00a285a01f646d3d53106844716090c22bba15e/zipline-0.6.0.tar.gz#md5=75d818c291df133946bb15a1b08ae0d8 (from https://pypi.python.org/simple/zipline/), version: 0.6.0
    Found link https://pypi.python.org/packages/1f/8c/55ea3687c717bc532753860196222f12717201719625d043448ea94f4ff6/zipline-0.5.10.tar.gz#md5=48f394a5ea83848642d879cbeaba8342 (from https://pypi.python.org/simple/zipline/), version: 0.5.10
    Found link https://pypi.python.org/packages/22/4a/affbfd183fa4133d13ecebc069bf9887c7755e531175384b57879daecfe2/zipline-0.8.3.tar.gz#md5=042ffcee614d2279add9a1bfd27a33cf (from https://pypi.python.org/simple/zipline/), version: 0.8.3
    Found link https://pypi.python.org/packages/32/29/27e8b5963f1a366c95999ae420c0221f94c3622b69af02f51f7c8b57f086/zipline-0.7.0.tar.gz#md5=62d45c3c0d9a624e787b7e413937f7b4 (from https://pypi.python.org/simple/zipline/), version: 0.7.0
    Found link https://pypi.python.org/packages/46/84/4e00850f8cd2809b2630348d19d1ccb18959be0d82907cef5413fef6436b/zipline-0.5.9.tar.gz#md5=b8a983ba23b0c7d4ab18a59af9055ab6 (from https://pypi.python.org/simple/zipline/), version: 0.5.9
    Found link https://pypi.python.org/packages/48/fa/d7dc2e7aca9574b3e06c2d105bb268b85b54633ae8580afe4dd8d607e4be/zipline-0.5.3.tar.gz#md5=e0809b60dc3775868f35ca56d6801f62 (from https://pypi.python.org/simple/zipline/), version: 0.5.3
    Found link https://pypi.python.org/packages/51/12/9e062af374e826d13e01a705b8ce9532e954d24694cf807fc699fc0978b2/zipline-0.8.1.tar.gz#md5=39a01cc0b79927122abf9f0a9aa9361d (from https://pypi.python.org/simple/zipline/), version: 0.8.1
    Skipping https://pypi.python.org/packages/60/87/7d6d6bd43af11482551eb17cde392b034d7f9d5f43be6f805be51b7bef27/zipline-0.8.3-cp34-cp34m-macosx_10_10_x86_64.whl#md5=164b2ecae2d6debba9755f6cfa69633f (from https://pypi.python.org/simple/zipline/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/76/b7/c420885e7f7b7a664797674c85886a608ae441ae9a45631f9d997ad6392c/zipline-0.5.0.tar.gz#md5=a7cc9112ef0d028768bb80e05f4ce2b4 (from https://pypi.python.org/simple/zipline/), version: 0.5.0
    Skipping https://pypi.python.org/packages/7c/c5/ad47e2ec20b9fd9e907d5e01d448c9e7dbf82b3068301566baf0c628acf9/zipline-0.8.0-cp34-cp34m-macosx_10_10_x86_64.whl#md5=c455dc96d1b409b7592ed4f7db193429 (from https://pypi.python.org/simple/zipline/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/7e/51/cb0336444aeb679cda1aabb6d7c264c1ae8562488503728ee0b23a5101ce/zipline-0.5.5.tar.gz#md5=dca0bb54cfe6ec7c92340e30d8f07469 (from https://pypi.python.org/simple/zipline/), version: 0.5.5
    Skipping https://pypi.python.org/packages/82/2e/024769455739b6da65ccaa99fdb668acebf614e1db4e241bb4a1117efdda/zipline-0.8.0-cp27-none-macosx_10_10_x86_64.whl#md5=69bc977edb5b51e5411d04b816c00c56 (from https://pypi.python.org/simple/zipline/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/89/4b/c954275b6a6582c10b6e0ef80d7fe9486e269a26338b42c99795639a46d8/zipline-0.5.6.tar.gz#md5=ab0c71f227e63c61499237b0023964df (from https://pypi.python.org/simple/zipline/), version: 0.5.6
    Found link https://pypi.python.org/packages/95/9e/98e2f815f3dd4e8f49b48431f4fc9ff8336270a9c77f5da147cf05b346e1/zipline-0.7.0rc1.tar.gz#md5=5963340584c1bddd446c09bfbbedd38c (from https://pypi.python.org/simple/zipline/), version: 0.7.0rc1
    Found link https://pypi.python.org/packages/97/cf/75e5a64093facaf990baee15eaa2cec4bb204b73cc9aa16d2dbc020591f6/zipline-0.8.4.tar.gz#md5=b385dfee59a0b0408a8dcaae7c4c1d0e (from https://pypi.python.org/simple/zipline/), version: 0.8.4
    Found link https://pypi.python.org/packages/9a/aa/5c71f400aba2586619f43b577c99c571f45cc06db3674abc063d109db018/zipline-0.5.7.tar.gz#md5=1fd26989fe73eeb4ad0bb3f997311717 (from https://pypi.python.org/simple/zipline/), version: 0.5.7
    Found link https://pypi.python.org/packages/a9/5a/5b716619d4bf9b0424ff9f975f8e4bc28641b0f4ffaa57a455722bf60cff/zipline-0.5.4.tar.gz#md5=98e873cb49bbf397b4ca17f48432a9e2 (from https://pypi.python.org/simple/zipline/), version: 0.5.4
    Found link https://pypi.python.org/packages/b5/52/708c93e51bb3e9b49dcdd9641e62fa5f1c60cf4172c0cf45567a2dece996/zipline-0.8.2.tar.gz#md5=2ddca99691409ebb8c85012ddbaecb19 (from https://pypi.python.org/simple/zipline/), version: 0.8.2
    Found link https://pypi.python.org/packages/c2/5a/0471cad4b5b392074c78622a782c2614b5c3bab68418ae3c4315031d12be/zipline-1.0.1.tar.gz#md5=645d7df6286b16466df5ed8225fd2dc7 (from https://pypi.python.org/simple/zipline/), version: 1.0.1
    Skipping https://pypi.python.org/packages/d5/34/f211a756945bc765dfeddb86d31b99b2992c123279a24c26cfd7d942575d/zipline-0.8.3-cp27-none-macosx_10_10_x86_64.whl#md5=1c87ce91a7b559b14be657c164e78c87 (from https://pypi.python.org/simple/zipline/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/d9/90/05ad3dc4e6fee0b890e5316113a2eea457a85928382ae7eacec346937f6c/zipline-0.6.1.tar.gz#md5=e07499447eccdfc97d57478daef4d114 (from https://pypi.python.org/simple/zipline/), version: 0.6.1
    Found link https://pypi.python.org/packages/dc/e0/341e3c5775201b998bd69a81c2b47cc2b40d09c56730163f4b6a9ef4336d/zipline-0.5.2.tar.gz#md5=a99e177d7aeb780b00884119069b2f36 (from https://pypi.python.org/simple/zipline/), version: 0.5.2
    Found link https://pypi.python.org/packages/df/ef/ffab7fc9bc6d4e833446a012421b470ff8c67f118a5efdbe0a593690aaa0/zipline-0.5.8.tar.gz#md5=512bb1ca2a13861c6128a852e627193f (from https://pypi.python.org/simple/zipline/), version: 0.5.8
    Found link https://pypi.python.org/packages/ec/98/e46201a8c0041112c67e7563bdd0d2c2f930f037f27cf157d1210406e0d2/zipline-0.9.0.tar.gz#md5=020494f647c8f5adab3a06ddb7e42dcc (from https://pypi.python.org/simple/zipline/), version: 0.9.0
    Found link https://pypi.python.org/packages/ee/b4/c445d8b4821e8a170dc46de3d058ea07b0fdc3dedce4f9692ebca408ebb6/zipline-0.5.1.tar.gz#md5=2f91b1c1081a401cee28b6f8583da150 (from https://pypi.python.org/simple/zipline/), version: 0.5.1
    Found link https://pypi.python.org/packages/f3/42/449f570dca8b46edc0a65e35ce5543b6b4d1ee7b8bfebd06277b054442f7/zipline-1.0.0.tar.gz#md5=cc04ef77b46b631ea05b9953b9c6d587 (from https://pypi.python.org/simple/zipline/), version: 1.0.0
  Ignoring link https://pypi.python.org/packages/95/9e/98e2f815f3dd4e8f49b48431f4fc9ff8336270a9c77f5da147cf05b346e1/zipline-0.7.0rc1.tar.gz#md5=5963340584c1bddd446c09bfbbedd38c (from https://pypi.python.org/simple/zipline/), version 0.7.0rc1 is a pre-release (use --pre to allow).
  Using version 1.0.2 (newest of versions: 1.0.2, 1.0.1, 1.0.0, 0.9.0, 0.8.4, 0.8.3, 0.8.2, 0.8.1, 0.7.0, 0.6.1, 0.6.0, 0.5.10, 0.5.9, 0.5.8, 0.5.7, 0.5.6, 0.5.5, 0.5.4, 0.5.3, 0.5.2, 0.5.1, 0.5.0)
  Downloading from URL https://pypi.python.org/packages/06/8e/8355df80f313706418ee9db3521c6f0578426d92b6dcddf396d58c4de2e6/zipline-1.0.2.tar.gz#md5=4c7958ad131ebbeeec7d4399bdeff12b (from https://pypi.python.org/simple/zipline/)
  Running setup.py (path:/tmp/pip_build_ubuntu/zipline/setup.py) egg_info for package zipline
    warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.pxd' under directory 'Cython/Utility'
    Unable to find pgen, not compiling formal grammar.

    Installed /tmp/pip_build_ubuntu/zipline/Cython-0.24.1-py2.7-linux-x86_64.egg
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_ubuntu/zipline/setup.py", line 300, in <module>
        **conditional_arguments
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 239, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 264, in fetch_build_eggs
        replace_conflicting=True
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 620, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 852, in best_match
        dist = working_set.find(req)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 503, in find
        raise VersionConflict(dist,req)     # XXX add more info
    pkg_resources.VersionConflict: (numpy 1.8.2 (/usr/lib/python2.7/dist-packages), Requirement.parse('numpy>=1.9.2'))
    Complete output from command python setup.py egg_info:
    warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'

warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'

warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'

warning: no files found matching '*.pxd' under directory 'Cython/Utility'

Unable to find pgen, not compiling formal grammar.



Installed /tmp/pip_build_ubuntu/zipline/Cython-0.24.1-py2.7-linux-x86_64.egg

Traceback (most recent call last):

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

  File "/tmp/pip_build_ubuntu/zipline/setup.py", line 300, in <module>

    **conditional_arguments

  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 239, in __init__

    self.fetch_build_eggs(attrs.pop('setup_requires'))

  File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 264, in fetch_build_eggs

    replace_conflicting=True

  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 620, in resolve

    dist = best[req.key] = env.best_match(req, ws, installer)

  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 852, in best_match

    dist = working_set.find(req)

  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 503, in find

    raise VersionConflict(dist,req)     # XXX add more info

pkg_resources.VersionConflict: (numpy 1.8.2 (/usr/lib/python2.7/dist-packages), Requirement.parse('numpy>=1.9.2'))

----------------------------------------
Cleaning up...
  Removing temporary dir /tmp/pip_build_ubuntu...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_ubuntu/zipline
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1230, in prepare_files
    req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 326, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 715, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_ubuntu/zipline

Any suggestions, why it is not working?

I appreciate your replies!


Solution

  • As recommended by zipline's documentation, this answer uses a virtualenv in which we use pip to install and manage zipline and its dependencies.

    First, go to the terminal in your Cloud9 IDE to update the package lists and install the necessary dependencies and python-virtualenv:

    sudo apt-get update
    sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev python-virtualenv
    

    Note that numpy is required but unfortunately, the python-numpy package in the Ubuntu 14.04 repositories is too old for zipline, so we use pip instead to install numpy.

    Now, create a virtualenv at your project directory, activate the virtualenv, upgrade pip and setuptools, and then install numpy and zipline:

    virtualenv venv  # create a virtualenv called venv
    source venv/bin/activate  # activate virtualenv
    pip install -U pip setuptools  # upgrade pip and setuptools
    pip install numpy  # install numpy
    pip install zipline  # install zipline
    

    The pip installation for zipline will take a while; please be patient. Once you are done working in the virtualenv, deactivate it by running:

    deactivate