Install unixodbc-dev for a Flask web app on Azure App Service












0















I am trying to deploy Flask web app on the Azure App Service. This app is using pyodbc to connect to mssql; however, when I deploy the app I get this error




ImportError: libodbc.so.2: cannot open shared object file: No such
file or directory




I got to know that I can solve this issue by installing unixodbc/unixodbc-dev with the following line:



sudo apt-get install unixodbc-dev


I tried to do this manually by accessing the SSH of Kudu; however, the issue still persists.



I am using a local repository and pushing the code with git to Azure. When I get this error, I can't access the console from Kudu, so I had to comment the code and push again. Then I tried to install this package manually by doing apt-get install unixodbc-dev (because sudo is not recognized) and it works well. Then I pushed the code again with pyodbc on it and the same error is showing. I think the packages are being erased each time I do that since I found some of the folders created by this packages being deleted after the push action.



The error I always get is as follow:



Lines from the Log Stream










share|improve this question





























    0















    I am trying to deploy Flask web app on the Azure App Service. This app is using pyodbc to connect to mssql; however, when I deploy the app I get this error




    ImportError: libodbc.so.2: cannot open shared object file: No such
    file or directory




    I got to know that I can solve this issue by installing unixodbc/unixodbc-dev with the following line:



    sudo apt-get install unixodbc-dev


    I tried to do this manually by accessing the SSH of Kudu; however, the issue still persists.



    I am using a local repository and pushing the code with git to Azure. When I get this error, I can't access the console from Kudu, so I had to comment the code and push again. Then I tried to install this package manually by doing apt-get install unixodbc-dev (because sudo is not recognized) and it works well. Then I pushed the code again with pyodbc on it and the same error is showing. I think the packages are being erased each time I do that since I found some of the folders created by this packages being deleted after the push action.



    The error I always get is as follow:



    Lines from the Log Stream










    share|improve this question



























      0












      0








      0








      I am trying to deploy Flask web app on the Azure App Service. This app is using pyodbc to connect to mssql; however, when I deploy the app I get this error




      ImportError: libodbc.so.2: cannot open shared object file: No such
      file or directory




      I got to know that I can solve this issue by installing unixodbc/unixodbc-dev with the following line:



      sudo apt-get install unixodbc-dev


      I tried to do this manually by accessing the SSH of Kudu; however, the issue still persists.



      I am using a local repository and pushing the code with git to Azure. When I get this error, I can't access the console from Kudu, so I had to comment the code and push again. Then I tried to install this package manually by doing apt-get install unixodbc-dev (because sudo is not recognized) and it works well. Then I pushed the code again with pyodbc on it and the same error is showing. I think the packages are being erased each time I do that since I found some of the folders created by this packages being deleted after the push action.



      The error I always get is as follow:



      Lines from the Log Stream










      share|improve this question
















      I am trying to deploy Flask web app on the Azure App Service. This app is using pyodbc to connect to mssql; however, when I deploy the app I get this error




      ImportError: libodbc.so.2: cannot open shared object file: No such
      file or directory




      I got to know that I can solve this issue by installing unixodbc/unixodbc-dev with the following line:



      sudo apt-get install unixodbc-dev


      I tried to do this manually by accessing the SSH of Kudu; however, the issue still persists.



      I am using a local repository and pushing the code with git to Azure. When I get this error, I can't access the console from Kudu, so I had to comment the code and push again. Then I tried to install this package manually by doing apt-get install unixodbc-dev (because sudo is not recognized) and it works well. Then I pushed the code again with pyodbc on it and the same error is showing. I think the packages are being erased each time I do that since I found some of the folders created by this packages being deleted after the push action.



      The error I always get is as follow:



      Lines from the Log Stream







      python azure flask pyodbc azure-web-app-service






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 4:15







      Erick Rodriguez

















      asked Jan 2 at 6:14









      Erick RodriguezErick Rodriguez

      23115




      23115
























          1 Answer
          1






          active

          oldest

          votes


















          0














          According to your description, you were using Azure WebApp for Linux which be based on Docker. So any changes you did in a container just be writen in the container layer which will be deleted when a contaner is deleted (includes stop/restart operation), as the offical Docker document About images, containers, and storage drivers said as below.




          Images and layers



          When you create a new container, you add a new writable layer on top of the underlying layers. This layer is often called the "container layer". All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.



          Container and layers



          The major difference between a container and an image is the top writable layer. All writes to the container that add new or modify existing data are stored in this writable layer. When the container is deleted, the writable layer is also deleted. The underlying image remains unchanged.




          Therefore, if you want to save your changes in your running container, you must to commit these changes to create a new image via command docker commit. Or in your scenario for installing the required packages, you can follow the Azure documents SSH support for Azure App Service on Linux and Use a custom Docker image for Web App for Containers to add these commands as below into your Dockerfile to create a image to push and deploy it to Azure WebApp for Linux.



          # Add unixodbc support
          RUN apt-get update
          && apt-get install -y --no-install-recommends unixodbc-dev





          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%2f54002014%2finstall-unixodbc-dev-for-a-flask-web-app-on-azure-app-service%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














            According to your description, you were using Azure WebApp for Linux which be based on Docker. So any changes you did in a container just be writen in the container layer which will be deleted when a contaner is deleted (includes stop/restart operation), as the offical Docker document About images, containers, and storage drivers said as below.




            Images and layers



            When you create a new container, you add a new writable layer on top of the underlying layers. This layer is often called the "container layer". All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.



            Container and layers



            The major difference between a container and an image is the top writable layer. All writes to the container that add new or modify existing data are stored in this writable layer. When the container is deleted, the writable layer is also deleted. The underlying image remains unchanged.




            Therefore, if you want to save your changes in your running container, you must to commit these changes to create a new image via command docker commit. Or in your scenario for installing the required packages, you can follow the Azure documents SSH support for Azure App Service on Linux and Use a custom Docker image for Web App for Containers to add these commands as below into your Dockerfile to create a image to push and deploy it to Azure WebApp for Linux.



            # Add unixodbc support
            RUN apt-get update
            && apt-get install -y --no-install-recommends unixodbc-dev





            share|improve this answer




























              0














              According to your description, you were using Azure WebApp for Linux which be based on Docker. So any changes you did in a container just be writen in the container layer which will be deleted when a contaner is deleted (includes stop/restart operation), as the offical Docker document About images, containers, and storage drivers said as below.




              Images and layers



              When you create a new container, you add a new writable layer on top of the underlying layers. This layer is often called the "container layer". All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.



              Container and layers



              The major difference between a container and an image is the top writable layer. All writes to the container that add new or modify existing data are stored in this writable layer. When the container is deleted, the writable layer is also deleted. The underlying image remains unchanged.




              Therefore, if you want to save your changes in your running container, you must to commit these changes to create a new image via command docker commit. Or in your scenario for installing the required packages, you can follow the Azure documents SSH support for Azure App Service on Linux and Use a custom Docker image for Web App for Containers to add these commands as below into your Dockerfile to create a image to push and deploy it to Azure WebApp for Linux.



              # Add unixodbc support
              RUN apt-get update
              && apt-get install -y --no-install-recommends unixodbc-dev





              share|improve this answer


























                0












                0








                0







                According to your description, you were using Azure WebApp for Linux which be based on Docker. So any changes you did in a container just be writen in the container layer which will be deleted when a contaner is deleted (includes stop/restart operation), as the offical Docker document About images, containers, and storage drivers said as below.




                Images and layers



                When you create a new container, you add a new writable layer on top of the underlying layers. This layer is often called the "container layer". All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.



                Container and layers



                The major difference between a container and an image is the top writable layer. All writes to the container that add new or modify existing data are stored in this writable layer. When the container is deleted, the writable layer is also deleted. The underlying image remains unchanged.




                Therefore, if you want to save your changes in your running container, you must to commit these changes to create a new image via command docker commit. Or in your scenario for installing the required packages, you can follow the Azure documents SSH support for Azure App Service on Linux and Use a custom Docker image for Web App for Containers to add these commands as below into your Dockerfile to create a image to push and deploy it to Azure WebApp for Linux.



                # Add unixodbc support
                RUN apt-get update
                && apt-get install -y --no-install-recommends unixodbc-dev





                share|improve this answer













                According to your description, you were using Azure WebApp for Linux which be based on Docker. So any changes you did in a container just be writen in the container layer which will be deleted when a contaner is deleted (includes stop/restart operation), as the offical Docker document About images, containers, and storage drivers said as below.




                Images and layers



                When you create a new container, you add a new writable layer on top of the underlying layers. This layer is often called the "container layer". All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer.



                Container and layers



                The major difference between a container and an image is the top writable layer. All writes to the container that add new or modify existing data are stored in this writable layer. When the container is deleted, the writable layer is also deleted. The underlying image remains unchanged.




                Therefore, if you want to save your changes in your running container, you must to commit these changes to create a new image via command docker commit. Or in your scenario for installing the required packages, you can follow the Azure documents SSH support for Azure App Service on Linux and Use a custom Docker image for Web App for Containers to add these commands as below into your Dockerfile to create a image to push and deploy it to Azure WebApp for Linux.



                # Add unixodbc support
                RUN apt-get update
                && apt-get install -y --no-install-recommends unixodbc-dev






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 17 at 6:56









                Peter PanPeter Pan

                12.1k3824




                12.1k3824
































                    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%2f54002014%2finstall-unixodbc-dev-for-a-flask-web-app-on-azure-app-service%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

                    Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                    Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

                    A Topological Invariant for $pi_3(U(n))$