Installing Python Packages



Cloud9 supports the installation of Python packages for applications that need to go beyond the standard library set. Every workspace has version 0.6.10 of Python’s easy_install package manager. For more information on this module, see the official easy_install documentation.

Let’s try installing a package. First, type the following in the console:

sudo easy_install markdown

easy_install Requires Sudo
Be sure to use sudo. If you do not, you will get a “permission denied” error.

This installs the markdown Python package to your workspace. You won’t see the package installed in the directory tree, because it’s kept deep within your project’s Python libs.

Next, create a new Python script, and add these lines of code:

import markdown

html = markdown.markdown("# HELLO THERE!")

print html

After clicking run, the console will correctly print out <h1>HELLO THERE!</h1>.

You have access to all of the functionality easy_install provides you. For example, you can open up the Python REPL and type the following to see a list of your installed packages:

>>> help('modules')

Python modules not importing / installing packages
Tutorials - Table of Contents

Mysteriously, this seems to fail when claiming to succeed? I asked it to install the OpenCV cv2 module:

joker_b:~/workspace (master) $ sudo easy_install cv2
Searching for cv2
Best match: cv2 1.0
Writing /tmp/easy_install-1PRS_F/cv2-1.0/setup.cfg
Running cv2-1.0/ -q bdist_egg --dist-dir /tmp/easy_install-1PRS_F/cv2-1.0/egg-dist-tmp-FGYbLT
zip_safe flag not set; analyzing archive contents...
Adding cv2 1.0 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/cv2-1.0-py2.7.egg
Processing dependencies for cv2
Finished processing dependencies for cv2

but then

joker_b:~/workspace (master) $ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>> exit()

and checking help('modules') doesn’t show cv2 either


And you get the same functionality when you call it from an actual Python script as well?


Sadly, yes.

Traceback (most recent call last):                                                                                                
  File "/home/ubuntu/workspace/python/", line 10, in <module>                                                         
    import cv2                                                                                                                    
ImportError: No module named cv2


Is there any way to get pygame?


Should work without any issues. You may need to use the desktop GUI plugin to get it working.


Trying to install pycurl with “sudo easy_install pycurl”, but I get this error during the script:

main.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory


Any idea why I’m getting this error? Thanks! :slight_smile:

**:~/workspace/test01 $ sudo easy_install markdown
Searching for markdown
Best match: Markdown 3.0.1
Processing Markdown-3.0.1-py2.7.egg
Markdown 3.0.1 is already the active version in easy-install.pth
Installing markdown_py script to /usr/local/bin

Using /usr/local/lib/python2.7/dist-packages/Markdown-3.0.1-py2.7.egg
Processing dependencies for markdown
Finished processing dependencies for markdown

**:~/workspace/test01 $ python
Traceback (most recent call last):
File “”, line 1, in
import markdown
File “/home/ubuntu/workspace/test01/”, line 3, in
html = markdown.markdown("# HELLO THERE!")
TypeError: ‘module’ object is not callable


Hi, I think I figured out the problem but I need your help to fix it. When anyone creates a workspace, it automatically sets it in python 2.7. The user can set the preference in python 3. Interestingly, there are a bunch of modules already installed in the database but unfortunately they are in the 2.7 folders. The user needs to copy them to the python 3 utility sets and it will work. I just need to know how to do that. I am not that proficient with the console.