PYTHON interpreter UPgrade: Poetry

Ha ha! I didn’t think of that.
To avoid pip thinking it’s “already satisfied”, you would have to do
pip install --user 'PySide6==6.5.1.1
unless there’s a better trick i’ve overlooked…

When my system had PySide6 installed in both places,
they were not the same version, and I never saw a problem.
(i was using the one in user-space to make a little Qt-Python app.)

(it’s 1 a.m. here – have to shut down now.)

Seems to be a never ending story, I’m sorry!

I did this (without the ’ in front of Pyside!):

$ pip install --user PySide6==6.5.1.1
Collecting PySide6==6.5.1.1
  Using cached PySide6-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl (6.7 kB)
Collecting shiboken6==6.5.1.1 (from PySide6==6.5.1.1)
  Using cached shiboken6-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl (173 kB)
Collecting PySide6-Essentials==6.5.1.1 (from PySide6==6.5.1.1)
  Using cached PySide6_Essentials-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl (80.9 MB)
Collecting PySide6-Addons==6.5.1.1 (from PySide6==6.5.1.1)
  Using cached PySide6_Addons-6.5.1.1-cp37-abi3-manylinux_2_28_x86_64.whl (126.2 MB)
Installing collected packages: shiboken6, PySide6-Essentials, PySide6-Addons, PySide6
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
shiboken6-generator 6.5.0 requires shiboken6==6.5.0, but you have shiboken6 6.5.1.1 which is incompatible.
Successfully installed PySide6-6.5.1.1 PySide6-Addons-6.5.1.1 PySide6-Essentials-6.5.1.1 shiboken6-6.5.1.1
[hessler@IBM-T14s Daten]$ pip check
shiboken6-generator 6.5.0 has requirement shiboken6==6.5.0, but you have shiboken6 6.5.1.1.

Now what? I have not any idea …

Copy-paste error. I meant to have a ’ at the end as well.
(Following examples in pip docs.)

But it worked OK; it brought them all back out of the cache.

ERROR: ...
shiboken6-generator 6.5.0 requires shiboken6==6.5.0, 
but you have shiboken6 6.5.1.1 which is incompatible.

Successfully installed PySide6-6.5.1.1 PySide6-Addons-6.5.1.1 
PySide6-Essentials-6.5.1.1 shiboken6-6.5.1.1

shiboken6-generator is the only one out of step, so do this:
pip install --user --upgrade 'shiboken6-generator==6.5.1.1'

Note that --user keeps this in user-space so it won’t conflict with system-python.
Whether the existing ‘shiboken6-generator 6.5.0’ is in system or user space, this is safe,
as it will either add it new to user space or upgrade it in user space,
and will not change anything in system space.

Always do pip install with --user,
NEVER with sudo, to avoid installing into system python.

As I mentioned before, some ‘errors’ that ‘pip check’ reports can be disregarded,
as it does not consider the separateness of system and user modules.
Unfortunately the ‘check’ message does not say where each module is,
so you can’t immediately see if they are on opposite sides of the system/user divide.
So it’s important to mainly take notice of the error message from ‘pip install --user’.

To avoid version conflicts between user modules and system modules, remember this:

  • a python process started by the system (user is root) will never conflict with your user-space, because root never tries to import from user-space.

  • python run by you will always try to import first from user space, and will try to import from system-python only if it does not find the module in user space.

  • so if a process started by you wants to import a module from system python, and the version is wrong in system python, then simply install that module into user-space:
    pip install --user pkgname

  • the previous point may trigger more dependencies to be installed in user space (but with pyside6 I doubt this will happen); to avoid too much of this happening, sometimes you could downgrade a module in user-space, if that would be the simpler solution.
    pip install --user --upgrade 'pkgname==lower-version'

Please put this in your notes and remember to read it if such conflicts arise. :slight_smile:

(I’ll try to put it in my HowTo “tutorial”, but it’s rather long already.)

Thank you, but …

$ pip install --user --upgrade 'shiboken6-generator==6.5.1.1'
ERROR: Could not find a version that satisfies the requirement shiboken6-generator==6.5.1.1 (from versions: none)
ERROR: No matching distribution found for shiboken6-generator==6.5.1.1

… there is the old issue again.

Srill no problem I think.
Now it’s a matter of knowing your packages.

A day or two ago i was looking at the folders
where PySide6 lives in both system and user space,
(in a btrfs snapshot with python3.10)
and noticed that only one of them had “shiboken6-generator”.
Don’t remember which one.

This result tells me that only the system has shiboken6-generator
(because its version matches the system’s PySide6)
while PySide6_Essentials etc in user space never had (and don’t need) the generator.

So the previous “error”:

shiboken6-generator 6.5.0 has requirement shiboken6==6.5.0, but you have shiboken6 6.5.1.1.

was a false alert, because
shiboken6-generator 6.5.0 and shiboken6 6.5.0 both exist in system space,
and have no need to relate to what’s in user space,
while your shiboken6 6.5.1.1 is in and only for user space.

I’ll have to check details again to make sure I’m right,
but for now don’t worry about it.

EDIT:
shiboken6-generator 6.5.0 and shiboken6_generator 6.5.0
are definitely both in system python.
These (and PySide6 6.5.0) are from Manjaro repo.

EDIT2:
The generator is bundled with shiboken6, it’s not a separate package.
See (Arch Linux - shiboken6 6.7.0-3 (x86_64)) in ‘Package Contents’.
I’m 90% sure that everything is OK with your setup.

EDIT3:

From (Package Details - Qt for Python)

The package shiboken6-generator is not a dependency, and it’s not available on PyPi.
The reason, is that it depends on libclang, which is a large library that we don’t package

It’s for generating Python bindings in C++ libraries, which we “users” don’t normally do.

I have installed PySide6_Essentials with pip, and get the same error as you.
I have run a PySide app that I built, and it runs fine.

I have a test script that shows where it imports modules from.
This is from a normal run, importing from user space:

sys.executable     : /usr/bin/python3.11
PySide6.__version__: 6.5.1.1
PySide6.__file__   : /home/jh/.local/lib/python3.11/site-packages/PySide6/__init__.py
QtCore.__file__    : /home/jh/.local/lib/python3.11/site-packages/PySide6/QtCore.abi3.so
QtGui.__file__     : /home/jh/.local/lib/python3.11/site-packages/PySide6/QtGui.abi3.so
QtWidgets.__file__ : /home/jh/.local/lib/python3.11/site-packages/PySide6/QtWidgets.abi3.so
Qt imported OK

When I tweak the path so that it cannot import from user space,
it works fine in system space:

sys.executable     : /usr/bin/python3.11
PySide6.__version__: 6.5.0
PySide6.__file__   : /usr/lib/python3.11/site-packages/PySide6/__init__.py
QtCore.__file__    : /usr/lib/python3.11/site-packages/PySide6/QtCore.abi3.so
QtGui.__file__     : /usr/lib/python3.11/site-packages/PySide6/QtGui.abi3.so
QtWidgets.__file__ : /usr/lib/python3.11/site-packages/PySide6/QtWidgets.abi3.so
Qt imported OK

This exceeds my ablities, sorry.
I checked with pamac: pyside6 and shiboken6 are installed from repository, both version 6.5.0.2.And

$ pip list
...
PySide6              6.5.1.1
PySide6-Addons       6.5.1.1
PySide6-Essentials   6.5.1.1
...
shiboken6            6.5.1.1
shiboken6-generator  6.5.0
...

What shall I do or can I keep it as it is?

The simple thing to remember is that
pip is not aware of the separation of system and user space
so you need to be aware of it yourself when interpreting what pip tells you.

‘pip list’ gives preference to user space: where the same package is in both spaces,
as with PySide6 and shiboken6, it shows only the one in user space.

There is not a problem with shiboken6-generator
because your user-space PySide6 does not use it.

Sorry if my previous edits overloaded you with info.
They simply prove the point that system and user can have
different versions of the PySide6 packages without any problem.

Fairly soon, the system will have pyside 6.5.1.1 (it’s in unstable now),
and then both spaces will have the same version.

For the future, not for any real reason, but just to avoid
being concerned about the misleading info that pip gives you,
don’t upgrade your PySide6 with pip, until the sytem has the latest version;
then they’ll both stay on the same version.

Btw, “system python” exists only on Linux, and I guess this is why
the pip developers haven’t yet fully provided for the system-space/user-space split.

Thank you @j77h for all the information …

I’m starting do understand all the stuff (and will never use sudo pip install).
One question about maintenance and update for python packages (if your time allows): Actually I’m running this Maintenace.sh nearly monthly:

pip list --outdated --format=columns > "$FileMaintnPath/PythonPackages ${Date}.txt"
echo "Upgrade for old  Python-Modules (pip)" > "$FileMaintnPath/PythonPackages ${Date}.txt"
pip freeze --user | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip install --upgrade 

Do for have any proposal for an improvement?
Thanks again and regrads, Michael

Guido invented Python to save us all from this kind of unreadable code. :slight_smile:

The first line and last line produce completely different lists; not the same packages.
So although you may intend to use pip list --outdated, you actually don’t.

The second line removes the first line’s list from the text file, so you never see it.

Check this again: ([HowTo] Upgrade many python packages with pip)

Seems like you need to slow down, and learn a subject thoroughly before you try to use it.

The crazy shell stuff works, but you need only awk -F "==" '{print $1}', as in
pip freeze | awk -F "==" '{print $1}' > textfile
to remove version numbers.

Thanks again,

The source of my code comes from here, may be, this makes it better understandable.