Bot deployment problem. Error occurred while reading WSGI handler: ModuleNotFoundError: No module named 'botbuilder'
I'm getting error like that:
Traceback (most recent call last):
File "D:\home\python364x86\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "D:\home\python364x86\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "D:\home\python364x86\wfastcgi.py", line 605, in get_wsgi_handler
handler = handler()
File ".\ptvs_virtualenv_proxy.py", line 102, in get_virtualenv_handler
handler = get_wsgi_handler(os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
File ".\ptvs_virtualenv_proxy.py", line 89, in get_wsgi_handler
raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb))
ValueError: "app.wsgi_app()" could not be imported: Traceback (most recent call last):
File ".\ptvs_virtualenv_proxy.py", line 73, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File ".\app.py", line 11, in <module>
import botbuilder
ModuleNotFoundError: No module named 'botbuilder'
I don't know why it happends because i have a YAML deploy file that have pip install:
name: Build and deploy Python app to Azure Web App - azurebot-test-1
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python version
uses: actions/setup-python@v2
with:
python-version: '3.6'
addToPath: true,
architecture: 'x64'
- name: Install Python dependencies
run: |
python -m venv env
cd env/Scripts/
chmod -R 777 ./activate
./activate
cd ../../
pip install --user -r requirements.txt
- name: Zip the application files
run: |
sudo apt-get install zip gzip tar
zip -r myapp.zip .
- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v1
with:
app-name: 'azurebot-test-1'
slot-name: 'production'
publish-profile: ${{ secrets.AzureAppService_PublishProfile_8630fb021e6f4db6a8107f4c9aaca965 }}
package: './myapp.zip'
And my web.config is:
<?xml version="1.0"?>
<!-- Generated web.config for Microsoft Azure. Remove this comment to prevent
modifications being overwritten when publishing the project.
-->
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="WSGI_ALT_VIRTUALENV_HANDLER" value="app.wsgi_app()" />
<add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="D:\home\site\wwwroot\env\Scripts\activate_this.py" />
<add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_virtualenv_handler()" />
<add key="PYTHONPATH" value="D:\home\site\wwwroot" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<httpErrors errorMode="Detailed" existingResponse="PassThrough"></httpErrors>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<add name="Python FastCGI" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\python364x86\python.exe|D:\home\python364x86\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<rewrite>
<rules>
<rule name="Static Files" stopProcessing="true">
<conditions>
<add input="true" pattern="false" />
</conditions>
</rule>
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I had another problem like that with other package "aiohttp", that was identical, so i added an extension with azure panel a Python 3.6x86 and changed the python path in scriptProcessor. It is solved the problem after many of cmd manipulations in new python path with manual pip installs with some flags that i can't remember, but after that problem steped to the next line of imports.
I can share my app.wsgi_app(), ptvs_virtualenv_proxy.get_virtualenv_handler() functions that used in my web.config or just say what i can share with you