Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Do-release-upgrade error #5783

Closed
ghost opened this issue Sep 14, 2018 · 8 comments
Closed

Do-release-upgrade error #5783

ghost opened this issue Sep 14, 2018 · 8 comments
Labels
auto-locked Outdated issues that have been locked by automation resolution: no action When the resolution is to not do anything

Comments

@ghost
Copy link

ghost commented Sep 14, 2018

Environment

  • pip version: 18.0
  • Python version: 3.6.5
  • OS: Ubuntu 16.04.5 LTS

Description
I'm trying to upgrade my Ubuntu from 16 to 18 by doing the do-release-upgrade command but every time I try to do so I get an error. After some research I discovered that this is a problem with my pip, but it seems to work just fine when I try to install packages.

Output

>> sudo do-release-upgrade 
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [819 B]                                                                                                                                                                              
Get:2 Upgrade tool [1.258 kB]                                                                                                                                                                                     
Fetched 1.259 kB in 0s (0 B/s)                                                                                                                                                                                    
authenticate 'bionic.tar.gz' against 'bionic.tar.gz.gpg' 
extracting 'bionic.tar.gz'

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-jz694ln_/bionic", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-jz694ln_/DistUpgrade/DistUpgradeMain.py", line 224, in main
    from .DistUpgradeController import DistUpgradeController
  File "/tmp/ubuntu-release-upgrader-jz694ln_/DistUpgrade/DistUpgradeController.py", line 52, in <module>
    from .DistUpgradeQuirks import DistUpgradeQuirks
  File "/tmp/ubuntu-release-upgrader-jz694ln_/DistUpgrade/DistUpgradeQuirks.py", line 36, in <module>
    from janitor.plugincore.manager import PluginManager
  File "/tmp/ubuntu-release-upgrader-jz694ln_/janitor/__init__.py", line 20, in <module>
    import pkg_resources
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 956, in subscribe
    callback(dist)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2515, in activate
    declare_namespace(pkg)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/problem_report.py", line 497, in add_to_existing
    self.write(f)
  File "/usr/lib/python3/dist-packages/problem_report.py", line 452, in write
    crc = zlib.crc32(block, crc)
TypeError: a bytes-like object is required, not 'str'

Original exception was:
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-jz694ln_/bionic", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-jz694ln_/DistUpgrade/DistUpgradeMain.py", line 224, in main
    from .DistUpgradeController import DistUpgradeController
  File "/tmp/ubuntu-release-upgrader-jz694ln_/DistUpgrade/DistUpgradeController.py", line 52, in <module>
    from .DistUpgradeQuirks import DistUpgradeQuirks
  File "/tmp/ubuntu-release-upgrader-jz694ln_/DistUpgrade/DistUpgradeQuirks.py", line 36, in <module>
    from janitor.plugincore.manager import PluginManager
  File "/tmp/ubuntu-release-upgrader-jz694ln_/janitor/__init__.py", line 20, in <module>
    import pkg_resources
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in _initialize_master_working_set
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 956, in subscribe
    callback(dist)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2952, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2515, in activate
    declare_namespace(pkg)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2097, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2047, in _handle_ns
    _rebuild_mod_path(path, packageName, module)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2066, in _rebuild_mod_path
    orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
@benoit-pierre
Copy link
Member

Did you use sudo pip install at any point?

@ghost
Copy link
Author

ghost commented Sep 14, 2018

Yes, something like sudo -H pip3 install scrapy works fine

@benoit-pierre
Copy link
Member

You should never use sudo pip, you probably messed some of your distribution packages.

@benoit-pierre
Copy link
Member

At this point, you could try something like:

python3 -m pip uninstall pip setuptools wheel
sudo apt-get --reinstall install  python3-setuptools python3-wheel python3-pip

python -m pip uninstall pip setuptools wheel
sudo apt-get --reinstall install python-setuptools python-wheel python-pip 

to go back to the distribution version of those packages.

Note: untested, I take no responsibility...

@ghost
Copy link
Author

ghost commented Sep 14, 2018

Now my pip3 doesn't work anymore

>> pip3 install scrapy
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

@benoit-pierre
Copy link
Member

I imagine you have another version in ~/.local/lib/pythonx.x.

@benoit-pierre
Copy link
Member

See #5599 and the myriad of other related issues.

@pradyunsg pradyunsg added the resolution: no action When the resolution is to not do anything label Sep 18, 2018
@ghost ghost closed this as completed Sep 19, 2018
@lock
Copy link

lock bot commented Jun 1, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 1, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 1, 2019
This issue was closed.
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
auto-locked Outdated issues that have been locked by automation resolution: no action When the resolution is to not do anything
Projects
None yet
Development

No branches or pull requests

2 participants