Azure Webapp ModuleNotFoundError: No Module Named Pandas

Jan W 6 Reputation points
2020-10-11T00:17:14.847+00:00

Hey,

I am currently in a sprint for a hackathon, and I tried deploying my web-app to azure. It deploys just fine and sends back a 202. However, on initializing the docker instance, it crashes, because apparently, there is no module named pandas. I tried installing Pandas manually using bash, but not only does it install pandas 0.25.3 (??), it doesn't fix anything.
Pandas is included as "pandas==1.1.3" in my requirements.txt.

Please advise how I can fix this.

Have a nice weekend,

Jan

Full lock of startup:

2020-10-11T00:02:09.118022154Z: [INFO]
2020-10-11T00:02:09.118046556Z: [INFO]    _____
2020-10-11T00:02:09.118050956Z: [INFO]    /  _  \ __________ _________   ____
2020-10-11T00:02:09.118054356Z: [INFO]   /  /_\  \___   /  |  \_  __ \_/ __ \
2020-10-11T00:02:09.118057856Z: [INFO]  /    |    \/    /|  |  /|  | \/\  ___/
2020-10-11T00:02:09.118061157Z: [INFO]  \____|__  /_____ \____/ |__|    \___  >
2020-10-11T00:02:09.118064657Z: [INFO]          \/      \/                  \/
2020-10-11T00:02:09.118068157Z: [INFO]
2020-10-11T00:02:09.118082158Z: [INFO]  A P P   S E R V I C E   O N   L I N U X
2020-10-11T00:02:09.118085858Z: [INFO]
2020-10-11T00:02:09.118088859Z: [INFO]  Documentation: http://aka.ms/webapp-linux
2020-10-11T00:02:09.118092059Z: [INFO]  Python 3.7.7
2020-10-11T00:02:09.118095159Z: [INFO]  Note: Any data outside '/home' is not persisted
2020-10-11T00:02:09.360617558Z: [INFO]  Starting OpenBSD Secure Shell server: sshd.
2020-10-11T00:02:09.414253740Z: [INFO]  App Command Line not configured, will attempt auto-detect
2020-10-11T00:02:09.414864883Z: [INFO]  Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -bindPort 8000
2020-10-11T00:02:09.444469770Z: [INFO]  Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-10-11T00:02:09.445102515Z: [INFO]  Could not find operation ID in manifest. Generating an operation id...
2020-10-11T00:02:09.445115816Z: [INFO]  Build Operation ID: 74ef1a3b-02ec-405a-87c7-cf70a5a98670
2020-10-11T00:02:10.112596277Z: [INFO]  Oryx Version: 0.2.20200706.2, Commit: 42be45d884938c3c818ba08e9e4760b1136fd9b3, ReleaseTagName: 20200706.2
2020-10-11T00:02:10.712703988Z: [ERROR]  Detected an app based on Flask
2020-10-11T00:02:10.713477142Z: [ERROR]  Generating `gunicorn` command for 'app:app'
2020-10-11T00:02:11.309481764Z: [INFO]  Writing output script to '/opt/startup/startup.sh'
2020-10-11T00:02:11.826169793Z: [INFO]  WARNING: Could not find virtual environment directory /home/site/wwwroot/antenv.
2020-10-11T00:02:11.826706831Z: [INFO]  WARNING: Could not find package directory /home/site/wwwroot/__oryx_packages__.
2020-10-11T00:02:12.579090878Z: [ERROR]  [2020-10-11 00:02:12 +0000] [35] [INFO] Starting gunicorn 20.0.4
2020-10-11T00:02:12.580224458Z: [ERROR]  [2020-10-11 00:02:12 +0000] [35] [INFO] Listening at: http://0.0.0.0:8000 (35)
2020-10-11T00:02:12.588538745Z: [ERROR]  [2020-10-11 00:02:12 +0000] [35] [INFO] Using worker: sync
2020-10-11T00:02:12.597173753Z: [ERROR]  [2020-10-11 00:02:12 +0000] [38] [INFO] Booting worker with pid: 38
2020-10-11T00:02:12.608930682Z: [ERROR]  [2020-10-11 00:02:12 +0000] [38] [ERROR] Exception in worker process
2020-10-11T00:02:12.608953584Z: [ERROR]  Traceback (most recent call last):
2020-10-11T00:02:12.608958984Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-10-11T00:02:12.608962985Z: [ERROR]      worker.init_process()
2020-10-11T00:02:12.608966485Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-10-11T00:02:12.608978486Z: [ERROR]      self.load_wsgi()
2020-10-11T00:02:12.608981986Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-10-11T00:02:12.608985486Z: [ERROR]      self.wsgi = self.app.wsgi()
2020-10-11T00:02:12.608988886Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-10-11T00:02:12.608992387Z: [ERROR]      self.callable = self.load()
2020-10-11T00:02:12.608995687Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-10-11T00:02:12.608999187Z: [ERROR]      return self.load_wsgiapp()
2020-10-11T00:02:12.609002487Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-10-11T00:02:12.609005988Z: [ERROR]      return util.import_app(self.app_uri)
2020-10-11T00:02:12.609009388Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
2020-10-11T00:02:12.609012888Z: [ERROR]      mod = importlib.import_module(module)
2020-10-11T00:02:12.609016388Z: [ERROR]    File "/opt/python/3.7.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
2020-10-11T00:02:12.609020189Z: [ERROR]      return _bootstrap._gcd_import(name[level:], package, level)
2020-10-11T00:02:12.609023689Z: [ERROR]    File "
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,408 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Ryan Hill 27,111 Reputation points Microsoft Employee
    2020-10-12T19:41:48.41+00:00

    Hi @Jan W ,

    Try installing your requirements.txt manually by running the following commands from bash ssh:

    # Activate default virtual environment in App Service container  
    source /antenv/bin/activate  
      
    pip install -r requirements.txt  
    

    Furthermore, what deployment method did you happen to use? This will help try the repro the issue you're seeing. Also, do you have happen to see "Could not find setup.py or requirements.txt; Not running pip install" messages in the log stream?

    Regards,
    Ryan

    0 comments No comments

  2. Dominik H 1 Reputation point
    2020-10-29T12:36:48.847+00:00

    I had a similar problem and it looks like your venv isn't found or correctly activated: WARNING: Could not find virtual environment directory /home/site/wwwroot/antenv.

    Thats why it uses python from /op/, not from /antenv/bin/