I have updated gcloud components. I have installed BigQuery lib using pip install following the instructions in the online doc. I am running Python 2.7.10.
when I run a python script that has the following line:
from google.cloud import bigquery
it returns the following error:
ImportError: No module named google.cloud
I tried python 3.6 and still get the same error.
I did reintsall google sdk and still got the same error.
if I do touch /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/init.py then import google woudl work, but not import google.cloud
any help is appreciated.
The Cloud SDK is not enough. Just use pip install --upgrade google-cloud-bigquery, see https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/bigquery
Related
I'm trying to use Azure Databricks to launch Python script that imports the library: "simple_salesforce"
I have installed the library as shown on the picture bellow, please note that while installing the library the name should be "simple-salesforce" and while importing it "simple_salesforce" (just to mention that I didn't mistaken the name):
Installation of the library
As shown on the picture bellow, the library was installed successfully:
simple-salesforce installed
When try to import it in my workspace, using:
import simple_salesforce
I get the following error (see the error picture bellow):
ImportError: No module named 'cryptography.hazmat.primitives.asymmetric.ed25519'
Error
I've tried to install the "cryptography" library with the same method I used to install the other libraries (see the picture bellow), but I still get the same error:
cryptography
Is there any step that I missed ?
Best regards,
You don't have the library "cryptography" installed. It is very likely that you are using a Databricks runtime version of 5.5 LTS or less, with one worker.
The problem is that you have a Databricks cluster with Python3 and the notebook is running on a Python2 kernel.
Method 1
Check if you have python 3:
%sh
python3 --version
Then install pip3:
%sh
sudo apt install python3-pip
After that you can install "cryptography"
Method 2
I highly recommand this method, which consists of using 7.4 Databricks Runtime version with a minimum of 2 workers, then you will have python3 and the library "cryptography" installed by default.
You will just need to install simple-salesforce manually from the libraries part, and:
import simple_salesforce
I'm using notebooks.azure.com to learn python. I'm trying to manage Blobs with python sdk.
MUCH of the documentation I come across mentions pip install azure-storage-blob then using the BlobServiceClient (class?) to interact with Azure Storage.
UNFORTUNATELY, I get the error: ImportError: cannot import name 'BlobServiceClient' when trying to call from azure.storage import BlobServiceClient. This occurs after installing and upgrading azure-storage (v0.36.0) and azure-blob-storage (v12.3.0).
Here is a public Notebook showing the issue
Does this mean notebooks.azure.com is using the python v2.1 SDK (which appears to use BlockBlobService instead of BlobServiceClient)
How do I check which version of the python SDK my Azure Notebook is running?
EDIT 1:
No change after running !pip install azureml-sdk\[notebooks,automl\] --upgrade
Did you try
pip install --upgrade azureml-sdk\[notebooks,automl\]
azure-storage is deprecated, don't use that.
I'm using Anaconda, and I'm trying to use google cloud vision, but I cannot import google cloud vision. I can import google cloud, but it throws an error below.
from google.cloud import vision
ImportError: cannot import name 'vision'
What module should I import with anaconda?
(I've already imported google-api-core, google-auth, google-cloud-bigquery, google-cloud-core, google-cloud-sdk, google-cloud-storage, google-resumable-media, google-resumable-media, googleapis-common-protos)
Could anyone solve this? Thanks in advance.
You may need to add a dependency to google-cloud-vision.
You can install google-cloud-vision by typing:
sudo pip install google-cloud-vision
I've used pip (and pip3) to install google-api-python-client, all over the place, but whenever I try to issue
from google.cloud import bigquery
I get an
ImportError: No module named google.cloud" error.
sys.path contains the directory that pip reports google-api-python-client is installed in, although it's near the end of a long(ish) list of directories.
Edit:
I've also installed google-cloud. The error occurs with both libraries installed.
Edit2: the Location for both are: "/home/swood/.local/lib/python3.5/site-packages"
print(sys.path) returns: ['/mnt/pasnas00/dbdata/snowflakedata/lib', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/home/swood/.local/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']
That's because those are different libraries. You have installed the Google API Client and trying to import the Google Cloud one. For an overview of the differences you can refer to this documentation.
Install it with this instead:
pip install google-cloud
or with pip3 for Python3. If you still want to use the other Client you'll need to import it and build the BigQuery service with something like this:
from googleapiclient.discovery import build
...
service = build('bigquery', 'v2', credentials=credentials)
I am running django version 1.10.3 and I installed google api client with pip like so:
pip install --upgrade google-api-python-client
When I try to use it with PyCharm/Terminal outside of a django project it works just fine. However, when I try to import it in my django project it throws this error:
ImportError: No module named googleapiclient
For this import statement:
from googleapiclient import discovery
I don't use any virtual env and nothing. Does anybody know why this error occurs?
Thanks in advance!