nanobox-io / nanobox-engine-python

Engine for running Python apps on Nanobox
https://nanobox.io
MIT License
12 stars 13 forks source link

python-3.6 and psycopg2 (Error: pg_config executable not found.) #45

Open vashchukmaksim opened 6 years ago

vashchukmaksim commented 6 years ago

I'm trying to setup an environment with nanobox python engine. If I use python-2.7 and then install a psycopg2 package (pip command within a container or with a requirements.txt) it works ok. But when I switch to python-3.6 I got an error "Error: pg_config executable not found.". This is a well known issue but I can't solve it with a nanobox container. I can't install any dependencies (python3-dev or libpq-dev) since there is none of these in Nanobox pkgsrc and even can't find a path to pg_conf.

Is there any way to use python3 with psycopg2 with nanobox?

My starting config:

run.config: engine: python engine.config: runtime: python-3.6 extra_packages: - nodejs cache_dirs: - client/node_modules extra_path_dirs: - client/node_modules/.bin build_triggers: - server/requirements.txt - client/package.json - client/package-lock.json extra_steps: - cd server && pip install -r requirements.txt - cd client && npm install fs_watch: true

data.postgresql: image: nanobox/postgresql config: version: 9.6 `

fsecada01 commented 6 years ago

in extra_packages, declare pkgin as a new dependency.

After that, write nanobox run in your command line, and write in pkgin install postgresql93. Then write `pkgin export > pkgin_dependencies.txt' or whatever extension is your notepad application. Then declare in extra_steps:

'pkgin im pkgin_dependencies.txt -y'

That should resolve your issue, hopefully.

danhunsaker commented 6 years ago

Note that pkgin is already installed, since it's the package manager installing extra_packages in the first place, so you can skip adding it to your configuration.