Python-charset-normalizer package preventing system update (failed to commit transaction, conflicting files)

Hello everyone.

It’s been a week or so since I’ve last updated my endeavourOS machine. I can’t update it with yay, an error pops up for the package “python-charset-normalizer”.

error: failed to commit transaction (conflicting files)
python-charset-normalizer: /usr/bin/normalizer exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__init__.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/__init__.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/api.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/cd.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/constant.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/legacy.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/md.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/models.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/utils.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/__pycache__/version.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/api.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/cd.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/cli/__init__.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/cli/__pycache__/__init__.cpython-311.pyc exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/constant.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/legacy.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/md.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/models.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/py.typed exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/utils.py exists in filesystem
python-charset-normalizer: /usr/lib/python3.11/site-packages/charset_normalizer/version.py exists in filesystem
Errors occurred, no packages were upgraded.
 -> error installing repo packages

Yay says I do not have it installed.

[roller@hpenvy ~]$ yay python-charset-normalizer
1 extra/python-charset-normalizer 3.3.0-1 (91.9 KiB 468.1 KiB) 
    Encoding and language detection alternative to chardet
==> Packages to install (eg: 1 2 3, 1-3 or ^4)
==> 

When I try to enter the directory, I am told it doesn’t exist.

[roller@hpenvy ~]$ cd /user/lib/python3.11/site-packages/charset_normalizer
bash: cd: /user/lib/python3.11/site-packages/charset_normalizer: No such file or directory

Things I have tried so far:

  • running pacman with --overwrite for the files listed in the error
  • checking ownership with pacman -Qo (before I noticed the files and directories don’t exist…)

What can I do to get rid of this error and update my system? Why is a package I don’t have installed creating an error?

With the cd command, you are trying to go to /user/... when you want /usr/...

Most probably, at some point, you used sudo pip install to install that package.

You should never use sudo pip to install “extraneous” packages into your system directories.

Read through this and you will find the solution to get yourself out of this:

I read this topic over before posting like 3 times, and somehow didn’t notice I did that. Man.

Okay, I’ve manually deleted the files causing the issue and the update proceeds as normal.

Still, why did this happen at all? Why did the package show up in the error as if it was already installed?

There is only one package I have installed using pip, and it’s a different one, spotipy. And yay should inform me of externally managed packages, right? It lists spotipy as an external package everytime I update. I’ve never seen charset-normalizer before.

…Now, this is not related to the problem in the topic, but… how can I remove a package I’ve installed using pip? When I try to run pip uninstall I get error: externally-managed-environment

Read this part of the late @jonathon’s topic explaining why the issue arises.

Why is this happening?

The package manager, pacman , has detected an unexpected file already exists on disk. By design it will not overwrite files that already exist. This is a design feature, not a flaw - package managers are designed to keep track of installed files.

This issue normally happens because you’ve manually added, copied, or created a file. It can also happen when you install software using a downloaded executable, run a make install , or use a third-party package system such as conda . It also occurs when you install an AUR package which installs files that conflict with a repo package.

When using a third-party installer you should always specify an alternative installation location, such as under your home directory, or under /opt or /usr/local/ . Never install directly under / or /usr .

This should normally uinstall a package you have used pip before to install. Not sure why in this case it is failing. It might be that you had used sudo pip install to install that packge.
I’m not well-versed in python package management. I’m sure there are forum members who are able to give you a more accurate explanation.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.