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













0















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).










share|improve this question






















  • "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 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















0















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).










share|improve this question






















  • "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 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













0












0








0








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).










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 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 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

















  • "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 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
















"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












1 Answer
1






active

oldest

votes


















0














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





share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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





    share|improve this answer



























      0














      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





      share|improve this answer

























        0












        0








        0







        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





        share|improve this answer













        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






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 22 at 14:43









        eliaselias

        14.1k84882




        14.1k84882





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript