Errors in Pip Manager

Create issue
Issue #147 resolved
M. Gronle created an issue

Error 1:

pip show prints a warning WARNING: Package(s) not found to the command line. The reason is, that the internal
pip show command currently has one empty string as package name. This has to be removed.

Error 2:

There are packages, whose author name contains special characters (e.g. black, author name contains a captial letter L with a strike, Ł). The pip show command to resolve dependencies requests these information. Usually the stdout and stderr stream to the pip process are encoded in UTF-8 (e.g. linux or default Windows command line). However, if pip is called as process within itom using
Qt’s class QProcess the default Windows encoding cp1252 is used. If pip tries to print some special characters using cp1252 (latin1), a UnicodeEncodeError is raised and displayed in the log window of the itom Python Package Manager.

Possible solution: Usually pip should always be called as standalone application. However it is required to force the Python sys.stdout and sys.stderr stream to the UTF-8 encoding. Pip provides an unofficial access to calling pip within a Python session. This approach can be used to call a helper module via QProcess. This python module should at first set the streams to UTF-8 and then
call pip via this access. Since this access is unofficial and might change in the future, the pip manager will at first try this approach.
If an error occurs, the current direction call of pip is used. Else the bypass via the module.

Comments (2)

  1. M. Gronle reporter

    fixes issue #147: Pip Manager calls pip via module to force the stdcout and stderr stream to UTF-8 (under Windows). If this fails, pip is directly called in a process as fallback solution. The fix prevents Python to raise a UnicodeEncodeError if any package contains special characters in its meta information.

    → <<cset 336bb79da894>>

  2. Log in to comment