ImportError: No module named 'pygsheets' - python

I installed pygsheets module with this command: pip install https://github.com/nithinmurali/pygsheets/archive/master.zip
When I tried to execute script, I got following error:
Traceback (most recent call last): File
"/usr/local/bin/speedtest-to-google", line 7, in
import pygsheets ImportError: No module named 'pygsheets'
I executed pip list and found: pygsheets (v1.1.2).

Use
pip3 install command to access it

Script uses Python3 packages, so command pip3 install has to be used.

Related

Python cannot find module, pip list does

So, this was my first time making a python package. I tried and tested and got it to work. This meaning that pip install . didn't complain and that
$sudo python3
>>>from LEDController import prettyLight
>>>prettyLight().light('whatsapp',100)
provided expected output and actions in my LED matrix.
Also pip list includes LEDControllerm but as soon as I start python3 anywhere but in the LEDController package directory, the module is not being found.
Running pip install /path/to/LEDController/ is still successfull, as is pip3 install /path/to/LEDController/.
Yet I get
$sudo python3
>>> import LEDController
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'LEDController'
>>> from LEDController import prettyLight
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'LEDController'
What am I missing?
As #sinoroc said, installing only using pip is not the safest option. Instead using python3 -m pip install /path/to/module fixed the issue perfectly.
I'll put his link here so future viewers can read up on why this is.

Python script compiled to .exe giving error: No module named yaml

I can run the code below in Pycharm without issues, but when I create an exe using pyinstaller, I get the following error when I run the executable -
**Traceback (most recent call last):
File "openfile.py", line 1, in <module>
ImportError: No module named yaml
[1296] Failed to execute script openfile**
import yaml
from sys import exit
cfg = yaml.safe_load(open("Config.yml"))
exit()
Note that I'm using Windows 10.
pip install pyyaml will solve this problem
or use virtualenv
pip install virtualenv -p python3 #or python2
virtualenv venv
venv/Scripts/activate
pip install pyyaml

python numpy was installed but throws " ModuleNotFoundError: No module named 'numpy'"

I have installed numpy on ubuntu. it works fine on terminal but when i want to import it to my working directory its shows me this error
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'numpy'
Try this:
sudo pip install numpy
Also this
sudo pip install spyder (numpy is included)
or
sudo easy_install numpy

How to run a python script from linux terminal when it imports libraries like shodan?

root#kali:~# ./collecting_info_using_facets.py apache
Traceback (most recent call last):
File "./collecting_info_using_facets.py", line 3, in <module>
import shodan
ImportError: No module named shodan
I included path as #!usr/bin/env python but then also I cannot import shodan from the command line but I can run the same program from python3 IDLE.
It's because you need to download the Python module called 'Shodan'. You don't seem to have it installed, that's why Python is returning the error: ImportError: No module named shodan
You can install Shodan for Python3 via:
pip3 install shodan
Or if you're running Python2, try:
pip2.7 install shodan
Best of luck.

Redhat trying to use pip ImportError: No module named pip

I am trying to use pip on my Redhat system.
I installed pip following the instructions here, but when I try to use it, for example pip install, I get the following error code:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in ?
from pip import main
ImportError: No module named pip
this issue due to common user do not have privilege to access packages py file.
1. root user can run 'pip list'
2. other common user cannot run 'pip list'
[~]$ pip list
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal import main
ImportError: No module named pip._internal
solution :
root user login and run
chmod -R 755 /usr/lib/python2.7
fix this issue.
If pip is already installed and your unable to access it, one of the reason could be that you don't have permissions to read or execute the library. Try doing
sudo chmod -R u+rx /usr/lib/python2.7/site-packages/pip/
If pip is installed in a different folder, you can obtain the folder path by doing
>>> import pip
>>> pip.__path__
['/usr/lib/python2.7/site-packages/pip']
If you don't have root rights and running on python 2.6 then you can try this file https://bootstrap.pypa.io/2.6/get-pip.py (it is from same instruction you used, it is a simple python script which installs all dependencies and pip itself) and run it with command python get-pip.py --user

Categories

Resources