Certain python modules broken by 'sudo pip install xlib'

Need help with C, C++, perl, python, etc?

Certain python modules broken by 'sudo pip install xlib'

Postby mrmarcdee » 2018-03-26 02:29

I have a previously working python script that imports pyautogui.

I recently tried to do:

Code: Select all
pip install xlib


and it threw a bunch of errors, along with a permission denied. Not thinking or reading much, my instinct after seeing "permission denied" is to repeat the last code with 'sudo' in front of it.

Code: Select all
sudo pip install xlib


And it installed, along with 'six'.

Then next time I started my python script, it is unable to import pyautogui

Code: Select all
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pyautogui/__init__.py", line 115, in <module>
from . import _pyautogui_x11 as platformModule
File "/usr/local/lib/python2.7/dist-packages/pyautogui/_pyautogui_x11.py", line 7, in <module>
from Xlib.display import Display
File "/usr/local/lib/python2.7/dist-packages/Xlib/display.py", line 26, in <module>
from six import create_unbound_method
ImportError: cannot import name create_unbound_method



pip freeze shows:
Code: Select all
Pillow==2.6.1
PyAutoGUI==0.9.36
PyMsgBox==1.0.6
PyScreeze==0.1.14
PyTweening==1.0.3
SOAPpy==0.12.22
argparse==1.2.1
cffi==0.8.6
chardet==2.3.0
clipboard==0.0.4
colorama==0.3.2
cryptography==0.6.1
decorator==3.4.0
defusedxml==0.4.1
html5lib==0.999
ndg-httpsclient==0.3.2
numpy==1.8.2
ply==3.4
pyOpenSSL==0.14
pyasn1==0.1.7
pycparser==2.10
pyperclip==1.6.0
pytesseract==0.1.7
python-apt==0.9.3.12
python-dateutil==2.6.1
python-debian==0.1.27
python-debianbts==1.11
python3-xlib==0.15
readchar==0.7
reportbug==6.6.3
requests==2.4.3
scipy==0.14.0
six==1.8.0
urllib3==1.9.1
wheel==0.24.0
wsgiref==0.1.2
wstools==0.4.3
xlib==0.21



I need to get pyautogui back to working. Any ideas what to do?
mrmarcdee
 
Posts: 6
Joined: 2017-01-30 22:19

Re: Certain python modules broken by 'sudo pip install xlib'

Postby dilberts_left_nut » 2018-03-26 04:17

sudo unfuck python ? :wink:

Probably read the Debian python docs, learn what you broke by forcibly stuffing external things into the mix, then repair it.
AdrianTM wrote:There's no hacker in my grandma...
User avatar
dilberts_left_nut
 
Posts: 4867
Joined: 2009-10-05 07:54
Location: enzed

Re: Certain python modules broken by 'sudo pip install xlib'

Postby Segfault » 2018-03-26 12:35

Yup, running pip as root is a proven way to bork the system.
Segfault
 
Posts: 699
Joined: 2005-09-24 12:24

Re: Certain python modules broken by 'sudo pip install xlib'

Postby stevepusser » 2018-03-26 16:50

Was there a problem with installing python-xlib and/or python3-xlib with apt instead?
The MX Linux repositories: Backports galore! If we don't have something, just ask and we'll try--we like challenges. New packages: GIMP 2.10.6, Pale Moon 28.1.0, wine-staging 3.16, qBittorrent 4.1.3, Linux kernel 4.18.8, virtualbox 5.2.18
User avatar
stevepusser
 
Posts: 9906
Joined: 2009-10-06 05:53

Re: Certain python modules broken by 'sudo pip install xlib'

Postby mrmarcdee » 2018-03-26 21:19

dilberts_left_nut wrote:sudo unfuck python ? :wink:

I never knew about this command, my life will be so much easier now :D

Segfault wrote:Yup, running pip as root is a proven way to bork the system.

Heh... well now I know. I will charge myself with an AUI, Administering Under the Influence.

stevepusser wrote:Was there a problem with installing python-xlib and/or python3-xlib with apt instead?

Didn't even try it, I had been recently installing a handful of other python modules via pip that were not in apt repos. Honestly I can't even remember now why I was trying to install xlib.



So I think I fixed it by uninstalling via pip all the modules in question that I could, then re-installing via apt all the modules that I could, then when trying to reinstall pyautogui from pip I had to change the ownership of /usr/local/lib/python2.7/dist-packages in order to let pip install it. So still not too sure what happened, but seems ok. Now whenever I import pyautogui I get this message
Code: Select all
Xlib.protocol.request.QueryExtension
mrmarcdee
 
Posts: 6
Joined: 2017-01-30 22:19


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable