What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

Can a tourist shoot a gun in the USA?

Will a coyote attack my dog on a leash while I'm on a hiking trail?

Labeling matrices/rectangles and drawing Sigma inside rectangle

How can I answer high-school writing prompts without sounding weird and fake?

Is there ever any indication in the MCU as to how Spider-Man got his powers?

Jumping frame contents with beamer and pgfplots

Would an 8% reduction in drag outweigh the weight addition from this custom CFD-tested winglet?

Is it possible to create different colors in rocket exhaust?

German characters on US-International keyboard layout

Does gravity affect the time evolution of a QM wave function?

51% attack - apparently very easy? refering to CZ's "rollback btc chain" - How to make sure such corruptible scenario can never happen so easily?

Why are solar panels kept tilted?

Is Germany still exporting arms to countries involved in Yemen?

Unexpected Netflix account registered to my Gmail address - any way it could be a hack attempt?

Help in identifying a mystery wall socket

Frame adjustment for engine

Rounding a number extracted by jq to limit the decimal points

Why did the metro bus stop at each railway crossing, despite no warning indicating a train was coming?

Anatomically Correct Carnivorous Tree

Why do the lights go out when someone enters the dining room on this ship?

Solubility in different pressure conditions

Is taking modulus on both sides of an equation valid?

What is the largest number of identical satellites launched together?

return tuple of uncopyable objects



What if the end-user didn't have the required library?


What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








15















My Python project uses various kind of libraries. What is the protocol if the end-user didn't have one or any of them?



Should a window pop up and notify him/her which package and version to download in his/her environment? Or I should include the libraries within my project?



What's the proper action?










share|improve this question
























  • Depends on what you mean by "proper".

    – Scott Hunter
    May 2 at 13:20











  • Related: Best practice to install dependencies?

    – Aran-Fey
    May 2 at 13:22

















15















My Python project uses various kind of libraries. What is the protocol if the end-user didn't have one or any of them?



Should a window pop up and notify him/her which package and version to download in his/her environment? Or I should include the libraries within my project?



What's the proper action?










share|improve this question
























  • Depends on what you mean by "proper".

    – Scott Hunter
    May 2 at 13:20











  • Related: Best practice to install dependencies?

    – Aran-Fey
    May 2 at 13:22













15












15








15


8






My Python project uses various kind of libraries. What is the protocol if the end-user didn't have one or any of them?



Should a window pop up and notify him/her which package and version to download in his/her environment? Or I should include the libraries within my project?



What's the proper action?










share|improve this question
















My Python project uses various kind of libraries. What is the protocol if the end-user didn't have one or any of them?



Should a window pop up and notify him/her which package and version to download in his/her environment? Or I should include the libraries within my project?



What's the proper action?







python python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 2 at 22:17







Kepler 186

















asked May 2 at 13:17









Kepler 186Kepler 186

896




896












  • Depends on what you mean by "proper".

    – Scott Hunter
    May 2 at 13:20











  • Related: Best practice to install dependencies?

    – Aran-Fey
    May 2 at 13:22

















  • Depends on what you mean by "proper".

    – Scott Hunter
    May 2 at 13:20











  • Related: Best practice to install dependencies?

    – Aran-Fey
    May 2 at 13:22
















Depends on what you mean by "proper".

– Scott Hunter
May 2 at 13:20





Depends on what you mean by "proper".

– Scott Hunter
May 2 at 13:20













Related: Best practice to install dependencies?

– Aran-Fey
May 2 at 13:22





Related: Best practice to install dependencies?

– Aran-Fey
May 2 at 13:22












5 Answers
5






active

oldest

votes


















13














Whatever your project is, you could try making it into a python package that the end-user would install. The way this works is



In the root directory of your package you would include a setup.py. You could include in this file a list of requirements/dependencies (the install_requires key) that would be installed along with your package when the end-user installs it.



The end user could then use pip to install your package eg



pip install YourPackage


and all dependencies listed in setup.py would be installed first.



Additionally, as @Devesh Kumar Singh pointed out in his comment, you could also include a requirements.txt file. The user could then install using this file with



pip install -r requirements.txt YourPackage


See this guide for building a python package,
setuptools documentation






share|improve this answer

























  • Interesting. Also, I could just include os.system("pip install -r requirements.txt") in the setup.py right? Or the requirements.txt meant to be read by the user?

    – Kepler 186
    May 2 at 13:54







  • 1





    @RSHAP No, that would conflate the environment with the dependencies

    – Arne
    May 2 at 13:59






  • 2





    @RSHAP dstufft on the matter: caremad.io/posts/2013/07/setup-vs-requirement

    – Arne
    May 2 at 14:00






  • 2





    yes, if you build your code into a package and have set up setup.py correctly by giving it all the dependencies in its setup('requires'=[...]) field, they will be fetched automatically if you try to install your package

    – Arne
    May 2 at 14:05







  • 1





    @Kepler186 And if the end user uses pip3 instead? Or if they use python -m pip instead (because pip isn't in the environment variables)? There are many flaws with your os approach.

    – MilkyWay90
    May 2 at 23:49


















5














To show other users, what libraries are needed for your project, you have multiple options. All options are some kind of files, that say which libraries are needed for this project.



Files that I am aware of




  • requirements.txt: very simple


  • setup.py: Used when you publish your project on sides like pypi https://stackoverflow.com/a/1472014/8411228


  • Pipfile: The way to go when you work in an virtualenv https://docs.pipenv.org/en/latest/


  • environment.yml: Used for Conda environments https://tdhopper.com/blog/my-python-environment-workflow-with-conda/#fn:requirements-conda





share|improve this answer






























    3














    Another option: You can use PyInstaller to freeze (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.



    PyInstaller Quickstart



    This has worked very well for me. Indeed, you do not have to worry about whether the final user has Python installed.






    share|improve this answer






























      1














      Here is where packaging a python project into a module comes handy modules
      We include a requirements.txt file which contains all python module requirements needed for that python library, and installs them automatically when the module is setup.



      A good primer on how to setup your module to be distributable is Structuring your project






      share|improve this answer

























      • Just a requirements.txt is not enough right? I think you also need an __init__.py, setup.py and maybe more. docs.python-guide.org/writing/structure

        – 3UqU57GnaX
        May 2 at 13:24











      • Yes, the question was about how to installed required libraries, which are listed in requirements.txt, and on top of it, we have these things you mentioned!

        – Devesh Kumar Singh
        May 2 at 13:25


















      1














      So you made a package. Now you will want to share it. What next?



      Developer



      Goal - make a distribution (also called a "package") to share



      Preamble



      You are now packaging your package and wish to distribute it. There are two main kinds of packages:



      • an application: deploy a source to a server, github, website e.g. CLI

      • a library: publish a source distribution (sdist) or binary (e.g. wheel) usually to PyPI via twine

      Traditional Ways



      Several files may be included in a distribution, but here are the main ones:



      • source: your code


      • setup.py: specify metadata, and dependencies required to make an sdist.


      • requirements.txt: a list of dependencies

      Contemporary Ways



      Use pyproject.toml to specify which tool to use in creating your sdist or binary:



      Modern tools to create + deploy/publish a package include:




      1. pipenv: makes a package and substitutes requirements.txt (recommended by PyPA)

        • develop: > pipenv install <dependency>, > pipenv install

        • publish: > pipenv -e . + twine



      2. poetry: makes a package and publishes to PyPI

        • develop > poetry add <dependency>, > poetry install

        • publish: > poetry publish



      3. flit: makes a package and publishes to PyPI

        • develop: > flit install

        • publish: > flit publish


      The first two options have features to make clean virtual environments and safely install dependencies using lock files. I would encourage exploring these newer options later on as they clear up a lot of packaging headaches by obviating setup.py and setuptools.




      User



      Goal - get a package and install it with dependencies



      Traditional Ways



      Applications have a variety of deployment methods, e.g. uploading your app to a hosting service e.g. heroku, DigitalOcean, etc. The user may indirectly interface with your app through a website, CLI or more.



      Libraries are often uploaded to PyPI. From here the user can usually install a package using pip independent from how they are made:




      • > pip install <package> (recommended)


      • > pip install <packatge> -r requirements (explicit, optional)

      These commandline invocations will fetch the distribution from PyPI, install the package and specified dependencies.



      Contemporary Ways



      Here are some alternatives to pip:




      1. pipx: "safely" install packages in isolated environments

        • > pipx install <package>


      See Also




      • Official docs on publishing packages by PyPA


      • Tutorial on How To Package Your Python Code


      • Podcast interview with B. Cannon on pyproject.toml and modern packaging tools





      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%2f55953391%2fwhat-if-the-end-user-didnt-have-the-required-library%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        13














        Whatever your project is, you could try making it into a python package that the end-user would install. The way this works is



        In the root directory of your package you would include a setup.py. You could include in this file a list of requirements/dependencies (the install_requires key) that would be installed along with your package when the end-user installs it.



        The end user could then use pip to install your package eg



        pip install YourPackage


        and all dependencies listed in setup.py would be installed first.



        Additionally, as @Devesh Kumar Singh pointed out in his comment, you could also include a requirements.txt file. The user could then install using this file with



        pip install -r requirements.txt YourPackage


        See this guide for building a python package,
        setuptools documentation






        share|improve this answer

























        • Interesting. Also, I could just include os.system("pip install -r requirements.txt") in the setup.py right? Or the requirements.txt meant to be read by the user?

          – Kepler 186
          May 2 at 13:54







        • 1





          @RSHAP No, that would conflate the environment with the dependencies

          – Arne
          May 2 at 13:59






        • 2





          @RSHAP dstufft on the matter: caremad.io/posts/2013/07/setup-vs-requirement

          – Arne
          May 2 at 14:00






        • 2





          yes, if you build your code into a package and have set up setup.py correctly by giving it all the dependencies in its setup('requires'=[...]) field, they will be fetched automatically if you try to install your package

          – Arne
          May 2 at 14:05







        • 1





          @Kepler186 And if the end user uses pip3 instead? Or if they use python -m pip instead (because pip isn't in the environment variables)? There are many flaws with your os approach.

          – MilkyWay90
          May 2 at 23:49















        13














        Whatever your project is, you could try making it into a python package that the end-user would install. The way this works is



        In the root directory of your package you would include a setup.py. You could include in this file a list of requirements/dependencies (the install_requires key) that would be installed along with your package when the end-user installs it.



        The end user could then use pip to install your package eg



        pip install YourPackage


        and all dependencies listed in setup.py would be installed first.



        Additionally, as @Devesh Kumar Singh pointed out in his comment, you could also include a requirements.txt file. The user could then install using this file with



        pip install -r requirements.txt YourPackage


        See this guide for building a python package,
        setuptools documentation






        share|improve this answer

























        • Interesting. Also, I could just include os.system("pip install -r requirements.txt") in the setup.py right? Or the requirements.txt meant to be read by the user?

          – Kepler 186
          May 2 at 13:54







        • 1





          @RSHAP No, that would conflate the environment with the dependencies

          – Arne
          May 2 at 13:59






        • 2





          @RSHAP dstufft on the matter: caremad.io/posts/2013/07/setup-vs-requirement

          – Arne
          May 2 at 14:00






        • 2





          yes, if you build your code into a package and have set up setup.py correctly by giving it all the dependencies in its setup('requires'=[...]) field, they will be fetched automatically if you try to install your package

          – Arne
          May 2 at 14:05







        • 1





          @Kepler186 And if the end user uses pip3 instead? Or if they use python -m pip instead (because pip isn't in the environment variables)? There are many flaws with your os approach.

          – MilkyWay90
          May 2 at 23:49













        13












        13








        13







        Whatever your project is, you could try making it into a python package that the end-user would install. The way this works is



        In the root directory of your package you would include a setup.py. You could include in this file a list of requirements/dependencies (the install_requires key) that would be installed along with your package when the end-user installs it.



        The end user could then use pip to install your package eg



        pip install YourPackage


        and all dependencies listed in setup.py would be installed first.



        Additionally, as @Devesh Kumar Singh pointed out in his comment, you could also include a requirements.txt file. The user could then install using this file with



        pip install -r requirements.txt YourPackage


        See this guide for building a python package,
        setuptools documentation






        share|improve this answer















        Whatever your project is, you could try making it into a python package that the end-user would install. The way this works is



        In the root directory of your package you would include a setup.py. You could include in this file a list of requirements/dependencies (the install_requires key) that would be installed along with your package when the end-user installs it.



        The end user could then use pip to install your package eg



        pip install YourPackage


        and all dependencies listed in setup.py would be installed first.



        Additionally, as @Devesh Kumar Singh pointed out in his comment, you could also include a requirements.txt file. The user could then install using this file with



        pip install -r requirements.txt YourPackage


        See this guide for building a python package,
        setuptools documentation







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 2 at 19:26









        Mooseman

        16.5k116184




        16.5k116184










        answered May 2 at 13:25









        RSHAPRSHAP

        1,071417




        1,071417












        • Interesting. Also, I could just include os.system("pip install -r requirements.txt") in the setup.py right? Or the requirements.txt meant to be read by the user?

          – Kepler 186
          May 2 at 13:54







        • 1





          @RSHAP No, that would conflate the environment with the dependencies

          – Arne
          May 2 at 13:59






        • 2





          @RSHAP dstufft on the matter: caremad.io/posts/2013/07/setup-vs-requirement

          – Arne
          May 2 at 14:00






        • 2





          yes, if you build your code into a package and have set up setup.py correctly by giving it all the dependencies in its setup('requires'=[...]) field, they will be fetched automatically if you try to install your package

          – Arne
          May 2 at 14:05







        • 1





          @Kepler186 And if the end user uses pip3 instead? Or if they use python -m pip instead (because pip isn't in the environment variables)? There are many flaws with your os approach.

          – MilkyWay90
          May 2 at 23:49

















        • Interesting. Also, I could just include os.system("pip install -r requirements.txt") in the setup.py right? Or the requirements.txt meant to be read by the user?

          – Kepler 186
          May 2 at 13:54







        • 1





          @RSHAP No, that would conflate the environment with the dependencies

          – Arne
          May 2 at 13:59






        • 2





          @RSHAP dstufft on the matter: caremad.io/posts/2013/07/setup-vs-requirement

          – Arne
          May 2 at 14:00






        • 2





          yes, if you build your code into a package and have set up setup.py correctly by giving it all the dependencies in its setup('requires'=[...]) field, they will be fetched automatically if you try to install your package

          – Arne
          May 2 at 14:05







        • 1





          @Kepler186 And if the end user uses pip3 instead? Or if they use python -m pip instead (because pip isn't in the environment variables)? There are many flaws with your os approach.

          – MilkyWay90
          May 2 at 23:49
















        Interesting. Also, I could just include os.system("pip install -r requirements.txt") in the setup.py right? Or the requirements.txt meant to be read by the user?

        – Kepler 186
        May 2 at 13:54






        Interesting. Also, I could just include os.system("pip install -r requirements.txt") in the setup.py right? Or the requirements.txt meant to be read by the user?

        – Kepler 186
        May 2 at 13:54





        1




        1





        @RSHAP No, that would conflate the environment with the dependencies

        – Arne
        May 2 at 13:59





        @RSHAP No, that would conflate the environment with the dependencies

        – Arne
        May 2 at 13:59




        2




        2





        @RSHAP dstufft on the matter: caremad.io/posts/2013/07/setup-vs-requirement

        – Arne
        May 2 at 14:00





        @RSHAP dstufft on the matter: caremad.io/posts/2013/07/setup-vs-requirement

        – Arne
        May 2 at 14:00




        2




        2





        yes, if you build your code into a package and have set up setup.py correctly by giving it all the dependencies in its setup('requires'=[...]) field, they will be fetched automatically if you try to install your package

        – Arne
        May 2 at 14:05






        yes, if you build your code into a package and have set up setup.py correctly by giving it all the dependencies in its setup('requires'=[...]) field, they will be fetched automatically if you try to install your package

        – Arne
        May 2 at 14:05





        1




        1





        @Kepler186 And if the end user uses pip3 instead? Or if they use python -m pip instead (because pip isn't in the environment variables)? There are many flaws with your os approach.

        – MilkyWay90
        May 2 at 23:49





        @Kepler186 And if the end user uses pip3 instead? Or if they use python -m pip instead (because pip isn't in the environment variables)? There are many flaws with your os approach.

        – MilkyWay90
        May 2 at 23:49













        5














        To show other users, what libraries are needed for your project, you have multiple options. All options are some kind of files, that say which libraries are needed for this project.



        Files that I am aware of




        • requirements.txt: very simple


        • setup.py: Used when you publish your project on sides like pypi https://stackoverflow.com/a/1472014/8411228


        • Pipfile: The way to go when you work in an virtualenv https://docs.pipenv.org/en/latest/


        • environment.yml: Used for Conda environments https://tdhopper.com/blog/my-python-environment-workflow-with-conda/#fn:requirements-conda





        share|improve this answer



























          5














          To show other users, what libraries are needed for your project, you have multiple options. All options are some kind of files, that say which libraries are needed for this project.



          Files that I am aware of




          • requirements.txt: very simple


          • setup.py: Used when you publish your project on sides like pypi https://stackoverflow.com/a/1472014/8411228


          • Pipfile: The way to go when you work in an virtualenv https://docs.pipenv.org/en/latest/


          • environment.yml: Used for Conda environments https://tdhopper.com/blog/my-python-environment-workflow-with-conda/#fn:requirements-conda





          share|improve this answer

























            5












            5








            5







            To show other users, what libraries are needed for your project, you have multiple options. All options are some kind of files, that say which libraries are needed for this project.



            Files that I am aware of




            • requirements.txt: very simple


            • setup.py: Used when you publish your project on sides like pypi https://stackoverflow.com/a/1472014/8411228


            • Pipfile: The way to go when you work in an virtualenv https://docs.pipenv.org/en/latest/


            • environment.yml: Used for Conda environments https://tdhopper.com/blog/my-python-environment-workflow-with-conda/#fn:requirements-conda





            share|improve this answer













            To show other users, what libraries are needed for your project, you have multiple options. All options are some kind of files, that say which libraries are needed for this project.



            Files that I am aware of




            • requirements.txt: very simple


            • setup.py: Used when you publish your project on sides like pypi https://stackoverflow.com/a/1472014/8411228


            • Pipfile: The way to go when you work in an virtualenv https://docs.pipenv.org/en/latest/


            • environment.yml: Used for Conda environments https://tdhopper.com/blog/my-python-environment-workflow-with-conda/#fn:requirements-conda






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 2 at 13:28









            Uli SotschokUli Sotschok

            648114




            648114





















                3














                Another option: You can use PyInstaller to freeze (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.



                PyInstaller Quickstart



                This has worked very well for me. Indeed, you do not have to worry about whether the final user has Python installed.






                share|improve this answer



























                  3














                  Another option: You can use PyInstaller to freeze (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.



                  PyInstaller Quickstart



                  This has worked very well for me. Indeed, you do not have to worry about whether the final user has Python installed.






                  share|improve this answer

























                    3












                    3








                    3







                    Another option: You can use PyInstaller to freeze (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.



                    PyInstaller Quickstart



                    This has worked very well for me. Indeed, you do not have to worry about whether the final user has Python installed.






                    share|improve this answer













                    Another option: You can use PyInstaller to freeze (packages) Python applications into stand-alone executables, under Windows, GNU/Linux, Mac OS X, FreeBSD, Solaris and AIX.



                    PyInstaller Quickstart



                    This has worked very well for me. Indeed, you do not have to worry about whether the final user has Python installed.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 2 at 16:18









                    user11293039user11293039

                    311




                    311





















                        1














                        Here is where packaging a python project into a module comes handy modules
                        We include a requirements.txt file which contains all python module requirements needed for that python library, and installs them automatically when the module is setup.



                        A good primer on how to setup your module to be distributable is Structuring your project






                        share|improve this answer

























                        • Just a requirements.txt is not enough right? I think you also need an __init__.py, setup.py and maybe more. docs.python-guide.org/writing/structure

                          – 3UqU57GnaX
                          May 2 at 13:24











                        • Yes, the question was about how to installed required libraries, which are listed in requirements.txt, and on top of it, we have these things you mentioned!

                          – Devesh Kumar Singh
                          May 2 at 13:25















                        1














                        Here is where packaging a python project into a module comes handy modules
                        We include a requirements.txt file which contains all python module requirements needed for that python library, and installs them automatically when the module is setup.



                        A good primer on how to setup your module to be distributable is Structuring your project






                        share|improve this answer

























                        • Just a requirements.txt is not enough right? I think you also need an __init__.py, setup.py and maybe more. docs.python-guide.org/writing/structure

                          – 3UqU57GnaX
                          May 2 at 13:24











                        • Yes, the question was about how to installed required libraries, which are listed in requirements.txt, and on top of it, we have these things you mentioned!

                          – Devesh Kumar Singh
                          May 2 at 13:25













                        1












                        1








                        1







                        Here is where packaging a python project into a module comes handy modules
                        We include a requirements.txt file which contains all python module requirements needed for that python library, and installs them automatically when the module is setup.



                        A good primer on how to setup your module to be distributable is Structuring your project






                        share|improve this answer















                        Here is where packaging a python project into a module comes handy modules
                        We include a requirements.txt file which contains all python module requirements needed for that python library, and installs them automatically when the module is setup.



                        A good primer on how to setup your module to be distributable is Structuring your project







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited May 2 at 13:26

























                        answered May 2 at 13:22









                        Devesh Kumar SinghDevesh Kumar Singh

                        8,8531728




                        8,8531728












                        • Just a requirements.txt is not enough right? I think you also need an __init__.py, setup.py and maybe more. docs.python-guide.org/writing/structure

                          – 3UqU57GnaX
                          May 2 at 13:24











                        • Yes, the question was about how to installed required libraries, which are listed in requirements.txt, and on top of it, we have these things you mentioned!

                          – Devesh Kumar Singh
                          May 2 at 13:25

















                        • Just a requirements.txt is not enough right? I think you also need an __init__.py, setup.py and maybe more. docs.python-guide.org/writing/structure

                          – 3UqU57GnaX
                          May 2 at 13:24











                        • Yes, the question was about how to installed required libraries, which are listed in requirements.txt, and on top of it, we have these things you mentioned!

                          – Devesh Kumar Singh
                          May 2 at 13:25
















                        Just a requirements.txt is not enough right? I think you also need an __init__.py, setup.py and maybe more. docs.python-guide.org/writing/structure

                        – 3UqU57GnaX
                        May 2 at 13:24





                        Just a requirements.txt is not enough right? I think you also need an __init__.py, setup.py and maybe more. docs.python-guide.org/writing/structure

                        – 3UqU57GnaX
                        May 2 at 13:24













                        Yes, the question was about how to installed required libraries, which are listed in requirements.txt, and on top of it, we have these things you mentioned!

                        – Devesh Kumar Singh
                        May 2 at 13:25





                        Yes, the question was about how to installed required libraries, which are listed in requirements.txt, and on top of it, we have these things you mentioned!

                        – Devesh Kumar Singh
                        May 2 at 13:25











                        1














                        So you made a package. Now you will want to share it. What next?



                        Developer



                        Goal - make a distribution (also called a "package") to share



                        Preamble



                        You are now packaging your package and wish to distribute it. There are two main kinds of packages:



                        • an application: deploy a source to a server, github, website e.g. CLI

                        • a library: publish a source distribution (sdist) or binary (e.g. wheel) usually to PyPI via twine

                        Traditional Ways



                        Several files may be included in a distribution, but here are the main ones:



                        • source: your code


                        • setup.py: specify metadata, and dependencies required to make an sdist.


                        • requirements.txt: a list of dependencies

                        Contemporary Ways



                        Use pyproject.toml to specify which tool to use in creating your sdist or binary:



                        Modern tools to create + deploy/publish a package include:




                        1. pipenv: makes a package and substitutes requirements.txt (recommended by PyPA)

                          • develop: > pipenv install <dependency>, > pipenv install

                          • publish: > pipenv -e . + twine



                        2. poetry: makes a package and publishes to PyPI

                          • develop > poetry add <dependency>, > poetry install

                          • publish: > poetry publish



                        3. flit: makes a package and publishes to PyPI

                          • develop: > flit install

                          • publish: > flit publish


                        The first two options have features to make clean virtual environments and safely install dependencies using lock files. I would encourage exploring these newer options later on as they clear up a lot of packaging headaches by obviating setup.py and setuptools.




                        User



                        Goal - get a package and install it with dependencies



                        Traditional Ways



                        Applications have a variety of deployment methods, e.g. uploading your app to a hosting service e.g. heroku, DigitalOcean, etc. The user may indirectly interface with your app through a website, CLI or more.



                        Libraries are often uploaded to PyPI. From here the user can usually install a package using pip independent from how they are made:




                        • > pip install <package> (recommended)


                        • > pip install <packatge> -r requirements (explicit, optional)

                        These commandline invocations will fetch the distribution from PyPI, install the package and specified dependencies.



                        Contemporary Ways



                        Here are some alternatives to pip:




                        1. pipx: "safely" install packages in isolated environments

                          • > pipx install <package>


                        See Also




                        • Official docs on publishing packages by PyPA


                        • Tutorial on How To Package Your Python Code


                        • Podcast interview with B. Cannon on pyproject.toml and modern packaging tools





                        share|improve this answer





























                          1














                          So you made a package. Now you will want to share it. What next?



                          Developer



                          Goal - make a distribution (also called a "package") to share



                          Preamble



                          You are now packaging your package and wish to distribute it. There are two main kinds of packages:



                          • an application: deploy a source to a server, github, website e.g. CLI

                          • a library: publish a source distribution (sdist) or binary (e.g. wheel) usually to PyPI via twine

                          Traditional Ways



                          Several files may be included in a distribution, but here are the main ones:



                          • source: your code


                          • setup.py: specify metadata, and dependencies required to make an sdist.


                          • requirements.txt: a list of dependencies

                          Contemporary Ways



                          Use pyproject.toml to specify which tool to use in creating your sdist or binary:



                          Modern tools to create + deploy/publish a package include:




                          1. pipenv: makes a package and substitutes requirements.txt (recommended by PyPA)

                            • develop: > pipenv install <dependency>, > pipenv install

                            • publish: > pipenv -e . + twine



                          2. poetry: makes a package and publishes to PyPI

                            • develop > poetry add <dependency>, > poetry install

                            • publish: > poetry publish



                          3. flit: makes a package and publishes to PyPI

                            • develop: > flit install

                            • publish: > flit publish


                          The first two options have features to make clean virtual environments and safely install dependencies using lock files. I would encourage exploring these newer options later on as they clear up a lot of packaging headaches by obviating setup.py and setuptools.




                          User



                          Goal - get a package and install it with dependencies



                          Traditional Ways



                          Applications have a variety of deployment methods, e.g. uploading your app to a hosting service e.g. heroku, DigitalOcean, etc. The user may indirectly interface with your app through a website, CLI or more.



                          Libraries are often uploaded to PyPI. From here the user can usually install a package using pip independent from how they are made:




                          • > pip install <package> (recommended)


                          • > pip install <packatge> -r requirements (explicit, optional)

                          These commandline invocations will fetch the distribution from PyPI, install the package and specified dependencies.



                          Contemporary Ways



                          Here are some alternatives to pip:




                          1. pipx: "safely" install packages in isolated environments

                            • > pipx install <package>


                          See Also




                          • Official docs on publishing packages by PyPA


                          • Tutorial on How To Package Your Python Code


                          • Podcast interview with B. Cannon on pyproject.toml and modern packaging tools





                          share|improve this answer



























                            1












                            1








                            1







                            So you made a package. Now you will want to share it. What next?



                            Developer



                            Goal - make a distribution (also called a "package") to share



                            Preamble



                            You are now packaging your package and wish to distribute it. There are two main kinds of packages:



                            • an application: deploy a source to a server, github, website e.g. CLI

                            • a library: publish a source distribution (sdist) or binary (e.g. wheel) usually to PyPI via twine

                            Traditional Ways



                            Several files may be included in a distribution, but here are the main ones:



                            • source: your code


                            • setup.py: specify metadata, and dependencies required to make an sdist.


                            • requirements.txt: a list of dependencies

                            Contemporary Ways



                            Use pyproject.toml to specify which tool to use in creating your sdist or binary:



                            Modern tools to create + deploy/publish a package include:




                            1. pipenv: makes a package and substitutes requirements.txt (recommended by PyPA)

                              • develop: > pipenv install <dependency>, > pipenv install

                              • publish: > pipenv -e . + twine



                            2. poetry: makes a package and publishes to PyPI

                              • develop > poetry add <dependency>, > poetry install

                              • publish: > poetry publish



                            3. flit: makes a package and publishes to PyPI

                              • develop: > flit install

                              • publish: > flit publish


                            The first two options have features to make clean virtual environments and safely install dependencies using lock files. I would encourage exploring these newer options later on as they clear up a lot of packaging headaches by obviating setup.py and setuptools.




                            User



                            Goal - get a package and install it with dependencies



                            Traditional Ways



                            Applications have a variety of deployment methods, e.g. uploading your app to a hosting service e.g. heroku, DigitalOcean, etc. The user may indirectly interface with your app through a website, CLI or more.



                            Libraries are often uploaded to PyPI. From here the user can usually install a package using pip independent from how they are made:




                            • > pip install <package> (recommended)


                            • > pip install <packatge> -r requirements (explicit, optional)

                            These commandline invocations will fetch the distribution from PyPI, install the package and specified dependencies.



                            Contemporary Ways



                            Here are some alternatives to pip:




                            1. pipx: "safely" install packages in isolated environments

                              • > pipx install <package>


                            See Also




                            • Official docs on publishing packages by PyPA


                            • Tutorial on How To Package Your Python Code


                            • Podcast interview with B. Cannon on pyproject.toml and modern packaging tools





                            share|improve this answer















                            So you made a package. Now you will want to share it. What next?



                            Developer



                            Goal - make a distribution (also called a "package") to share



                            Preamble



                            You are now packaging your package and wish to distribute it. There are two main kinds of packages:



                            • an application: deploy a source to a server, github, website e.g. CLI

                            • a library: publish a source distribution (sdist) or binary (e.g. wheel) usually to PyPI via twine

                            Traditional Ways



                            Several files may be included in a distribution, but here are the main ones:



                            • source: your code


                            • setup.py: specify metadata, and dependencies required to make an sdist.


                            • requirements.txt: a list of dependencies

                            Contemporary Ways



                            Use pyproject.toml to specify which tool to use in creating your sdist or binary:



                            Modern tools to create + deploy/publish a package include:




                            1. pipenv: makes a package and substitutes requirements.txt (recommended by PyPA)

                              • develop: > pipenv install <dependency>, > pipenv install

                              • publish: > pipenv -e . + twine



                            2. poetry: makes a package and publishes to PyPI

                              • develop > poetry add <dependency>, > poetry install

                              • publish: > poetry publish



                            3. flit: makes a package and publishes to PyPI

                              • develop: > flit install

                              • publish: > flit publish


                            The first two options have features to make clean virtual environments and safely install dependencies using lock files. I would encourage exploring these newer options later on as they clear up a lot of packaging headaches by obviating setup.py and setuptools.




                            User



                            Goal - get a package and install it with dependencies



                            Traditional Ways



                            Applications have a variety of deployment methods, e.g. uploading your app to a hosting service e.g. heroku, DigitalOcean, etc. The user may indirectly interface with your app through a website, CLI or more.



                            Libraries are often uploaded to PyPI. From here the user can usually install a package using pip independent from how they are made:




                            • > pip install <package> (recommended)


                            • > pip install <packatge> -r requirements (explicit, optional)

                            These commandline invocations will fetch the distribution from PyPI, install the package and specified dependencies.



                            Contemporary Ways



                            Here are some alternatives to pip:




                            1. pipx: "safely" install packages in isolated environments

                              • > pipx install <package>


                            See Also




                            • Official docs on publishing packages by PyPA


                            • Tutorial on How To Package Your Python Code


                            • Podcast interview with B. Cannon on pyproject.toml and modern packaging tools






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited May 4 at 21:59

























                            answered May 3 at 19:40









                            pylangpylang

                            14.9k24558




                            14.9k24558



























                                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%2f55953391%2fwhat-if-the-end-user-didnt-have-the-required-library%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

                                Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

                                Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

                                What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company