poise / poise-python

A Chef cookbook to provide a unified interface for installing Python, managing Python packages, and creating virtualenvs.
Apache License 2.0
124 stars 109 forks source link

Allow environment variables to be specified on pip_requirements resource #77

Open fletchowns opened 7 years ago

fletchowns commented 7 years ago

I have psycopg2 in my requirements.txt which requires pg_config to be on the PATH. Mine wasn't so the install fails.

It seems like it might be useful to be able to specify environment variables on the pip_requirements resource for stuff like this, unless there's a better way to be going about this.

As a workaround I added a symlink to a location I knew was already on the existing PATH:

link "/usr/local/bin/pg_config" do
    to "/usr/pgsql-#{node["postgresql"]["version"]}/bin/pg_config"
end
fletchowns commented 7 years ago

I think this one may also help with my broken uwsgi installation via pip_requirements as well. It ended up being because of /opt/chef/embedded/bin being on the PATH.

I was able to work around it by using an execute resource and resetting PATH:

execute "pip install -r requirements.txt" do
    environment({
        "PATH" => "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
    })
end