Error importing gspread in iPython Notebook - python

So I have an iPython notebook setup in Pycharm and am getting the "ImportError: No module named gspread" error thrown when I run:
import gspread
I'm running this inside a virtualenv that I have verified in PyCharm is the one being used. I pip installed gspread. I tested that I can import other modules (i.e. numpy) without issue. From the iPython command line I do not get the error when importing gspread, it is only when running it inside the iPython notebook on Pycharm.
Any idea what might be the issue? I'm stumped.

Related

"No module named pandas" error on visual studio code - NO ISSUE on jupyter notebook

I recently installed anaconda and was using jupyter notebook to write my code. I also installed Visual Studio code and ran my jupyter files (.ipynb) in VSC.
Whenever I try to import pandas in VSC within a jupyter file (.ipynb), I get an error that says ModuleNotFoundError: No module named 'pandas'. However, when I run the same file in Chrome on the Jupyter notebook website, I get no such error and my file is able to import pandas.
How can I fix the problem?
This is due to the fact that when you open an .ipynb file in jupyter-notebook, it is running in a conda environment with pandas installed. And it is running on VSC in a Windows or OS environment, which may not have pandas installed.
On cmd run, pip install pandas then import it on VSC.
I think you are working on a different environment and the error is occurring because pandas module is in different path try installing pandas in your current environment and importing it might work
This might help..
https://code.visualstudio.com/docs/python/environments
Thanks for the above comments. On cmd run (pip show pandas), it actually showed pandas was installed.
However, the reason was because the selected interpreter was a non-conda version, which can be changed in the top right of VCS. Hope this helps anyone who has a similar issue!

ModuleNotFound error: cannot find module win32com

I am trying to run a script which will trigger a python file. The python file is using win32com.client. From PyCharm everything is running fine. But when I run script it says no module called win32com. I have installed pypiwin32 and pywin32 already. I have tried out below solutions:
Upgraded pip to new version (21.2.3)
Tried with pip install of pypiwin32
Downloaded file from https://github.com/mhammond/pywin32/releases and I have 64bit(AMD64) on win32
Also tried https://github.com/mhammond/pywin32 and installing via python Scripts/pywin32_postinstall.py -install
Added import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pywin32_system32")) in pywin32.pth under the folder--\PythonVersion\Lib\site-packages\
Added environmet variables by creating a PYTHONPATH environment variables, and append the win32 and win32/lib path
Tried with import sys
sys.path.append('\\PythonVersion\\lib\\site-packages\\win32')
sys.path.append('\\PythonVersion\\lib\\site-packages\\win32\\lib')
But still the issue is same and somehow I am not able to resolve. Can anyone please help with this?

python version conflicting

I am very new to python. I have installed on OSX, python3 and jupyter. I launched a notebook, everything is fine. I installed some_package relying on tafile package. When I import some_package, it triggers an error
ModuleNotFoundError: No module named 'tarfile'
The same error is triggered when I import tarfile
I seems that tarfile is related to 2.7 version. Could someone help on how to handle this ?

No module named 'gspread' when trying to import gspread

I am trying to import gspread in Jupyter but this error keeps popping up:
ModuleNotFoundError: No module named 'gspread'
I am using Python version 3.8.1 and pip version 19.3.1. I installed gspread in the command line and it all seems fine but when I try to import it in the notebook I always get an error. Also tried using PyCharm but the same error exists.
Please, help!
Try installing it in Jupyter Notebook using:
!pip install gspread==3.6.0

ModuleNotFoundError: No module named 'Ipython'

I'm trying to parse the following line of code in an iPython notebook.
from Ipython.display import display, Image
I get the following error,
ModuleNotFoundError: No module named 'Ipython'
When I run pip3 install Ipython
Here's what I get.
Requirement already satisfied: Ipython in ./.envs/dl/lib/python3.6/site-packages
I'm running the code in the same virtual env in which ipython is installed. What am I missing. My python version is 3.6.
Its from IPython.display import display, Image
'P' also caps in IPython
I had this problem too. You have to pay attention to which python version you are using, which pip version, and which environment too. I made a stupid mistake at first and installed TensorFlow on a virtualenv, then tried to call IPython which means my function and installation had different paths.
I recommend using "python -m pip install"

Categories