After upgrading pip3 does not work

I have just upgraded 15.1 -> 15.2 and any pip3 command reports this error

andromeda:/home/fernando/tmp # pip3 install
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 484, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2725, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2343, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2349, in resolve
    module = __import__(self.module_name, fromlist='__name__'], level=0)
  File "/usr/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
ImportError: cannot import name 'FormatControl'
andromeda:/home/fernando/tmp # 


I have tried to reinstal python3-pip but it did not work.

Any ideas?

best regards

Hi
AFAIK you have to add options after install? See pip3 help install

andromeda:/home/fernando/tmp # pip3 help install
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 484, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2725, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2343, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2349, in resolve
    module = __import__(self.module_name, fromlist='__name__'], level=0)
  File "/usr/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
ImportError: cannot import name 'FormatControl'
andromeda:/home/fernando/tmp # 


There is definitely something wrong as the above help command should generate output but I have no idea what the problem is. I use Tumbleweed and pip3 has no issues.

Of course if you type pip3 install, you need to specify a package but it would say so and that is not the case here.

try force re-installing pip3

zypper in -f python3-pip

TSU

just the same

andromeda:/home/fernando/tmp # zypper in -f python3-pip
Retrieving repository 'home:lemmy04' metadata ..............................................................................................................................[done]
Building repository 'home:lemmy04' cache ...................................................................................................................................[done]
Loading repository data...
Reading installed packages...
Forcing installation of 'python3-pip-10.0.1-lp152.3.4.noarch' from repository 'openSUSE-Leap-15.2-Oss'.
Resolving package dependencies...

The following package is going to be reinstalled:
  python3-pip

1 package to reinstall.
Overall download size: 1.6 MiB. Already cached: 0 B. No additional space will be used or freed after the operation.
Continue? [y/n/v/...? shows all options] (y): 
Retrieving package python3-pip-10.0.1-lp152.3.4.noarch                                                                                       (1/1),   1.6 MiB (  9.0 MiB unpacked)
Retrieving: python3-pip-10.0.1-lp152.3.4.noarch.rpm ..............................................................................................................[done (962 B/s)]

Checking for file conflicts: ...............................................................................................................................................[done]
(1/1) Installing: python3-pip-10.0.1-lp152.3.4.noarch ......................................................................................................................[done]
andromeda:/home/fernando/tmp # pip3 help install
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 484, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2725, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2343, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2349, in resolve
    module = __import__(self.module_name, fromlist='__name__'], level=0)
  File "/usr/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
ImportError: cannot import name 'FormatControl'
andromeda:/home/fernando/tmp # 


Hi
Not sure why your running stuff as root user, I would surmise something is really broken on your install…


user@grover-os152:~> zypper if python3-pip | grep Version
Version        : 10.0.1-lp152.3.4

user@grover-os152:~> pip3 help install

Usage:   
  pip3 install [options] <requirement specifier> [package-index-options] ...
  pip3 install [options] -r <requirements file> [package-index-options] ...
  pip3 install [options] -e] <vcs project url> ...
  pip3 install [options] -e] <local project path> ...
  pip3 install [options] <archive url/path> ...

Description:
  Install packages from:
....
--no-color                  Suppress colored output

Can you create a test user and login as that user and try pip3 help install

Hi
Can you also advise how you updated the system, also what repositories are active?

Just the same

test@andromeda:~> pip3 help install
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    load_entry_point('pip==10.0.1', 'console_scripts', 'pip3')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 473, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2447, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2453, in resolve
    module = __import__(self.module_name, fromlist='__name__'], level=0)
  File "/usr/lib/python3.6/site-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/lib/python3.6/site-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
ImportError: cannot import name 'FormatControl'
test@andromeda:~> 



andromeda:~ # zypper lr --uri
Repository priorities are without effect. All enabled repositories share the same priority.

#  | Alias                                | Name                                                                     | Enabled | GPG Check | Refresh | URI
---+--------------------------------------+--------------------------------------------------------------------------+---------+-----------+---------+---------------------------------------------------------------------------------------
 1 | Geo                                  | Application:Geo                                                          | No      | ----      | ----    | http://download.opensuse.org/repositories/Application:/Geo/openSUSE_Leap_15.2/
 2 | Hamradio                             | hamradio                                                                 | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/hamradio/openSUSE_Leap_15.2/
 3 | KDE-extra                            | KDE:Extra                                                                | No      | ----      | ----    | http://download.opensuse.org/repositories/KDE:/Extra/openSUSE_Leap_15.2/
 4 | KDE3                                 | KDE:KDE3                                                                 | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/KDE:KDE3/openSUSE_Leap_15.2/
 5 | Marec                                | home:marec2000                                                           | No      | ----      | ----    | http://download.opensuse.org/repositories/home:/marec2000/openSUSE_Leap_15.2/
 6 | NVIDIA                               | NVIDIA                                                                   | Yes     | (r ) Yes  | Yes     | https://download.nvidia.com/opensuse/leap/15.2
 7 | Perl                                 | devel:languages:perl                                                     | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/devel:/languages:/perl/openSUSE_Leap_15.2/
 8 | cinelerra                            | cingg                                                                    | Yes     | (  ) No   | Yes     | https://cinelerra-gg.org/download/pkgs/leap15.2/
 9 | code                                 | Visual Studio Code                                                       | Yes     | (r ) Yes  | No      | https://packages.microsoft.com/yumrepos/vscode
10 | dl8fcl-sdr                           | home:dl8fcl:sdr                                                          | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/home:/dl8fcl:/sdr/openSUSE_Leap_15.2/
11 | electronics                          | Electronics stuff and development (openSUSE_Leap_15.2)                   | Yes     | (r ) Yes  | No      | http://download.opensuse.org/repositories/electronics/openSUSE_Leap_15.2/
12 | google-chrome                        | google-chrome                                                            | No      | ----      | ----    | http://dl.google.com/linux/chrome/rpm/stable/x86_64
13 | home_aevseev                         | Project of Alexander Evseev (openSUSE-15.2)                              | Yes     | (r ) Yes  | No      | http://download.opensuse.org/repositories/home:/aevseev/openSUSE-15.2/
14 | home_vodoo                           | vodoo's Home Project (openSUSE_Factory)                                  | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/home:/vodoo/openSUSE_Factory/
15 | home_wkazubski                       | wkazubski's Home Project (openSUSE_Leap_15.2)                            | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/home:/wkazubski/openSUSE_Leap_15.2/
16 | https-download.opensuse.org-02e4c747 | KDE:Qt5                                                                  | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/KDE:/Qt5/openSUSE_Leap_15.2/
17 | https-download.opensuse.org-ac35ae2f | home:lemmy04                                                             | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/home:/lemmy04/openSUSE_Leap_15.2/
18 | https-download.opensuse.org-b934cefe | devel:tools:building                                                     | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/devel:/tools:/building/openSUSE_Leap_15.2/
19 | https-download.opensuse.org-d6f20524 | KDE:Frameworks5                                                          | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/KDE:/Frameworks5/openSUSE_Leap_15.2/
20 | libdvdcss                            | libdvdcss repository                                                     | No      | ----      | ----    | http://opensuse-guide.org/repo/openSUSE_Leap_15.2/
21 | mozilla                              | mozilla                                                                  | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/mozilla/openSUSE_Leap_15.2/
22 | mozilla_beta                         | Experimental/beta Mozilla versions (openSUSE_Leap_15.2)                  | Yes     | (r ) Yes  | No      | https://download.opensuse.org/repositories/mozilla:/beta/openSUSE_Leap_15.2/
23 | multimedia_libs                      | Multimedia Libraries, Codecs and Command Line Tools (openSUSE_Leap_15.2) | Yes     | (r ) Yes  | No      | http://download.opensuse.org/repositories/multimedia:/libs/openSUSE_Leap_15.2/
24 | packman                              | Packman Repository                                                       | Yes     | (r ) Yes  | Yes     | http://packman.inode.at/suse/openSUSE_Leap_15.2/
25 | publishing                           | Publishing                                                               | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/Publishing/openSUSE_Leap_15.2/
26 | repo-debug                           | openSUSE-Leap-15.2-Debug                                                 | No      | ----      | ----    | http://download.opensuse.org/debug/distribution/leap/15.2/repo/oss/
27 | repo-debug-non-oss                   | openSUSE-Leap-15.2-Debug-Non-Oss                                         | No      | ----      | ----    | http://download.opensuse.org/debug/distribution/leap/15.2/repo/non-oss/
28 | repo-debug-update                    | openSUSE-Leap-15.2-Update-Debug                                          | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.2/oss/
29 | repo-debug-update-non-oss            | openSUSE-Leap-15.2-Update-Debug-Non-Oss                                  | No      | ----      | ----    | http://download.opensuse.org/debug/update/leap/15.2/non-oss/
30 | repo-non-oss                         | openSUSE-Leap-15.2-Non-Oss                                               | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.2/repo/non-oss/
31 | repo-oss                             | openSUSE-Leap-15.2-Oss                                                   | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/distribution/leap/15.2/repo/oss/
32 | repo-source                          | openSUSE-Leap-15.2-Source                                                | No      | ----      | ----    | http://download.opensuse.org/source/distribution/leap/15.2/repo/oss/
33 | repo-source-non-oss                  | openSUSE-Leap-15.2-Source-Non-Oss                                        | No      | ----      | ----    | http://download.opensuse.org/source/distribution/leap/15.2/repo/non-oss/
34 | repo-update                          | openSUSE-Leap-15.2-Update                                                | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.2/oss/
35 | repo-update-non-oss                  | openSUSE-Leap-15.2-Update-Non-Oss                                        | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/update/leap/15.2/non-oss/
36 | sdr                                  | hardware:sdr                                                             | Yes     | (r ) Yes  | Yes     | https://download.opensuse.org/repositories/hardware:/sdr/openSUSE_Leap_15.2/
37 | snappy                               | snappy                                                                   | No      | ----      | ----    | https://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2
38 | sublime-text                         | Sublime Text - x86_64 - Stable                                           | No      | ----      | ----    | https://download.sublimetext.com/rpm/stable/x86_64
39 | teams                                | teams                                                                    | Yes     | (r ) Yes  | Yes     | https://packages.microsoft.com/yumrepos/ms-teams
40 | teamviewer                           | TeamViewer - x86_64                                                      | Yes     | (r ) Yes  | No      | http://linux.teamviewer.com/yum/stable/main/binary-x86_64/
41 | wolfi                                | home:wolfi323                                                            | No      | ----      | ----    | http://download.opensuse.org/repositories/home:/wolfi323/openSUSE_Leap_15.2/
42 | x2go                                 | X11:RemoteDesktop:x2go                                                   | Yes     | (r ) Yes  | Yes     | http://download.opensuse.org/repositories/X11:/RemoteDesktop:/x2go/openSUSE_Leap_15.2/
andromeda:~ # 


I did an onlien upgrade with some repos activated: oss, non-oss, packman, and I think that mozilla.
Maybe I have to switch all packages to OSS and upgrade?

Hi
Are there any python packages installed from the other repositories? AFAIK, the command I indicated should have switched them all and used the leap 15.2 repositories to upgrade the packages from the respective repositories… Likewise I don’t generally add additional repositories, just grab the rpms I need and install via a local repository or direct with zypper.

Vodoo repo seems to be built on Factory. Never mix factory with Leap.

Hi
Good spotting :slight_smile:

Also many Repos are enabled but not refreshed…

multimedia:libs and Packman at same time is no good choice

It’s curious the problems you’re seeing others (including myself) don’t see.

Perhaps a good try at this point is to upgrade again.
Of course and always, backup anything that’s valuable. Nothing follows that should cause a serious problem like an unbootable system or loss of data, but don’t take a chance.

Option 1
Offline upgrade
Download the DVD and perform the upgrade.
Follow that up with an update to bring your system up to date.

Option 2
Online upgrade
Disable all repositories except for the OSS and OSS-update.
Execute another “zypper dup”
After verifying things are working properly, re-enable your other repos and perform a “zypper up” (not dup).

TSU

I encountered the same problem with pip3 on my system after upgrading from 15.1 to 15.2.

I think the problem was that at some time I upgraded pip by ‘pip install --upgrade pip’
so parts of a manually installed pip with version 20.* were still present in addition to leaps pip 10.*

In a reckless moment I removed all files with the pattern
/usr/lib/python3.6/site-packages/pip*
and force-reinstalled python3-pip with zypper. After this, pip3 worked again for me.

Glad to hear about your solution,
But I’ve never had a problem upgrading pip (so far) and upgrading is actually usually necessary to work correctly with the Pypi repos.
The OSS verion of pip has never been sufficiently up to date for me.

TSU

That was it.

andromeda:~ # ls /usr/lib/python3.6/site-packages/pip*
/usr/lib/python3.6/site-packages/pip:
__init__.py  __main__.py  __pycache__  _internal  _vendor

/usr/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg-info:
PKG-INFO  SOURCES.txt  dependency_links.txt  entry_points.txt  not-zip-safe  requires.txt  top_level.txt

/usr/lib/python3.6/site-packages/pip-20.2.3.dist-info:
INSTALLER  LICENSE.txt  METADATA  RECORD  REQUESTED  WHEEL  entry_points.txt  top_level.txt
andromeda:~ #

So there where different pip version mixed.

So I have just removed /usr/lib/python3.6/site-packages/pip*

And reinstalled python3-pip

andromeda:/usr/lib/python3.6/site-packages # zypper in --force python3-pip
Loading repository data...
Reading installed packages...
Forcing installation of 'python3-pip-10.0.1-lp152.3.4.noarch' from repository 'openSUSE-Leap-15.2-Oss'.
Resolving package dependencies...

The following package is going to be reinstalled:
  python3-pip

1 package to reinstall.
Overall download size: 1.6 MiB. Already cached: 0 B. No additional space will be used or freed after the operation.
Continue? [y/n/v/...? shows all options] (y): 
Retrieving package python3-pip-10.0.1-lp152.3.4.noarch                                                                                   (1/1),   1.6 MiB (  9.0 MiB unpacked)
Retrieving: python3-pip-10.0.1-lp152.3.4.noarch.rpm ..........................................................................................................[done (962 B/s)]

Checking for file conflicts: ...........................................................................................................................................[done]
(1/1) Installing: python3-pip-10.0.1-lp152.3.4.noarch ..................................................................................................................[done]
andromeda:/usr/lib/python3.6/site-packages # ls /usr/lib/python3.6/site-packages/pip*
/usr/lib/python3.6/site-packages/pip:
__init__.py  __main__.py  __pycache__  _internal  _vendor

/usr/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg-info:
PKG-INFO  SOURCES.txt  dependency_links.txt  entry_points.txt  not-zip-safe  requires.txt  top_level.txt
andromeda:/usr/lib/python3.6/site-packages # 


Now the error is gone

fernando@andromeda:~> pip3 help install 

Usage:   
  pip3 install [options] <requirement specifier> [package-index-options] ...
  pip3 install [options] -r <requirements file> [package-index-options] ...
  pip3 install [options] -e] <vcs project url> ...
  pip3 install [options] -e] <local project path> ...
  pip3 install [options] <archive url/path> ...

Description:
  Install packages from:
  
  - PyPI (and other indexes) using requirement specifiers.
  - VCS project urls.
  - Local project directories.
  - Local or remote source archives.
  
  pip also supports installing from "requirements files", which provide
  an easy way to specify a whole environment to be installed.

Install Options:
  -r, --requirement <file>    Install from the given requirements file. This option can be used multiple times.
.................
.................

Anyway I will review all the other issues all of you have said just in case they are causing any troubles.

best regards

I recently had this very same problem on 15.1 after a system update in 2020-10-7. deleting the directory and re installing did not succeed, I had to remove python3-pip=10.1.3.3 and then manually installing pip3 as explained in documentation. the relevant line in zypper history log from the update seems to be:

2020-10-07 09:30:25|install|python3-pip|10.0.1-lp151.3.3.1|noarch||repo-update|500299cef844368b78525cafcf05244544a7a551582e11b345fc3194986cfbf0

where my repo-update is

 19 | repo-update    | Main Update Repository | [http://download.opensuse.org/update/leap/15.1/oss](http://download.opensuse.org/update/leap/15.1/oss)

so there seems to be abug in that package !

sudo zypper rm python3-pip
sudo rm -fr /usr/lib/python3.6/site-packages/pip*
sudo zypper in python3-pip

Worked for me.