Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8262327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:43:25+00:00 2026-06-08T03:43:25+00:00

I’d like to modify the setup.py script from the Ansible project so that I

  • 0

I’d like to modify the setup.py script from the Ansible project so that I can install ansible into a virtualenv like so:

pip install -e git://github.com/lorin/ansible.git#egg=ansible

When I do this now, ansible doesn’t run properly, because it can’t import the ansible module.

$ ansible
Traceback (most recent call last):
  File "/Users/lorin/.virtualenvs/ansible/bin/ansible", line 7, in <module>
    execfile(__file__)
  File "/Users/lorin/.virtualenvs/ansible/src/ansible/bin/ansible", line 25, in     <module>
    from ansible.runner import Runner
ImportError: No module named ansible.runner

From what I can tell, one or both of these files tells Python where to find the Ansible module.

$venv/lib/python2.7/sites-packages/ansible.egg-link:

/Users/lorin/.virtualenvs/ansible/src/ansible
.

$venv/lib/python2.7/sites-packages/easy-install.pth:

import sys; sys.__plen = len(sys.path)
./setuptools-0.6c11-py2.7.egg
./pip-1.0.2-py2.7.egg
/Users/lorin/.virtualenvs/ansible/src/ansible
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

In both cases, it points to /Users/lorin/.virtualenvs/ansible/src/ansible, but I think it should actually point to /Users/lorin/.virtualenvs/ansible/src/ansible/lib, since the ansible module is a subset of that directory.

(Note: I can’t just move the ansible/lib/ansible directory to ansible/ansible since the upstream project is unlikely to accept that change).

I tried to modify these files by hand to see if that would resolve the issue, but that revealed a new problem:

$ ansible
Traceback (most recent call last):
  File "/Users/lorin/.virtualenvs/ansible/bin/ansible", line 4, in <module>
    from pkg_resources import require; require('ansible==0.6')
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 2603, in <module>
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 666, in require
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: ansible==0.6

And, “pip freeze” does not report that the package was installed at all:

$ pip freeze
Jinja2==2.6
PyYAML==3.10
paramiko==1.7.7.2
pycrypto==2.6
wsgiref==0.1.2

Even once I resolve these issues, I need to somehow set the ANSIBLE_LIBRARY environment variable to point to $venv/src/ansible/library when the virtualenv is activated.

So, to sum up, what do I need to do to:

  • Get the various Python paths to point to the right directory?
  • Deal with the version error?
  • Set the ANSIBLE_LIBRARY environment variable?

I also don’t want to change the behavior of the setup.py script for the other use cases. I don’t have any experience with any of the various Python build tools, so I’m at a loss.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:43:26+00:00Added an answer on June 8, 2026 at 3:43 am

    The problem with editable installation (-e flag) is that it requires the project to have a struct like:

    ├── projectname
    │   ├── projectname
    │   │   ├── __init__.py
    │   │   └── anotherfile.py
    │   └── setup.py
    

    Notice that projectname subdirectory. In Ansible‘s case, it does not have this structure. So it does not work using editable install.

    Just remove that -e flag and it might work:

    pip install -e git://github.com/lorin/ansible.git#egg=ansible
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I am currently running into a problem where an element is coming back from
I would like to count the length of a string with PHP. The string
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.