You are not logged in.

#1 2018-06-28 16:08:32

budaria
Member
Registered: 2018-06-28
Posts: 11

[SOLVED] Fixing dependency conflicts after mixing sudo pip and pacman

Hello everyone,
I recently moved here from debian.

tl:dr; How to fix packages messed/mixed with pacman and sudo pip?


Story:
So before installing packages with pip, I searched google to find out if pip or sudo pip should be used.
From the answers that I found, It seemed that sudo just installed systemwide packages  and it seemed ok, nobody mentioned that it could conflict with python packages installed using package manager.

I was recently getting error:

Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3.6/site-packages/pip/_internal/resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/lib/python3.6/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3.6/site-packages/pip/_internal/resolve.py", line 200, in _get_abstract_dist_for
    skip_reason = self._check_skip_installed(req)
  File "/usr/lib/python3.6/site-packages/pip/_internal/resolve.py", line 171, in _check_skip_installed
    self.finder.find_requirement(req_to_install, upgrade=True)
  File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 484, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 442, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 587, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 705, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 833, in get_page
    inst = cls(resp.content, resp.url, resp.headers)
  File "/usr/lib/python3.6/site-packages/pip/_internal/index.py", line 753, in __init__
    namespaceHTMLElements=False,
TypeError: parse() got an unexpected keyword argument 'transport_encoding'

I got this error on every pip install/upgrade command.
The recommendation was to update htmllib. pip install --upgrade htm So it was either systemwide package or pip package version issue.


I started to uninstall python packages manually both using pacman and then reinstalling some, so it is really messed up right now.
tl:dr; How to fix packages messed/mixed with pacman and sudo pip?


next time I will use pip without sudo smile)
Thanks

Last edited by budaria (2018-06-28 17:02:43)

Offline

#2 2018-06-28 16:39:30

budaria
Member
Registered: 2018-06-28
Posts: 11

Re: [SOLVED] Fixing dependency conflicts after mixing sudo pip and pacman

So, I uninstalled python and  pip with all its dependencies using pacman -Rsn ( I had to manually type in pacman -Rsn for  all those packages that depended on python itself).

I manually removed /usr/lib/python3.6  and python2.7

I think I should also remove any python packages installed in home directory if there are any.
But could not find one. I think they should be in ~/.local/bin but there is only directory "share" there.
Will try again.

After I'm done with all that I will reinstall python and packages that I need.
This time using pip without sudo.

That should work, right?

I think it's working, editing post as solved.

Last edited by budaria (2018-06-28 17:03:18)

Offline

#3 2018-06-28 18:43:02

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Fixing dependency conflicts after mixing sudo pip and pacman

BTW note that there will be nothing in ~/.local/bin if you never ran pip install --user.

Another fix, would be to:

1) use the "lostfiles" package to find files which are not owned by any package, and clean up things which were not supposed to be installed to /
2) use pacman -Qkk to check the integrity of installed packages. Any packages that contain non-backup files which are modified from the packaged versions, might be messed up (there are very few reasons for this to be happening).
3) add the following to ~/.config/pip/pip.conf:

[install]
user = yes

Last edited by eschwartz (2018-06-28 18:43:52)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2018-06-29 06:09:34

budaria
Member
Registered: 2018-06-28
Posts: 11

Re: [SOLVED] Fixing dependency conflicts after mixing sudo pip and pacman

Eschwartz wrote:

BTW note that there will be nothing in ~/.local/bin if you never ran pip install --user.

Another fix, would be to:

1) use the "lostfiles" package to find files which are not owned by any package, and clean up things which were not supposed to be installed to /
2) use pacman -Qkk to check the integrity of installed packages. Any packages that contain non-backup files which are modified from the packaged versions, might be messed up (there are very few reasons for this to be happening).
3) add the following to ~/.config/pip/pip.conf:

[install]
user = yes

Hello, thank you.
Although pip became usable after what I did I ran pacman -Qkk as you suggested and there are missing files and directories:
https://i.imgur.com/7iO9YlQ.png
Should I just reinstall those?

and what does adding

[install]
user = yes

do? Does that mean --user option will be used automatically and I won't have to set it every time? I am sorry, I tried searching but could not find.
Thank you.

Mod Edit - Replaced oversized image with link.
Don't paste images of text, post the actual text.
CoC - Pasting pictures and code

Last edited by Slithery (2018-06-29 14:39:05)

Offline

#5 2018-06-29 06:11:40

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Fixing dependency conflicts after mixing sudo pip and pacman

Yes, you should reinstall them, and yes, adding that to pip.conf will set the default action for pip.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2018-06-29 06:14:13

budaria
Member
Registered: 2018-06-28
Posts: 11

Re: [SOLVED] Fixing dependency conflicts after mixing sudo pip and pacman

Thank you!

Offline

#7 2018-06-29 06:16:52

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Fixing dependency conflicts after mixing sudo pip and pacman

Well, specifically the pip configuration is documented here, but they don't spell out each key: https://pip.pypa.io/en/stable/user_guide/#config-file


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB