I need to import Pubsub_v1 and bigquery from google.cloud module. I have installed it and pip freeze shows below :
gapic-google-cloud-pubsub-v1==0.15.4
google-cloud-bigquery==0.26.0
google-cloud-pubsub==0.27.0
proto-google-cloud-pubsub-v1==0.15.4
In my python script, i am importing the modules as below:
import os
from google.cloud import pubsub_v1
import time
import json
from google.cloud import bigquery
The script is throwing error as :
ImportError: cannot import name pubsub_v1
If i run $sudo pip install --upgrade google-cloud-pubsub then It is able to import pubsub but failing to import Bigquery. I need both modules. Can anybody please help ?
I had the same problem, it happened to me because I installed google-cloud-pubsub before google-cloud so here is my advise :
sudo pip uninstall google-cloud-pubsub
sudo pip uninstall google-cloud
sudo pip install google-cloud
sudo pip install google-cloud-pubsub
Upgraded the other google.cloud modules using
$sudo pip install --upgrade google-cloud-bigquery
$sudo pip install --upgrade google-cloud-storage
$sudo pip install --upgrade google-cloud-logging
It resolves the issue.
$sudo pip install googleapis-common-protos
It resolves the issue for me!
These were helpful to resolve the issue for python 3.x version: (I assumed the pip3 has been installed)
sudo pip3 install google-cloud-bigquery
sudo pip3 install google-cloud-pubsub
sudo apt-get upgrade
I had the same issue while trying the pubsub python library. I followed the below steps to resolve the issue:
Upgrade the pip library:
pip install --upgrade pip setuptools
pip3 install --ignore-installed PyYAML
pip3 install google-cloud-pubsub
just this one solved my issue
the others were not useful
sudo pip3 install google-cloud-pubsub
Related
Using python lib typer throws an error.
some of the depended stacktrace:
...
import typer
File "/builds/.../.venv/lib/python3.9/site-packages/typer/__init__.py", line 12, in <module>
from click.termui import get_terminal_size as get_terminal_size
ImportError: cannot import name 'get_terminal_size' from 'click.termui' (/builds/.../.venv/lib/python3.9/site-packages/click/termui.py)
Ah sry, i had to update to the latest version 0.4.1.
Depended pr: https://github.com/tiangolo/typer/pull/375
(Only leave this answer if anyone makes the same mistake.)
This worked for me
uninstall and reinstall ipython
pip uninstall ipython OR pip3 uninstall ipython
pip install ipython OR pip3 install ipython
next write this
if you are using on terminal/shell
pip install typer --upgrade OR
pip3 install typer --upgrade
if pip is not in PATH environment variable
python -m pip install typer --upgrade OR
python3 -m pip install typer --upgrade
if you are working on Jupyter Notebook or Google Colab
!pip install typer --upgrade
(PS:- pip is a soft link for a particular installer. pip3 is an updated version of pip which is used basically for python 3+.)
I can not import "PygNodePropPredDataset" from "ogb.nodeproppred". I have installed the ogb by "pip3 install ogb"
I found the answer in this pyg issue.
It says that you are probably missing required deppendencies: torch_geometric, torch_scatter and torch_sparse.
You can install them by running:
pip3 install torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+11.6.html
pip3 install torch-sparse -f https://data.pyg.org/whl/torch-1.12.0+11.6.html
pip3 install torch-geometric==1.12.0
You can change the package version and Cuda version if desired. This installation guide can be helpful for finding compatible versions.
I had the xgboost library installed on my mac, but suddenly I get the python error: ModuleNotFoundError: No module named 'xgboost'
That's what I executed:
pip install xgboost
conda install xgboost
pip3 install xgboost
sudo pip3 install xgboost
However, I always get the following error:
Could you give me a hand?
Thank you very much
If you have package manager Anaconda use:
conda install -c conda-forge xgboost
Or:
$ brew install gcc#5
$ pip install xgboost
If it's already installed, try:
pip install --upgrade setuptools
Or:
python -m pip install --upgrade pip
pip install xgboost
Or:
If you were using pip, try to use pip3 or pip2
pip2 install xgboost
pip3 install xgboost
Here is your issue:
https://github.com/dmlc/xgboost/issues/3194
Briefly:
Download gboost from:
https://github.com/dmlc/xgboost/files/1851733/xgboost-0.7.post5.tar.gz
then run:
pip3 install xgboost-0.7.post5.tar.gz
I wasn't able to get any version of XGBoost to work on my Mac even with the above, so I wanted to share that it works on an AWS EC2 Linux instance (https://aws.amazon.com/).
I installed pytz on Debian Buster via
sudo pip install pytz
and the install completed cleanly. However, when I attempt to
import pytz
python throws an exception
import pytz
ModuleNotFoundError: No module named 'pytz'
I installed pytz 2019.3 via pip 18.1. Any thoughts on why pytz is not found?
Update: I ran pip -v and now see that it is using python2.7. Is there a way to tell pip to use python3? I cannot remove python2 as it is a dependency for a number of packages.
Use pip3 to install modules for python3
Adding to #emrah-diril answer:
sudo apt-get -y install python3-pip
and then use
sudo pip3 install pytz
I had already installed boto3 but still it gives error of no module named botocore.session
import botocore.session
ImportError: No module named botocore.session
I arrived here from Google. I was getting a similar error while updating AWS Lambda function code. The answer posted here helped in my case. Simply upgrade AWS CLI. Hope this helps someone drifting here from search engines.
pip install awscli --force-reinstall --upgrade
I was on version boto3-1.5.33 and botocore-1.8.47 and upgrading to boto3-1.9.75 and botocore-1.12.75 solved the issue for me.
pip install boto3 --upgrade
import boto3 alone is enough to connect with a bucket. botocore.session was used during for the previous boto 1.8 and is not accepted by boto3. you can refer the following boto3 documents http://boto3.readthedocs.io/en/latest/reference/services/s3.html#client . Here is boto 1.8 documents that mentions the use of botocore.session http://botocore.readthedocs.io/en/latest/tutorial/
try pip install boto3. If not then try pip install -U boto3
If you got conda environment also. Just use bellow command .
pip install --user awscli --upgrade
This works for me .
For anyone attempting to install AWS CLI on Mac AND running Python 3.6, use pip3.6 instead of pip in your command-line.
Example:
$ python --version
Python 3.6.4
$ sudo pip3.6 install --upgrade awscli
...
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
...
## IF YOU GET THE ABOVE MESSAGE YOU CAN UPGRADE PIP USING
$ sudo pip3.6 install --upgrade pip