1

Within the Google Cloud Instance SSH console (running Debian), I installed Flask using pip.

Running python3 demo.py from the console or demo.py from the python3 interpreter (3.5.3) brings up ImportError: cannot import name 'Flask'.

Running sudo apt-get install python3-venv appears to successfully install and set up venv for python 3.5. But when attempting to create a virtualenv based on the Flask docs:

$ python3 -m venv venv
/usr/bin/python3: No module named venv

Attempting sudo apt-get install python-virtualenv results in:

dpkg: error processing package virtualenv (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3-virtualenv
 virtualenv
E: Sub-process /usr/bin/dpkg returned an error code (1)

Other unsuccessful suggestions include:

$ source venv/bin/activate
-bash: venv/bin/activate: No such file or directory 

and:

$ sudo virtualenv venv
New python executable in /home/user/demo/venv/bin/python
ERROR: The executable /home/user/demo/venv/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/usr' (should be u'/home/user/demo/venv')
ERROR: virtualenv is not compatible with this system or executable

Using python -V confirms that the python version is 2.7 in the console. For fun, running python demo.py returns

ImportError: cannot import name zip_longest

Following this thread, I tried pip install --upgrade virtualenv resulting in:

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 67, in <module>
    vendored("distro")
  File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "/usr/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl/distro.py", line 1051, in 
<module>
  File "/usr/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl/distro.py", line 595, in _
_init__
  File "/usr/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl/distro.py", line 934, in _
get_lsb_release_info
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1

Am I missing something? Is this an issue with Google Cloud Console? Is there a workaround?

Eugene Primako
  • 2,767
  • 9
  • 26
  • 35
WhooNo
  • 911
  • 2
  • 12
  • 28

0 Answers0