Results 1 to 8 of 8

Thread: Python is broken: No module named pkg_resources

  1. #1
    Join Date
    Aug 2013
    Beans
    1

    Exclamation Python is broken: No module named pkg_resources

    Hello!

    It has been a while since I used this forum for support but I am stuck.

    My setup:

    Code:
    daniel@nergar:~$ cat /etc/lsb-release
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=12.04
    DISTRIB_CODENAME=precise
    DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"
    I woke up today and felt a need to upgrade my seedbox, all went fine so I went ahead and updated my flexget installation with the command:

    Code:
    sudo pip install --upgrade flexget
    The command completed successfully, but immediately after pip stopped working:

    Code:
    daniel@nergar:~$ pip
    Traceback (most recent call last):
      File "/usr/bin/pip", line 5, in <module>
        from pkg_resources import load_entry_point
    ImportError: No module named pkg_resources
    Now flexget is also broken and this is the error message I'm getting:

    Code:
    daniel@nergar:~$ flexget
    Traceback (most recent call last):
      File "/usr/local/bin/flexget", line 7, in <module>
        from pkg_resources import load_entry_point
    ImportError: No module named pkg_resources
    I have checked and I have python-pkg-resources installed:

    Code:
    daniel@nergar:~$ sudo find / -name 'pkg_resources.*'
    /usr/share/doc/python-pkg-resources/pkg_resources.txt.gz
    /usr/lib/python2.7/dist-packages/pkg_resources.py
    But for some reason python can't find it, I tried setting the PYTHONHOME and PYTHONPATH variables without any luck, also I tried modifying the flexget script:

    PHP Code:
    #!/usr/bin/python
    # EASY-INSTALL-ENTRY-SCRIPT: 'FlexGet==1.1','console_scripts','flexget'
    __requires__ 'FlexGet==1.1'
    import sys
    sys
    .path.append("/usr/lib/python2.7/dist-packages/")

    from pkg_resources import load_entry_point

    if __name__ == '__main__':
        
    sys.exit(
            
    load_entry_point('FlexGet==1.1''console_scripts''flexget')()
        ) 
    I don't understand why python can't find anything. I also installed python-setuptools but easy_install is not working

    Code:
    daniel@nergar:~$ sudo aptitude install python-setuptools
    No packages will be installed, upgraded, or removed.
    0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B of archives. After unpacking 0 B will be used.
    
    daniel@nergar:~$ easy_install
    -bash: easy_install: command not found
    Does anyone knows how to fix python in my system? I don't want to reinstall the OS because it will cost me money with my provider.
    Last edited by nergar2; August 13th, 2013 at 05:21 PM.

  2. #2
    Join Date
    Feb 2007
    Location
    Mexico
    Beans
    73
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Python is broken: No module named pkg_resources

    Anyone?? Please!!
    Hacker != Cracker

  3. #3
    Join Date
    Aug 2013
    Beans
    1

    Re: Python is broken: No module named pkg_resources

    hello, i just ran into the same error, here is what i've done to fix it:

    apt-get remove --purge python-pkg-resources

    apt-get install ubuntu-desktop


    i think you don't run ubuntu desktop so just reinstall the bunch of packages that where uninstalled by the removal of python-pkg-resources.

    PS: you can try dpkg-reconfigure python-pkg-resources but it didn't worked for me.

  4. #4
    Join Date
    Feb 2007
    Location
    Mexico
    Beans
    73
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Python is broken: No module named pkg_resources

    That did the trick!!! thanks a lot!
    Hacker != Cracker

  5. #5
    Join Date
    Oct 2013
    Beans
    1

    Re: Python is broken: No module named pkg_resources

    Quote Originally Posted by y-rebattu View Post
    hello, i just ran into the same error, here is what i've done to fix it:

    apt-get remove --purge python-pkg-resources

    apt-get install ubuntu-desktop


    i think you don't run ubuntu desktop so just reinstall the bunch of packages that where uninstalled by the removal of python-pkg-resources.

    PS: you can try dpkg-reconfigure python-pkg-resources but it didn't worked for me.
    The issue with this is usually that there is something mis-configured or a package missing. I have had the same type of issue and the first step is to make sure that the python tools are working correctly.

    To fix the issue, run the setup script for setuptools:
    Code:
    curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | sudo python

  6. #6
    Join Date
    Aug 2013
    Beans
    19

    Re: Python is broken: No module named pkg_resources

    Thanks ... helps a lot. DP

  7. #7
    Join Date
    Mar 2014
    Beans
    1

    Re: Python is broken: No module named pkg_resources

    This should work just fine (it did for me):

    sudo apt-get install --reinstall python-pkg-resources

  8. #8
    Join Date
    Apr 2005
    Beans
    18

    Re: Python is broken: No module named pkg_resources

    Quote Originally Posted by hopem View Post
    This should work just fine (it did for me):

    sudo apt-get install --reinstall python-pkg-resources
    Thanks for the thread, guys. That got me half-way there. Here's the full command that got it all working again for me:

    Code:
    sudo apt-get install python-pkg-resources python-setuptools --reinstall

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •