title: GCP VM with Apache2 and Flask has Python package problems
body: <p>I created a VM on GCP with a base image from Ubuntu 18.04. I wanted to run an Apache2 server to serve a Flask application. </p>
  
  <p>I've installed the Apache2 successfully, install wsgi and setup the Flask project as well. The application is served properly, however, there's an error when browsing to the website which occurs in one of the Python packages. </p>
  
  <p>Here is the error I get in the Apache2 <code>/var/log/apache2/error.log</code>:</p>
  
  <pre><code> Traceback (most recent call last):
     File "/path/backend/backend.wsgi", line 11, in &lt;module&gt;
    from main import app as application
     File "/path/backend/main.py", line 1, in &lt;module&gt;
    from app import create_app
     File "/path/backend/app/__init__.py", line 5, in &lt;module&gt;
    from .routes import bp_routes
     File "/path/backend/app/routes.py", line 6, in &lt;module&gt;
    from google.cloud import storage, videointelligence
     File "/path/backend/.venv/lib64/python3.7/site-packages/google/cloud/videointelligence.py", line 20, in &lt;module&gt;
    from google.cloud.videointelligence_v1 import VideoIntelligenceServiceClient
     File "/path/backend/.venv/lib64/python3.7/site-packages/google/cloud/videointelligence_v1/__init__.py", line 24, in &lt;module&gt;
    from google.cloud.videointelligence_v1.gapic import video_intelligence_service_client
     File "/path/backend/.venv/lib64/python3.7/site-packages/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py", line 24, in &lt;module&gt;
    import google.api_core.gapic_v1.client_info
     File "/path/backend/.venv/lib64/python3.7/site-packages/google/api_core/gapic_v1/__init__.py", line 16, in &lt;module&gt;
    from google.api_core.gapic_v1 import config
     File "/path/backend/.venv/lib64/python3.7/site-packages/google/api_core/gapic_v1/config.py", line 23, in &lt;module&gt;
    import grpc
     File "/path/backend/.venv/lib64/python3.7/site-packages/grpc/__init__.py", line 23, in &lt;module&gt;
    from grpc._cython import cygrpc as _cygrpc 
     ImportError: cannot import name 'cygrpc'
  </code></pre>
  
  <p>The error is happeining in the package <code>google-cloud-videointelligence</code> which imports some dependencies which brake.</p>
  
  <p>Here's the <code>requirements.txt</code> file:</p>
  
  <pre><code>Flask==1.1.1
  flask-cors==3.0.8
  google-cloud-storage==1.26.0
  google-cloud-videointelligence==1.14.0
  </code></pre>
  
  <p>When I execute the application manually with <code>python application.py</code> then there's no error happening and everything works fine when I <code>curl</code> to <code>localhost:5000</code>.</p>
  
  <p>Might it be that the apache service doesn't have certain permissions to access the <code>grpc</code> bindings?</p>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>The underlying Ubuntu system came with various python versions preinstalled:</p>
  
  <ul>
  <li>Python2</li>
  <li>Python3</li>
  <li>Python3.6</li>
  <li>Python3.7</li>
  </ul>
  
  <p>I've set the default one with </p>
  
  <p><code>sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3.7 1</code></p>
  
  <p>confirming:</p>
  
  <pre><code>$ sudo update-alternatives --config python
  There is only one alternative in link group python (providing /usr/bin/python): /usr/bin/python3.7
  Nothing to configure.
  </code></pre>