Deploy Python app to Heroku with extra pip installHow can I get a list of locally installed Python modules?How do I install pip on Windows?How to link a folder with an existing Heroku apppip install mysql-python fails with EnvironmentError: mysql_config not foundInstalling specific package versions with pipHow to install psycopg2 with “pip” on Python?How to install packages using pip according to the requirements.txt file from a local directory?Find which version of package is installed with pipHow do I install pip on macOS or OS X?Deploy Heroku app with package that is not available in pip
Student evaluations of teaching assistants
How does a character multiclassing into warlock get a focus?
apt-get update is failing in debian
Valid Badminton Score?
Where in the Bible does the greeting ("Dominus Vobiscum") used at Mass come from?
Displaying the order of the columns of a table
Why Were Madagascar and New Zealand Discovered So Late?
Is there any reason not to eat food that's been dropped on the surface of the moon?
How do I define a right arrow with bar in LaTeX?
What is the opposite of 'gravitas'?
Best way to store options for panels
Finding all intervals that match predicate in vector
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
Do I need a multiple entry visa for a trip UK -> Sweden -> UK?
Products and sum of cubes in Fibonacci
Tiptoe or tiphoof? Adjusting words to better fit fantasy races
What defines a dissertation?
Was the picture area of a CRT a parallelogram (instead of a true rectangle)?
Was Spock the First Vulcan in Starfleet?
How do I keep an essay about "feeling flat" from feeling flat?
Is there a good way to store credentials outside of a password manager?
Failed to fetch jessie backports repository
Personal Teleportation as a Weapon
The baby cries all morning
Deploy Python app to Heroku with extra pip install
How can I get a list of locally installed Python modules?How do I install pip on Windows?How to link a folder with an existing Heroku apppip install mysql-python fails with EnvironmentError: mysql_config not foundInstalling specific package versions with pipHow to install psycopg2 with “pip” on Python?How to install packages using pip according to the requirements.txt file from a local directory?Find which version of package is installed with pipHow do I install pip on macOS or OS X?Deploy Heroku app with package that is not available in pip
I'm trying to implement Deploy to Heroku functionality for my Python application:
https://github.com/jet-admin/jet-bridge/tree/heroku
It woks OK if just use requirements.txt to install dependencies, but it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient).
Is it possible not to include all requirements in requirements.txt, but install it with some extra command? I've tried adding postdeploy script which will perform pip install command, but after deploy succed my application says that psycopg2 is not installed (thought i installed it in postdeploy command).
python heroku pip tornado
add a comment |
I'm trying to implement Deploy to Heroku functionality for my Python application:
https://github.com/jet-admin/jet-bridge/tree/heroku
It woks OK if just use requirements.txt to install dependencies, but it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient).
Is it possible not to include all requirements in requirements.txt, but install it with some extra command? I've tried adding postdeploy script which will perform pip install command, but after deploy succed my application says that psycopg2 is not installed (thought i installed it in postdeploy command).
python heroku pip tornado
"it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient)"—why don't you normally need those packages? What's different on Heroku? (Note that developing with one database engine and deploying to another is a generally bad idea. They're not drop-in replacements for each other.) I think the reasonpostdeploy
isn't working is that it runs after your slug has already been compiled. Your libraries need to be included in the slug.
– Chris
Mar 21 at 16:50
@Chris because by application is compatible with many databases thanks to ORM. so code in repository should not have all possible database adapters, but for application on heroku I need to include all of them, so that users can deploy it to Heroku and use it with their specific database. Is it possible to pip install somehow another way without including dep in requirements.txt ?
– Denis Kildishev
Mar 22 at 6:35
If you want it to be run on Heroku I think your only options are (a) to include all of those dependencies inrequirements.txt
(or inPipfile
andPipfile.lock
if you would rather user Pipenv) or (b) to have your users modify those files before deploying.
– Chris
Mar 22 at 12:03
add a comment |
I'm trying to implement Deploy to Heroku functionality for my Python application:
https://github.com/jet-admin/jet-bridge/tree/heroku
It woks OK if just use requirements.txt to install dependencies, but it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient).
Is it possible not to include all requirements in requirements.txt, but install it with some extra command? I've tried adding postdeploy script which will perform pip install command, but after deploy succed my application says that psycopg2 is not installed (thought i installed it in postdeploy command).
python heroku pip tornado
I'm trying to implement Deploy to Heroku functionality for my Python application:
https://github.com/jet-admin/jet-bridge/tree/heroku
It woks OK if just use requirements.txt to install dependencies, but it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient).
Is it possible not to include all requirements in requirements.txt, but install it with some extra command? I've tried adding postdeploy script which will perform pip install command, but after deploy succed my application says that psycopg2 is not installed (thought i installed it in postdeploy command).
python heroku pip tornado
python heroku pip tornado
asked Mar 21 at 15:23
Denis KildishevDenis Kildishev
3601413
3601413
"it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient)"—why don't you normally need those packages? What's different on Heroku? (Note that developing with one database engine and deploying to another is a generally bad idea. They're not drop-in replacements for each other.) I think the reasonpostdeploy
isn't working is that it runs after your slug has already been compiled. Your libraries need to be included in the slug.
– Chris
Mar 21 at 16:50
@Chris because by application is compatible with many databases thanks to ORM. so code in repository should not have all possible database adapters, but for application on heroku I need to include all of them, so that users can deploy it to Heroku and use it with their specific database. Is it possible to pip install somehow another way without including dep in requirements.txt ?
– Denis Kildishev
Mar 22 at 6:35
If you want it to be run on Heroku I think your only options are (a) to include all of those dependencies inrequirements.txt
(or inPipfile
andPipfile.lock
if you would rather user Pipenv) or (b) to have your users modify those files before deploying.
– Chris
Mar 22 at 12:03
add a comment |
"it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient)"—why don't you normally need those packages? What's different on Heroku? (Note that developing with one database engine and deploying to another is a generally bad idea. They're not drop-in replacements for each other.) I think the reasonpostdeploy
isn't working is that it runs after your slug has already been compiled. Your libraries need to be included in the slug.
– Chris
Mar 21 at 16:50
@Chris because by application is compatible with many databases thanks to ORM. so code in repository should not have all possible database adapters, but for application on heroku I need to include all of them, so that users can deploy it to Heroku and use it with their specific database. Is it possible to pip install somehow another way without including dep in requirements.txt ?
– Denis Kildishev
Mar 22 at 6:35
If you want it to be run on Heroku I think your only options are (a) to include all of those dependencies inrequirements.txt
(or inPipfile
andPipfile.lock
if you would rather user Pipenv) or (b) to have your users modify those files before deploying.
– Chris
Mar 22 at 12:03
"it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient)"—why don't you normally need those packages? What's different on Heroku? (Note that developing with one database engine and deploying to another is a generally bad idea. They're not drop-in replacements for each other.) I think the reason
postdeploy
isn't working is that it runs after your slug has already been compiled. Your libraries need to be included in the slug.– Chris
Mar 21 at 16:50
"it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient)"—why don't you normally need those packages? What's different on Heroku? (Note that developing with one database engine and deploying to another is a generally bad idea. They're not drop-in replacements for each other.) I think the reason
postdeploy
isn't working is that it runs after your slug has already been compiled. Your libraries need to be included in the slug.– Chris
Mar 21 at 16:50
@Chris because by application is compatible with many databases thanks to ORM. so code in repository should not have all possible database adapters, but for application on heroku I need to include all of them, so that users can deploy it to Heroku and use it with their specific database. Is it possible to pip install somehow another way without including dep in requirements.txt ?
– Denis Kildishev
Mar 22 at 6:35
@Chris because by application is compatible with many databases thanks to ORM. so code in repository should not have all possible database adapters, but for application on heroku I need to include all of them, so that users can deploy it to Heroku and use it with their specific database. Is it possible to pip install somehow another way without including dep in requirements.txt ?
– Denis Kildishev
Mar 22 at 6:35
If you want it to be run on Heroku I think your only options are (a) to include all of those dependencies in
requirements.txt
(or in Pipfile
and Pipfile.lock
if you would rather user Pipenv) or (b) to have your users modify those files before deploying.– Chris
Mar 22 at 12:03
If you want it to be run on Heroku I think your only options are (a) to include all of those dependencies in
requirements.txt
(or in Pipfile
and Pipfile.lock
if you would rather user Pipenv) or (b) to have your users modify those files before deploying.– Chris
Mar 22 at 12:03
add a comment |
1 Answer
1
active
oldest
votes
The Heroku Python buildpack has a hook where you can execute extra commands after the initial slug compilation.
To use it, you can add a bin/post_compile
file, putting inside the shell commands for installing the extra packages.
You can even make it depend on an environment variable, like:
# assuming you have files mysql-requirements.txt and postgres-requirements.txt
if [ "$JET_BRIDGE_DB" == "mysql" ]; then
echo "Installing Python dependencies for MySQL support"
pip install -r mysql-requirements.txt
else
echo "Assuming Postgres database, installing Python dependencies"
pip install -r postgres-requirements.txt
fi
Read more:
- Buildpacks: https://devcenter.heroku.com/articles/buildpacks
- Heroku Python Buildpack: https://github.com/heroku/heroku-buildpack-python
- Slug compilation: https://devcenter.heroku.com/articles/slug-compiler
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283838%2fdeploy-python-app-to-heroku-with-extra-pip-install%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The Heroku Python buildpack has a hook where you can execute extra commands after the initial slug compilation.
To use it, you can add a bin/post_compile
file, putting inside the shell commands for installing the extra packages.
You can even make it depend on an environment variable, like:
# assuming you have files mysql-requirements.txt and postgres-requirements.txt
if [ "$JET_BRIDGE_DB" == "mysql" ]; then
echo "Installing Python dependencies for MySQL support"
pip install -r mysql-requirements.txt
else
echo "Assuming Postgres database, installing Python dependencies"
pip install -r postgres-requirements.txt
fi
Read more:
- Buildpacks: https://devcenter.heroku.com/articles/buildpacks
- Heroku Python Buildpack: https://github.com/heroku/heroku-buildpack-python
- Slug compilation: https://devcenter.heroku.com/articles/slug-compiler
add a comment |
The Heroku Python buildpack has a hook where you can execute extra commands after the initial slug compilation.
To use it, you can add a bin/post_compile
file, putting inside the shell commands for installing the extra packages.
You can even make it depend on an environment variable, like:
# assuming you have files mysql-requirements.txt and postgres-requirements.txt
if [ "$JET_BRIDGE_DB" == "mysql" ]; then
echo "Installing Python dependencies for MySQL support"
pip install -r mysql-requirements.txt
else
echo "Assuming Postgres database, installing Python dependencies"
pip install -r postgres-requirements.txt
fi
Read more:
- Buildpacks: https://devcenter.heroku.com/articles/buildpacks
- Heroku Python Buildpack: https://github.com/heroku/heroku-buildpack-python
- Slug compilation: https://devcenter.heroku.com/articles/slug-compiler
add a comment |
The Heroku Python buildpack has a hook where you can execute extra commands after the initial slug compilation.
To use it, you can add a bin/post_compile
file, putting inside the shell commands for installing the extra packages.
You can even make it depend on an environment variable, like:
# assuming you have files mysql-requirements.txt and postgres-requirements.txt
if [ "$JET_BRIDGE_DB" == "mysql" ]; then
echo "Installing Python dependencies for MySQL support"
pip install -r mysql-requirements.txt
else
echo "Assuming Postgres database, installing Python dependencies"
pip install -r postgres-requirements.txt
fi
Read more:
- Buildpacks: https://devcenter.heroku.com/articles/buildpacks
- Heroku Python Buildpack: https://github.com/heroku/heroku-buildpack-python
- Slug compilation: https://devcenter.heroku.com/articles/slug-compiler
The Heroku Python buildpack has a hook where you can execute extra commands after the initial slug compilation.
To use it, you can add a bin/post_compile
file, putting inside the shell commands for installing the extra packages.
You can even make it depend on an environment variable, like:
# assuming you have files mysql-requirements.txt and postgres-requirements.txt
if [ "$JET_BRIDGE_DB" == "mysql" ]; then
echo "Installing Python dependencies for MySQL support"
pip install -r mysql-requirements.txt
else
echo "Assuming Postgres database, installing Python dependencies"
pip install -r postgres-requirements.txt
fi
Read more:
- Buildpacks: https://devcenter.heroku.com/articles/buildpacks
- Heroku Python Buildpack: https://github.com/heroku/heroku-buildpack-python
- Slug compilation: https://devcenter.heroku.com/articles/slug-compiler
answered Mar 22 at 14:43
eliaselias
14.1k84882
14.1k84882
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55283838%2fdeploy-python-app-to-heroku-with-extra-pip-install%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"it require me to modify my requirements.txt to include some extra packages that i normally don't need (psycopg2, mysqlclient)"—why don't you normally need those packages? What's different on Heroku? (Note that developing with one database engine and deploying to another is a generally bad idea. They're not drop-in replacements for each other.) I think the reason
postdeploy
isn't working is that it runs after your slug has already been compiled. Your libraries need to be included in the slug.– Chris
Mar 21 at 16:50
@Chris because by application is compatible with many databases thanks to ORM. so code in repository should not have all possible database adapters, but for application on heroku I need to include all of them, so that users can deploy it to Heroku and use it with their specific database. Is it possible to pip install somehow another way without including dep in requirements.txt ?
– Denis Kildishev
Mar 22 at 6:35
If you want it to be run on Heroku I think your only options are (a) to include all of those dependencies in
requirements.txt
(or inPipfile
andPipfile.lock
if you would rather user Pipenv) or (b) to have your users modify those files before deploying.– Chris
Mar 22 at 12:03