Pankaj Lal
Pankaj Lal

Reputation: 317

pip install from requirements work but unable to find the same libraries through ansible

I have a few local packages that I install through Requirements.txt. This is a sample from Requirements.txt

-e apisdk

This works fine through

pip install -r Requirements.txt

The result is that pip runs

pip setup.py develop

for the apisdk package. This is the expected behavior

However when the same is called through ansible

tasks:
    - pip: virtualenv={{env_dir}}/testenv
           virtualenv_python=python2.7
           requirements={{app_dir}}/Requirements.txt

I receive following error

apisdk should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+

Where am I going wrong. I am not running ansible from the app_dir directory but another place.

Upvotes: 3

Views: 1858

Answers (1)

Pankaj Lal
Pankaj Lal

Reputation: 317

Found the answer. The pip command also supports a chdir parameter. Change the directory to app_dir before running pip. This solved the issue.

Upvotes: 2

Related Questions