# Installation, Dependencies and Compatibility

- Dependencies

  - most of functionality

  - particles support

  - audio and video support by AVbin

  - audio support by SDL

- Compatibility

- Installing

- Using PYTHONPATH or .pth

## Dependencies

### most of functionality

> - six https://pypi.python.org/pypi/six/

> - pyglet https://github.com/pyglet/pyglet

### particles support

> - numpy www.numpy.org

### audio and video support by AVbin

> - AVbin http://avbin.github.io/AVbin/Home/Home.html

### audio support by SDL

> - in Windows, pygame http://www.pygame.org

> - in unix-like OSes libraries sdl 1.2 and sdl-mixer 1.2; in debian/ubuntu their packages are libsdl1.2 and libsdl-mixer1.2

> - in Mac, theres no confirmed info. Should be similar to unix.

What explicit dependencies are declared in the setup.py ? six and pyglet

## Compatibility

Compatibility notes at the time of writing, August 2019

> - python : cocos needs python 2.7 or 3.4+ The cocos codebase has direct support for 2.x and 3.x, so no need to run 2to3

> - pyglet : pyglet between 1.2 and 1.32 better (1.3+ recomended). Not compatible with 1.4

## Installing

Have a modern setuptools or pip installed.

While:

    python -m pip install cocos2d

works, you will miss the docs and code samples. Its is therefore recommended to

> - install six and pyglet, pay attention to the pyglet version, see above

> - download cocos2d-0.6.6.zip from https://pypi.python.org/pypi/cocos2d/

> - decompress to a convenient location, the top dir will be cocos2d-0.6.6

> - the html docs will be in cocos2d-0.6.6/doc/html

> - useful code samples will be in cocos2d-0.6.6/test, cocos2d-0.6.6/samples, cocos2d-0.6.6/utest

> - install by:

>       cd cocos2d-0.6.6
>       python -m pip install -e .

>   or alternatively by pointing that directory from a .pth or PYTHONPATH

> - All of cocos should be usable now, with the possible exceptions

>   > - cocos particles

>   > - SDL audio backend

>   > - AVBin (pyglet) audio-video backend

If you want to add these, look at the dependencies section.

## Using PYTHONPATH or .pth

It is safe to point a checkout of cocos from a .pth or PYTHONPATH both in python 2.x and 3.x; the same checkout can be pointed at the same time from both pythons.

The same is valid for pyglet vs 1.3+ (but note that at pyglet 1.3.0rc1 you will need to also install the pakage ‘future’)

Pyglet with version < 1.3 does python 3 compatibility by running 2to3 at install time, so while a pyglet checkout can be pointed from a .pth or PYTHONPATH in python 2.x, that will not work for python 3.