i am trying to import a python package but I keep on getting an error;
from google.cloud import bigquery
the error being depicted after running is as seen below;
`ImportError Traceback (most recent call last)
in
1 #importing the python package
----> 2 from google.cloud import bigquery
ImportError: cannot import name 'bigquery' from 'google.cloud' (unknown location)
`
what could be the reason behind it? Please help.
As stated in the documentation, please do
pip install --upgrade google-cloud-bigquery
Make sure you use same python env in which you run your notebook. Or else you can run
! pip install --upgrade google-cloud-bigquery
in your notebook before importing.
Related
from googleapiclient.discovery import build
After pip installing google api for python google tells me to use this command however the command doesn't work!
Can anyone help?
https://developers.google.com/docs/api/quickstart/python
Traceback (most recent call last):
File "C:\Users\M1\PycharmProjects\YouTube\main.py", line 1, in <module>
from googleapiclient.discovery import build
ModuleNotFoundError: No module named 'googleapiclient'
https://developers.google.com/docs/api/quickstart/python
I have installed the libraries using the following command:
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
Then, you can check that the library has been installed properly by running:
pip show google-api-python-client
Now, you should be able to import the libraries in your python code. Make sure that the code is executed within your virtual environment in case you are using one.
I have technically already installed pandas-profiling using
pip install pandas-profiling
But when I try to import it, I get the following error:
import numpy as np
import pandas as pd
import pandas_profiling
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-e1a23f2a6f04> in <module>()
1 import numpy as np
2 import pandas as pd
3 import pandas_profiling
ModuleNotFoundError: No module named 'pandas_profiling'
First Error Image
So I tried installing it in Jupyter Notebook and got the following error as well:
import sys
!{sys.executable} -m pip install pandas-profiling
Collecting pandas-profiling
Could not find a version that satisfies the requirement pandas-profiling
(from versions: )
No matching distribution found for pandas-profiling
Second Error Image
I am also unable to install it using conda for both as I am unable to establish a connection to conda.anaconda.org for some reason.
To others who are looking to resolve this issue try these alternate steps :
Run pip install pandas-profiling command in a separate cell in the jupyter notebook.
After this just restart the kernal and run again. This should definitely work. Worked for me.
Based on the comments I was able to figure out the issue. I had to install jupyter notebook outside of the Anaconda root env and open it from the terminal.
pip3 install jupyter notebook
Once I did that it imported properly.
Steps:
Download the ZIP
Open Anaconda Prompt and go to the directory and extract the files to a folder
cd
C:\Users\farah\Downloads\pandas-profiling-master\pandas-profiling-master
Then type python setup.py install
Now you can use:
import pandas_profiling as pp
df = pd.read_csv('1234.csv')
pp.ProfileReport(df)
Reference: Pandas profiling
!pip install pandas_profiling # Run this from Jupytor notebook Ignore the warnings if any
from pandas_profiling import ProfileReport #restart the kernel if throws error
ProfileReport(df)
Note: This worked for me on Windows 10
From Anaconda Prompt:
conda install -c conda-forge pandas-profiling
I'm having trouble loading a package that is installed in my environment and have no idea why..
conda list
fbprophet 0.3.post2 py36_0 conda-forge
When I request for libraries installed in conda, it clearly shows that I have fbprophet installed. Now, when I import it, a ModuleNotFoundError exception is thrown.
from fbprophet import Prophet
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-83be6864a7aa> in <module>()
----> 1 from fbprophet import Prophet
2 import numpy as np
3 import pandas as pd
ModuleNotFoundError: No module named 'fbprophet'
Has anybody run into this issue? What can I do to troubleshoot this?
My suggestion would be creating a virtual environment for your python first, then conda install your package in the virtual environment.
My script was reading from my pip install list where the module fbprophet did not exist. I went back and installed it there and everything worked. Lesson learned.
Always check where your libraries are being read from.
You may have more than one Python installation. Thus you might installed the library in one Python installation and tried to call it from another one. Please let me know if you have more than one Python installation by printing the result os this CMD command where python.
I seem to have a very common problem although nothing I try works for me:
I have installed Python 3.6.5 for Windows 64 bit and am using Vs Code for editing.
I used Ubuntu to install pip3 and then installed gspread as follows:
pip3 install gspread
Although import gspread gives an error:
Traceback (most recent call last):
File "c:\Users\User\Documents\Vs Code\test.py", line 2, in <module>
import gspread
ModuleNotFoundError: No module named 'gspread'
How do I fix this problem to import gspread?
you can input, in python console :
in[1]: pip install gspread
the picture was taken after installation, for demonstration
I am attempting to import a twitter api wrapper. I am using https://github.com/bear/python-twitter and have installed it using pip install python-twitter, when I run pip freeze into the command prompt it shows that I have python-twitter==3.2.1 installed however when I try to import it using import twitter in Jupyter QTConsole running Python 3.6.0, I get back this error:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-645f6dc1896f> in <module>()
----> 1 import twitter
ModuleNotFoundError: No module named 'twitter'
I am at a loss as to what is going wrong, the package doesn't say it's restricted to a certain version of python, and searching online hasn't helped. So now I am asking here in case anyone has a solution.
Turns out I had 2 versions of Anaconda installed and the package was defaulting to the wrong one, uninstalling the older version of anaconda and reinstalling the package fixed the problem.