There's this Python
package called aiopg
for working with the PostgreSQL
database asynchronously. It has two dependencies - async-timeout
and psycopg2-binary
. I don't want it to install psycopg2-binary
when using pip
because I use the regular psycopg2
package. This is because the authors of psycopg2-binary
do not recommend using it in production.
This all does not create any problems working locally because I can add the desired dependency of aiopg
to requirements.txt
leaving out the undesired one, and then run two separate commands:
pip install -r requirements.txt
pip install aiopg --no-deps
But when I push my project to Elastic Beanstalk
it uses requirements.txt
to install Python
packages and I don't know how to run the additional pip
command.
I tried adding pip3 install aiopg --no-deps
and also different variations of this command to eb.config
(both to commands
and container_commands
sections) but to no avail.
Right now my eb.config
looks like so:
packages:
yum:
amazon-linux-extras: []
commands:
01_postgres_activate:
command: sudo amazon-linux-extras enable postgresql11
02_postgres_install:
command: sudo yum install -y postgresql-devel
container_commands:
01_aiopg_install:
command: python3 -m pip install aiopg==1.2.1 --no-deps
But this is not woking. The Beanstalk environment is in Severe
state and my web.stdout.log
still contains this error:
web: ModuleNotFoundError: No module named 'aiopg'
.
So how do I implement this additional pip
command with --no-deps
flag which is not supported inside requirements.txt
files yet?