Files already exists when updating

Hi!

After some months using manjaro, I'm getting this error for the first time and don't know how to solve it.

When I try to update, I get the following message:

python-setuptools : /usr/lib/python3.8/site-packages/pkg_resources/__pycache__/py2_warn.cpython-38.pyc already exists in filesystem
python-setuptools : /usr/lib/python3.8/site-packages/pkg_resources/py2_warn.py already exists in filesystem

How can I force the update, despite this differences with the existing files?

Thanks in advance!

Please have a look at:

2 Likes

Hi.
This usually means you have been using pip incorrectly (such as by using sudo pip..)

So, while the link above will help you, I suggest you look into
https://wiki.archlinux.org/index.php/Python#Package_management

I have used sudo pip indeed, but I don't get why is not the correct way to do it...

Because then you are using root powers to forcibly install foreign python packages into the system filestructure, which is already not-so-good, but also these packages and files arent tracked by your system and/or real system package manager .. which is all part of why you have this error.
The link I posted above gives you multiple options of how to better handle python packages.

4 Likes

I will give it a look and try to understand how to use pip in a better way.
Thanks.

Its really just installing into home instead, or using a virtual environment, or some of the funnier ones where python packages get automatically converted into pkgbuilds to be tracked by the system.
(I cant attest to how well that last one works .. it scares me)

1 Like

There is no reason why you should not be able to install packages by calling pip as root. This is the correct way of installing system wide python packages.

What is not correct, is that said packages gets installed in /usr/lib. They should get installed to /usr/local/lib .

Ref:

That is correct - but yesterday I had a really odd issue with the firewalld package.

It is installed using pacman - but on update I got pycache conflicts.

Even a complete removal didn't change that - so after a complete uninstall/removal using pacman - I was forced to remove the folder manually.

That is the first time I have seen it for a system package - so - never say never :slight_smile:

On Arch and by inheritance Manjaro no packages are ever installed to /usr/local - in fact it is frowned upon on Arch based systems.

System wide python packages has been created for nearly every possible package you may need and they are all labeled **python-**pkg-name.

This is to keep everything controlled by the package manager - dependencies, imported libraries etc.

So while pip can be used to install python packages on other systems - you should never do it on Manjaro - simply because of the complexity of inter package dependencies which may break if you don't let pacman handle them.

Use python-virtualenv or a wrapper like python-virtualenvwrapper

I was under the impression that Arch and its derivatives was made for power users. I stand corrected.

As a developer, I have my own package dependency tree. Packages that I never want to put under a Pacman umbrella, but which are still common enough for justifying being globally accessible.

As long as the system ignores /usr/local, there is no rationale in the world that justifies pip not installing to /usr/local. This is the whole reason /usr/local have come into existence. And with more than 30 years of Unix experience, I've still yet do discover any serious problems using /usr/local.

But there is, of course, a solution for us that gives Arch the big middle finger for the stance on /usr/local.

You can always create a $HOME/.config/pip/pip.conf containing:

[global]
target = /usr/local/lib/python3/site-packages

...and also prepend this path to PYTHONPATH. Voila!

What I just have to add, is that allowing pip to install to /usr is infinitely worse than anything. This is allowing the system to be broken.

You're both talking about different things: " (arch/manjaro) packages" != "pip packages".

Do what ever you want - but if you get file conflicts on package updates - then you solve them.

Arch is for power users - Manjaro is also - quote manjaro web

Manjaro is not a consumer-oriented operating system. You have full control and you will not be prevented from breaking your own installation - but then again, breaking things and fixing them is half of the fun! On the other hand, if you are happy with the way it works you don’t have to change a thing.


quote from download page

However, Arch is also aimed at more experienced or technically-minded users. As such, it is generally considered to be beyond the reach of those who lack the technical expertise (or persistence) required to use it.


You can of course do what ever you want - and if your dependency tree is unique then there is no problems in installing them using sudo pip.

Just be aware that you define where they end - so if you want them in /usr/local - then this is were they go.

Just specifiy it in your setup.py and you have exactly as you want it.

I think I am referring to the files already exist and referring to Arch Package guidelines which outlines which directories you use when packaging for Arch - which rules I think applies to Manjaro as well.

Which of course makes sure you can do what ever you want in /usr/local/ as Arch/Manjaro never uses that tree.

1 Like

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

Forum kindly sponsored by