Why is requirements.txt not being installed on deployment to AppEngine?





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







1















I'm attempting to upgrade an existing project to the new Python 3 AppEngine Standard Environment. I'm able to deploy my application code, however the app is crashing because it can not find dependencies that are defined in the requirements.txt file. The app file structure looks likes this:



|____requirements.txt
|____dispatch.yaml
|____dashboard
| |____dashboard.yaml
| |____static
| | |____gen
| | | |____favicon.ico
| | | |____fonts
| | | | |____MaterialIcons-Regular.012cf6a1.woff
| | | |____app.js
| | |____img
| | | |____avatar-06.png
| | | |____avatar-07.png
| | | |____avatar-05.png
| | | |____avatar-04.png
| |____templates
| | |____gen
| | | |____index.html
| |____main.py
| |____.gcloudignore
|____.gcloudignore


And the requirements.txt file looks like this:



Flask==0.12.2
pyjwt==1.6.1
flask-cors==3.0.3
requests==2.19.1
google-auth==1.5.1
pillow==5.3.0
grpcio-tools==1.16.1
google-cloud-storage==1.13.0
google-cloud-firestore==0.30.0
requests-toolbelt==0.8.0
Werkzeug<0.13.0,>=0.12.0
firestore-model>=0.0.2


After deploying, when I visit the site on the web, I get a 502. The GCP Console Error Reporting service indicates the error is thrown from a line in main.py where it attempts to import one of the above dependencies: ModuleNotFoundError: No module named 'google'



I've tried moving the requirements.txt into the dashboard folder and get the same result.



Stack Trace:



Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
super(ThreadWorker, self).init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/srv/main.py", line 12, in <module>
from google.cloud import storage
ModuleNotFoundError: No module named 'google'









share|improve this question

























  • Can you include the stack trace? Also which directory are you deploying the app from?

    – Dustin Ingram
    Nov 16 '18 at 20:45











  • I've been deploying from the top level, the same level as requirements.txt. Added stacktrace to question.

    – JeremyFromEarth
    Nov 16 '18 at 21:52








  • 1





    The requirements.txt should be in the same directory as main.py, and you should be deploying from that directory. Does the same error happen when you deploy from there? Also is it possible your .gcloudignore is ignoring the requirements.txt file?

    – Dustin Ingram
    Nov 16 '18 at 22:33











  • Looks like both of your suggestions have helped to fix the issue. Thanks!

    – JeremyFromEarth
    Nov 17 '18 at 0:16






  • 1





    Great! I added an answer to that effect, please accept if it solves the problem.

    – Dustin Ingram
    Nov 17 '18 at 0:58


















1















I'm attempting to upgrade an existing project to the new Python 3 AppEngine Standard Environment. I'm able to deploy my application code, however the app is crashing because it can not find dependencies that are defined in the requirements.txt file. The app file structure looks likes this:



|____requirements.txt
|____dispatch.yaml
|____dashboard
| |____dashboard.yaml
| |____static
| | |____gen
| | | |____favicon.ico
| | | |____fonts
| | | | |____MaterialIcons-Regular.012cf6a1.woff
| | | |____app.js
| | |____img
| | | |____avatar-06.png
| | | |____avatar-07.png
| | | |____avatar-05.png
| | | |____avatar-04.png
| |____templates
| | |____gen
| | | |____index.html
| |____main.py
| |____.gcloudignore
|____.gcloudignore


And the requirements.txt file looks like this:



Flask==0.12.2
pyjwt==1.6.1
flask-cors==3.0.3
requests==2.19.1
google-auth==1.5.1
pillow==5.3.0
grpcio-tools==1.16.1
google-cloud-storage==1.13.0
google-cloud-firestore==0.30.0
requests-toolbelt==0.8.0
Werkzeug<0.13.0,>=0.12.0
firestore-model>=0.0.2


After deploying, when I visit the site on the web, I get a 502. The GCP Console Error Reporting service indicates the error is thrown from a line in main.py where it attempts to import one of the above dependencies: ModuleNotFoundError: No module named 'google'



I've tried moving the requirements.txt into the dashboard folder and get the same result.



Stack Trace:



Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
super(ThreadWorker, self).init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/srv/main.py", line 12, in <module>
from google.cloud import storage
ModuleNotFoundError: No module named 'google'









share|improve this question

























  • Can you include the stack trace? Also which directory are you deploying the app from?

    – Dustin Ingram
    Nov 16 '18 at 20:45











  • I've been deploying from the top level, the same level as requirements.txt. Added stacktrace to question.

    – JeremyFromEarth
    Nov 16 '18 at 21:52








  • 1





    The requirements.txt should be in the same directory as main.py, and you should be deploying from that directory. Does the same error happen when you deploy from there? Also is it possible your .gcloudignore is ignoring the requirements.txt file?

    – Dustin Ingram
    Nov 16 '18 at 22:33











  • Looks like both of your suggestions have helped to fix the issue. Thanks!

    – JeremyFromEarth
    Nov 17 '18 at 0:16






  • 1





    Great! I added an answer to that effect, please accept if it solves the problem.

    – Dustin Ingram
    Nov 17 '18 at 0:58














1












1








1








I'm attempting to upgrade an existing project to the new Python 3 AppEngine Standard Environment. I'm able to deploy my application code, however the app is crashing because it can not find dependencies that are defined in the requirements.txt file. The app file structure looks likes this:



|____requirements.txt
|____dispatch.yaml
|____dashboard
| |____dashboard.yaml
| |____static
| | |____gen
| | | |____favicon.ico
| | | |____fonts
| | | | |____MaterialIcons-Regular.012cf6a1.woff
| | | |____app.js
| | |____img
| | | |____avatar-06.png
| | | |____avatar-07.png
| | | |____avatar-05.png
| | | |____avatar-04.png
| |____templates
| | |____gen
| | | |____index.html
| |____main.py
| |____.gcloudignore
|____.gcloudignore


And the requirements.txt file looks like this:



Flask==0.12.2
pyjwt==1.6.1
flask-cors==3.0.3
requests==2.19.1
google-auth==1.5.1
pillow==5.3.0
grpcio-tools==1.16.1
google-cloud-storage==1.13.0
google-cloud-firestore==0.30.0
requests-toolbelt==0.8.0
Werkzeug<0.13.0,>=0.12.0
firestore-model>=0.0.2


After deploying, when I visit the site on the web, I get a 502. The GCP Console Error Reporting service indicates the error is thrown from a line in main.py where it attempts to import one of the above dependencies: ModuleNotFoundError: No module named 'google'



I've tried moving the requirements.txt into the dashboard folder and get the same result.



Stack Trace:



Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
super(ThreadWorker, self).init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/srv/main.py", line 12, in <module>
from google.cloud import storage
ModuleNotFoundError: No module named 'google'









share|improve this question
















I'm attempting to upgrade an existing project to the new Python 3 AppEngine Standard Environment. I'm able to deploy my application code, however the app is crashing because it can not find dependencies that are defined in the requirements.txt file. The app file structure looks likes this:



|____requirements.txt
|____dispatch.yaml
|____dashboard
| |____dashboard.yaml
| |____static
| | |____gen
| | | |____favicon.ico
| | | |____fonts
| | | | |____MaterialIcons-Regular.012cf6a1.woff
| | | |____app.js
| | |____img
| | | |____avatar-06.png
| | | |____avatar-07.png
| | | |____avatar-05.png
| | | |____avatar-04.png
| |____templates
| | |____gen
| | | |____index.html
| |____main.py
| |____.gcloudignore
|____.gcloudignore


And the requirements.txt file looks like this:



Flask==0.12.2
pyjwt==1.6.1
flask-cors==3.0.3
requests==2.19.1
google-auth==1.5.1
pillow==5.3.0
grpcio-tools==1.16.1
google-cloud-storage==1.13.0
google-cloud-firestore==0.30.0
requests-toolbelt==0.8.0
Werkzeug<0.13.0,>=0.12.0
firestore-model>=0.0.2


After deploying, when I visit the site on the web, I get a 502. The GCP Console Error Reporting service indicates the error is thrown from a line in main.py where it attempts to import one of the above dependencies: ModuleNotFoundError: No module named 'google'



I've tried moving the requirements.txt into the dashboard folder and get the same result.



Stack Trace:



Traceback (most recent call last):
File "/env/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 104, in init_process
super(ThreadWorker, self).init_process()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 129, in init_process
self.load_wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
return self.load_wsgiapp()
File "/env/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/lib/python3.7/site-packages/gunicorn/util.py", line 350, in import_app
__import__(module)
File "/srv/main.py", line 12, in <module>
from google.cloud import storage
ModuleNotFoundError: No module named 'google'






python-3.x google-app-engine google-cloud-platform pip requirements






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 21:51







JeremyFromEarth

















asked Nov 16 '18 at 19:34









JeremyFromEarthJeremyFromEarth

13.2k42845




13.2k42845













  • Can you include the stack trace? Also which directory are you deploying the app from?

    – Dustin Ingram
    Nov 16 '18 at 20:45











  • I've been deploying from the top level, the same level as requirements.txt. Added stacktrace to question.

    – JeremyFromEarth
    Nov 16 '18 at 21:52








  • 1





    The requirements.txt should be in the same directory as main.py, and you should be deploying from that directory. Does the same error happen when you deploy from there? Also is it possible your .gcloudignore is ignoring the requirements.txt file?

    – Dustin Ingram
    Nov 16 '18 at 22:33











  • Looks like both of your suggestions have helped to fix the issue. Thanks!

    – JeremyFromEarth
    Nov 17 '18 at 0:16






  • 1





    Great! I added an answer to that effect, please accept if it solves the problem.

    – Dustin Ingram
    Nov 17 '18 at 0:58



















  • Can you include the stack trace? Also which directory are you deploying the app from?

    – Dustin Ingram
    Nov 16 '18 at 20:45











  • I've been deploying from the top level, the same level as requirements.txt. Added stacktrace to question.

    – JeremyFromEarth
    Nov 16 '18 at 21:52








  • 1





    The requirements.txt should be in the same directory as main.py, and you should be deploying from that directory. Does the same error happen when you deploy from there? Also is it possible your .gcloudignore is ignoring the requirements.txt file?

    – Dustin Ingram
    Nov 16 '18 at 22:33











  • Looks like both of your suggestions have helped to fix the issue. Thanks!

    – JeremyFromEarth
    Nov 17 '18 at 0:16






  • 1





    Great! I added an answer to that effect, please accept if it solves the problem.

    – Dustin Ingram
    Nov 17 '18 at 0:58

















Can you include the stack trace? Also which directory are you deploying the app from?

– Dustin Ingram
Nov 16 '18 at 20:45





Can you include the stack trace? Also which directory are you deploying the app from?

– Dustin Ingram
Nov 16 '18 at 20:45













I've been deploying from the top level, the same level as requirements.txt. Added stacktrace to question.

– JeremyFromEarth
Nov 16 '18 at 21:52







I've been deploying from the top level, the same level as requirements.txt. Added stacktrace to question.

– JeremyFromEarth
Nov 16 '18 at 21:52






1




1





The requirements.txt should be in the same directory as main.py, and you should be deploying from that directory. Does the same error happen when you deploy from there? Also is it possible your .gcloudignore is ignoring the requirements.txt file?

– Dustin Ingram
Nov 16 '18 at 22:33





The requirements.txt should be in the same directory as main.py, and you should be deploying from that directory. Does the same error happen when you deploy from there? Also is it possible your .gcloudignore is ignoring the requirements.txt file?

– Dustin Ingram
Nov 16 '18 at 22:33













Looks like both of your suggestions have helped to fix the issue. Thanks!

– JeremyFromEarth
Nov 17 '18 at 0:16





Looks like both of your suggestions have helped to fix the issue. Thanks!

– JeremyFromEarth
Nov 17 '18 at 0:16




1




1





Great! I added an answer to that effect, please accept if it solves the problem.

– Dustin Ingram
Nov 17 '18 at 0:58





Great! I added an answer to that effect, please accept if it solves the problem.

– Dustin Ingram
Nov 17 '18 at 0:58












1 Answer
1






active

oldest

votes


















1














A few things could be going wrong. Make sure that:




  • Your requirements.txt file is in the same directory as your main.py file

  • Your .gcloudignore is not ignoring your requirements.txt file

  • You are deploying the function this same directory as requirements.txt and main.py






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%2f53344280%2fwhy-is-requirements-txt-not-being-installed-on-deployment-to-appengine%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









    1














    A few things could be going wrong. Make sure that:




    • Your requirements.txt file is in the same directory as your main.py file

    • Your .gcloudignore is not ignoring your requirements.txt file

    • You are deploying the function this same directory as requirements.txt and main.py






    share|improve this answer




























      1














      A few things could be going wrong. Make sure that:




      • Your requirements.txt file is in the same directory as your main.py file

      • Your .gcloudignore is not ignoring your requirements.txt file

      • You are deploying the function this same directory as requirements.txt and main.py






      share|improve this answer


























        1












        1








        1







        A few things could be going wrong. Make sure that:




        • Your requirements.txt file is in the same directory as your main.py file

        • Your .gcloudignore is not ignoring your requirements.txt file

        • You are deploying the function this same directory as requirements.txt and main.py






        share|improve this answer













        A few things could be going wrong. Make sure that:




        • Your requirements.txt file is in the same directory as your main.py file

        • Your .gcloudignore is not ignoring your requirements.txt file

        • You are deploying the function this same directory as requirements.txt and main.py







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 17 '18 at 0:57









        Dustin IngramDustin Ingram

        4,49711431




        4,49711431
































            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%2f53344280%2fwhy-is-requirements-txt-not-being-installed-on-deployment-to-appengine%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

            List item for chat from Array inside array React Native

            Thiostrepton

            Caerphilly