# rax.py "pyrax is required for this module"

**URL:** <https://forum.ansible.com/t/rax-py-pyrax-is-required-for-this-module/15320>\
**Category:** Ansible Project\
**Created:** [May 23, 2014, 5:01pm UTC](https://forum.ansible.com/t/rax-py-pyrax-is-required-for-this-module/15320 "2014-05-23T17:01:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [May 23, 2014, 5:01pm UTC](https://forum.ansible.com/t/rax-py-pyrax-is-required-for-this-module/15320/1 "2014-05-23T17:01:45Z")

</div>

This is confusing. I’ve definitely installed the pyrax module. Here is my workflow:

`

# /opt/wp/Python-2.7.5/bin/virtualenv venv

# source venv/bin/activate

# pip install git+git://github.com/rackspace/pyrax.git --upgrade

# ansible-playbook apps/rackspace/play\_rackspace.yml -i apps/rackspace/rax/rax.py

`

I would expect this to run the rax.py inventory file just fine but its failing now. I’ve destroyed the virtualenv and recreated it to no avail.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 23, 2014, 5:10pm UTC](https://forum.ansible.com/t/rax-py-pyrax-is-required-for-this-module/15320/2 "2014-05-23T17:10:48Z")

</div>

Have you tried running the inventory module directly? /opt/wp/Python-2.7.5/bin/python /path/to/apps/rackspace/rax/rax.py

I run the rax.py inventory script from a virtualenv without issue.

You might also try something like running ‘pip freeze’ and ‘/opt/wp/Python-2.7.5/bin/python -c “import pyrax; print pyrax. **file** ”’ to see if pyrax is indeed installed in the virtualenv.

Also, you might want to try installing pyrax from pypi instead of git. pip can do strange things installing from git sometimes, especially without providing “#egg=pyrax” on the end. ‘master’ in github for pyrax is the same version you get from pypi.

One other thought, is that it could be you are missing a dependency of pyrax, which the python -c command above may help you identify. But I might try first doing “pip install -I pyrax”

---

<div class="post-metadata">

**Author:** ![david.neudorfer](https://avatars.discourse-cdn.com/v4/letter/d/b38774/32.png) [@david.neudorfer](https://forum.ansible.com/u/david.neudorfer)\
**Post date:** [May 23, 2014, 5:20pm UTC](https://forum.ansible.com/t/rax-py-pyrax-is-required-for-this-module/15320/3 "2014-05-23T17:20:01Z")

</div>

running rax.py from python in the virtualenv worked:

`(venv)[mozart@m-bamboo01 hegemon]$ venv/bin/python apps/rackspace/rax/rax.py usage: rax.py [-h] (--list | --host HOST) rax.py: error: one of the arguments --list --host is required`  
`

When I run using the system wide python it fails:

` `  
(venv)[mozart@m-bamboo01 hegemon]$ /opt/wp/Python-2.7.5/bin/python -c “import pyrax; print pyrax. **file** ”  
Traceback (most recent call last):  
File “”, line 1, in   
ImportError: No module named pyrax  
`

It was trying to run ansible-playbook using the system wide python. As soon as I gave it the path to the ansible-playbook within the virtualenv everything began to work. I hope this helps others that run into the same problem. Your tips really helped!
