Virtual env Python packages with Google Cloud SDK - python-2.7

I'm in the Getting Started section of Google Cloud SDK from Dan Sanderson's book, sorry no link.
The thing is I created a clock application with the local installation of Python.
Then I created a virtual environment, and ran the same application with the corresponding installation.
I installed the packages that I needed, but I get a strange error about -what I think- is one of the base Python packages.
(myenv) diego#host:gae-clock$ dev_appserver.py .
Traceback (most recent call last):
File ".../google-cloud-sdk/bin/dev_appserver.py", line 11, in <module>
import bootstrapping.bootstrapping as bootstrapping
File ".../google-cloud-sdk/bin/bootstrapping/bootstrapping.py",
line 9, in <module>
import setup
ImportError: No module named 'setup'
thank you for pointing in the right direction. Please let me know if I can show more to track this down.

Related

ImportError: no module named wrapper_util

I am trying to test an a web app using google cloud sdk with python 2.7.
However, I get the error:
"C:\Users\Public\My_Project>dev_appserver.py app.yaml
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 31, in <module>
import wrapper_util
ImportError: No module named wrapper_util" when i run the 'dev_appserver.py app.yaml'
Your Google Cloud SDK components for Python may not be updated and does not yet include the module in the error. You can update them by running either of the following:
gcloud components update
updates all components for the SDK
gcloud components install app-engine-python app-engine-python-extras will install Python-specific components but will show All components are up to date. if you are using the latest version.

Flask db migrate stops working on a new ec2 machine

So this is a bit weird. I took an image of my dev server (ec2), spooled it up onto a new machine, and all of a sudden "flask db migrate" stopped working for me. It now returns this error:
Traceback (most recent call last):
File "/usr/local/bin/flask", line 7, in <module>
from flask.cli import main
ImportError: No module named cli
I'm not particularly sure how to go about debugging this. A little guidance would be deeply appreciated.

Trouble getting a Python script to execute

I am trying to experiment around with brute forcing Bitcoin Brain Wallets via a Python script I pulled from github. How ever I am unable to get the script to run properly. I cannot get the requirements to install properly and running the script without returns:
Traceback (most recent call last):
File "C:\Users\CCTrollz\Desktop\bruteforce-bitcoin-brainwallet-master\bbb.py", line 7, in <module>
from lib.blockchain import Abe, BlockchainInfo, Insight
File "C:\Users\CCTrollz\Desktop\bruteforce-bitcoin-brainwallet-master\lib\blockchain.py", line 2, in <module>
import requests
ImportError: No module named requests
Github Project

gcloud command suddenly doesn't work at all

All gcloud commands suddenly give this error:
ERROR: gcloud failed to load: No module named google.appengine.ext
This usually indicates corruption in your gcloud installation or
problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7
executable:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
If it is not, please set the CLOUDSDK_PYTHON environment variable to
point to a working Python 2.7 executable.
If you are still experiencing problems, please reinstall the Cloud SDK
using the instructions here:
https://cloud.google.com/sdk/
Here are some relevant details and things that I've tried:
Mac 10.11.6
Python 2.7.8 at /Library/Frameworks/Python.framework/Versions/2.7/bin/python
Python otherwise works fine
I completely removed google-cloud-sdk and redownloaded from https://cloud.google.com/sdk/
Tried rebooting
Tried "export CLOUDSDK_PYTHON=/Library/Frameworks/Python.framework/Versions/2.7/bin/python" but it didn't help. Also added this line to my .bash_profile
Anyone else having this problem or can suggest a fix?
I have a fix below, but I'll happily award the answer to anyone who can explain what is going on.
I had the same issue . I solved it by using the default python2.7 in Ubuntu
Type this in termimal
export CLOUDSDK_PYTHON=/usr/bin/python
Not sure if this will work the same on Windows
I followed the answer here, worked for me
https://stackoverflow.com/a/59816812/2210667
brew switch openssl 1.0.2q (or whatever latest version you have from ls /usr/local/Cellar/openssl)
I figured out what was causing the problem, though I don't understand what is going on... When reinstalling gcloud I skipped the install script (./google-cloud-sdk/install.sh) since it is an optional step and I already had the needed lines in my bash profile.
When running this script, however, I got this error:
$ ./google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/Users/.../google-cloud-sdk/bin/bootstrapping/install.py", line 8, in <module>
import bootstrapping
File "/Users/.../google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 17, in <module>
import oauth2client.contrib.gce as gce
File "/Users/.../google-cloud-sdk/lib/third_party/oauth2client/contrib/gce.py", line 23, in <module>
import httplib2
File "/Users/.../google-cloud-sdk/lib/third_party/httplib2/__init__.py", line 29, in <module>
import email
File "/Users/.../GIT/GAE_Project/email.py", line 1, in <module>
ImportError: No module named google.appengine.ext
A file I recently created in my GAE project named email.py broke gcloud!?! Renaming this file fixed gcloud.
This is my PYTHONPATH:
/Users/.../google-cloud-sdk/platform/google_appengine:/Users/.../GIT/GAE_Project
So even though the Google cloud libraries come before my GAE project in my PYTHONPATH, a file in my GAE project broke gcloud.

Why can I run command `scrapy` from mac terminal but not IDLE?

I've downloaded Scrapy via pip and am trying to confirm its successfully installed.
If type scrapy into the mac terminal it provides the version name, usage, and available commands, so it appears to have installed successfully,
But if type scrapy or import scrapy into IDLE shell, it returns an error.
Traceback (most recent call last): File "<pyshell#14>", line 1, in <module>
scrapy NameError: name 'scrapy' is not defined
And
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
import scrapy
ImportError: No module named scrapy
What I've tried:
import sys
sys.path
And there is no scrapy in the printout. So I thought it might be a PATH issue.
So per these docs (http://doc.scrapy.org/en/latest/intro/install.html),
I tried running running,
echo "export PATH=/usr/local/bin:/usr/local/sbin:$PATH" >> ~/.bashrc
But that results in an error.
SyntaxError: invalid syntax
I'm not really sure where to go with this from here and don't have much experience with python.
Could anyone share ideas that might troubleshoot this?