Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 956
Pankaj Lal Avatar asked Dec 28 '25 16:12

Pankaj Lal


1 Answers

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

like image 179
Pankaj Lal Avatar answered Dec 30 '25 04:12

Pankaj Lal