ModuleNotFoundError: No module named 'gspread' - python

I have an issue with the gspread module, and I think with Python 3 too.
My code is something like that: import blabla, gspread, etc...
And if I try to run it python3 myscript.py every module seems to run fine, except gspread. I receive this error:
Traceback (most recent call last):
File "z_schedule.py", line 3, in <module>
from z_database import *
File "/home/pi/Projects/InstaPy/z_database.py", line 3, in <module>
import gspread, gspread_formatting
ModuleNotFoundError: No module named 'gspread'
I'm running python3 and I installed gspread both with pip and pip3. I also installed oauth2 in the same way.
My code used to work great until I updated my Raspberry, InstaPy and Python 3. Somebody knows how to fix it? Thanks.

Try this:
pip3 install gspread
and run the script again. I hope it helps to solve the problem

Related

Getting an error for a module that I definitely imported

import pyinputplus as pyip
while True:
prompt='Want to know how to keep an idiot busy for hours?\n'
response=pyip.inputYesNo(prompt)
if response=='no':
break
print('Thank you. Have a nice day.')
When I run my above code , I get this error:
Traceback (most recent call last):
File "c:\users\XXXXXX\mu_code\idiot.py", line 1, in <module>
import pyinputplus as pyip
File "c:\users\XXXXXX\mu_code\pyinputplus\__init__.py", line 15, in <module>
import pysimplevalidate as pysv # type: ignore
ModuleNotFoundError: No module named 'pysimplevalidate'
I cannot figure it out. The module is definitely installed. I've even moved it from the folder it was originally installed in to the mu folder where the py file is saved. Any help would be appreciated.
The ModuleError says that you do not have pysimplevalidate installed.
Using the same python executable as you are using to run your script (idiot.py), run
python -m pip install pysimplevalidate
or, even more bullet-proof:
<path_to_python.exe> -m pip install pysimplevalidate
If you are not sure what python executable the script is using, you can check it with
# put this on top of your script
import sys
print(sys.executable) # will print C:\path\to\python.exe

Python third party Module global import

i'm currently into learning a bit of python and i want to import the paperclip third party module into my python file.
Yes, i already installed the pyperclip module with
pip install pyperclip.
if i create a file on my desktop, i get an error which says
Traceback (most recent call last):
File "test.py", line 1, in <module>
import pyperclip
ImportError: No module named pyperclip
However if i put the test.py in my python folder, it runs.
The question now is, is there a way to make all my installed modules available on a global scope ? I just want to have my file e.g. on my Desktop and run it without having import issues.
Thank you.
Greetings
Edit: I'm working on a Mac, maybe this leads to the problem
Found the problem.
The pip installautomatically used pip3.5 install
whereas python test.pydidn't use python3.5 test.py
Thank you #Bakurìu
Is there a way i can define python3.5as python?
You can do this :
pip3.5 install paperclip
pyperclip is install but not paperclip

Error during library import in Python (Windows)

I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.

ImportError: No module named qgis.core

I am on Ubuntu 13.04. I get the following error message -
Traceback (most recent call last):
File "analyse.py", line 1, in <module>
from log import shelve
File "/home/shubham/SMART/TaxiData/log.py", line 27, in <module>
from demo import *
File "/home/shubham/SMART/zones/demo.py", line 5, in <module>
from qgis.core import *
ImportError: No module named qgis.core
Actually, everything was working fine till today morning. I guess this might be due to a package update.
I tried looking around on Google but my search was fruitless. So, I will really appreciate any help or pointers you guys can give :)
Thanks.
I solved the problem by completely removing the installation and using the nightly builds at 'deb http://qgis.org/debian-nightly raring main'.
If you have pip installed you could either try pip search qgis or pip freeze. The latter shows a list of all installed python packages to check if you have the package. Maybe try reinstalling qgis ...
Try sudo apt-get install python-qgis . The package does not appear to be available on PyPI, but it was listed as "python-qgis" in the Ubuntu packages.

win32 Python - pythoncom error - ImportError: No module named pywintypes

I am trying to import pythoncom, but it gives me this error: Traceback (most recent call last):
File "F:/Documents and Settings/Emery/Desktop/Python 27/Try", line 2, in
import pythoncom
File "F:\Python27\lib\site-packages\pythoncom.py", line 2, in
import pywintypes
ImportError: No module named pywintypes
I reinstalled Python win32, but it still doesn't fix it. Any help? Also, I am trying to access the pythoncom.PumpMessages() method, an alternative would be nice as well.
If you are using an IDE like I am (PyCharm), you should go the where the Python is installed e.g C:\Users\***\AppData\Local\Programs\Python\Python37\Lib\site-packages
In this folder check for the folder name pywin32. Copy that folder and paste it to C:\Users\***\PycharmProjects\project\venv\Lib\site-packages. After that restart your IDE, then it will import the pywin32 as it did in my case. I hope it helps.
pip install --upgrade pywin32==228

Categories

Resources