cant import pyautogui, no module named 'Xlib' - python

I want to import pyautogui using PyCharm but it keeps showing error:
Traceback (most recent call last):
File "/root/PycharmProjects/untitled2/ghea.py", line 1, in <module>
import pyautogui
File "/root/PycharmProjects/untitled2/venv/lib/python3.7/site-packages/pyautogui/__init__.py", line 152, in <module>
from . import _pyautogui_x11 as platformModule
File "/root/PycharmProjects/untitled2/venv/lib/python3.7/site-packages/pyautogui/_pyautogui_x11.py", line 7, in <module>
from Xlib.display import Display
ModuleNotFoundError: No module named 'Xlib'
There were some similar questions and I tried answers but none of them did work.
i tried:
sudo apt-get install python-xlib
pip install python3_xlib
sudo apt-get install python3-xlib

Related

How can i fix if pip3 is not working after instalation?

I was trying to install matplotlib but first I had to install pip in MobaXterm and I think something failed.
I did:
python -m ensurepip
apt-get install python3-pip
Here I didn't want to, but I closed MobaXterm.
Then I tried starting again and I got:
Found package python3-pip
Package python3-pip is already installed, skipping
But then, when I try to install matplotlib:
pip3 install matplotlib
And I got:
Traceback (most recent call last):
File "/bin/pip3", line 7, in <module>
from pip import main
File "/usr/lib/python3.4/site-packages/pip/__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3.4/site-packages/pip/utils/__init__.py", line 22, in <module>
from pip._vendor import pkg_resources, six
File "/usr/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 36, in <module>
import plistlib
File "/usr/lib/python3.4/plistlib.py", line 65, in <module>
from xml.parsers.expat import ParserCreate
File "/usr/lib/python3.4/xml/parsers/expat.py", line 4, in <module>
from pyexpat import *
ImportError: No such process
Thank you and sorry, I'm really not an experienced programmer.

add-apt-repository command returns extrange error

I'm trying to install R 3.6.
But when I try to run the add the repository, I get a huge error:
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/'
The error is:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 67, in <module>
from gi.repository import Gio
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
from . import _gi
ImportError: cannot import name '_gi' from 'gi' (/usr/lib/python3/dist-packages/gi/__init__.py)
I have no clue why this is happening.
Any help on how to adding the repository for installing R will be very welcome.

trying to install pyperclip in python2.7

everytime i run this i face this problem
> sudo pip install pyperclip
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/home/ot/.local/lib/python2.7/site-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/home/ot/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 22, in <module>
from pip.compat import console_to_str, expanduser, stdlib_pkgs
ImportError: No module named compat
ps: im using python 2.7 and this has been happening to me while trying to download other few packages as well
I'm on ubuntu 16.04
Thank you
problem solved i used these 2 lines :
sudo apt-get update
sudo apt-get install python-pyperclip

Having issue with python pip command

I had python pip installed and it was working fine but I did something wrong now it is broken.
Now when I execute pip command to install new packages, I get an error.
like if execute pip list then I get the below error.
root#dragonwarrior-Latitude-3440:~# pip list
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 4, >in <module>
import locale
File "/usr/lib/python2.7/locale.py", line 15, in <module>
import encodings
ImportError: No module named encodings

No Python module despite installing it

I've installed xxhash module with:
sudo pip install --upgrade pip
sudo pip install xxhash
But when I execute:
pydoc modules
I get a list of available modules in which there's no xxhash.
And when I run in terminal a GUI program it gives me an error:
Python: Traceback (most recent call last):
File "./runserver.py", line 34, in <module>
from pogom.search import search_overseer_thread, fake_search_loop
File "/SOME_PATH/resources/app/map/pogom/search.py", line 30, in <module>
from pgoapi import PGoApi
File "/SOME_PATH/resources/app/map/pogom/pgoapi/__init__.py", line 39, in <module>
Python: from .pgoapi import PGoApi
File "/SOME_PATH/resources/app/map/pogom/pgoapi/pgoapi.py", line 34, in <module>
from .rpc_api import RpcApi
File "/SOME_PATH/resources/app/map/pogom/pgoapi/rpc_api.py", line 47, in <module>
from .utilities import to_camel_case, get_time, get_format_time_diff, Rand48, long_to_bytes, generateLocation1, generateLocation2, generateRequestHash, f2i
File "/SOME_PATH/resources/app/map/pogom/pgoapi/utilities.py", line 37, in <module>
import xxhash
ImportError: No module named xxhash
BTW, the 2 first commands worked with no error and when I rerun them it says that these modules are already installed and up to date.

Categories