Menu

#126 Uninstall Package tab corrupted after installation of a package.

v2.7.6.1
Fixed
nobody
Medium
Defect
2015-11-05
2015-11-01
algo99
No

Hi,
the issue is related to WinPython Control Panel from WinPython-2.7.10.3 (both 32 and 64 bit).

After manual install of this package:
https://pypi.python.org/pypi/pyOSC/0.3.5b-5294
the Uninstall Packages tab in the Control Panel GUI becomes empty (all entries disappear their).

Discussion

  • stonebig

    stonebig - 2015-11-01

    you may try the "pip list" command to see how it works with this package installed. Eventually post the result here.

     
  • algo99

    algo99 - 2015-11-01

    Ok, after some inverstigation more facts on the issue:

    1. Note the package file has name pyOSC-0.3.5b-5294.tar.gz (with a '-' sign within version number) so dragging this one onto WinPython Control Panel "Install/Upgrade Packages" tab shows:
      Action: Install
      Name: pyOSC-0.3.5b
      Version: 5294 (already wrong, Ok malformed package name :)

    2. After installation in Lib\site-packages appears a folder pyOSC-0.3.5b5294.dist-info (without '-' sign between '5b' and '5294')

    3. If I understand correctly when the Control Panel updates 'Uninstalled Packages' list it reads all 'dist-info' directories in Lib\site-packages and some-how the parsing of the pyOSC version "0.3.5b5294" fails and the list stays uninitialized ?

    HTH
    Albert

    PS. pip list shows:
    ...
    pyOSC (0.3.5b5294)
    ...

     

    Last edit: algo99 2015-11-02
  • stonebig

    stonebig - 2015-11-02

    WinPython relies on pip list for the informations, so I expected a failure is happening because of this strange packaging name. I don't see why.
    The code that get the list is:

    import imp, pip
    pip.utils.pkg_resources = imp.reload(pip.utils.pkg_resources)
    pip_list = [(i.key, i.version) for i in pip.get_installed_distributions()]
    print (pip_list)
    

    can you try it and paste the result here ? If it doesn't fell at that point, I think you have an orphan issue

     

    Last edit: stonebig 2015-11-02
  • algo99

    algo99 - 2015-11-04

    Ok, I could figure out it.

    The reason the list stays empty is an exception in wppm.get_installed_packages(), line 358:

    # create pip package list
    wppip = [Package('%s-%s-py2.py3-none-any.whl' %
             (i[0].lower(), i[1])) for i in pip_list]
    

    for the input parameter pyosc-0.3.5b5294-py2.py3-none-any.whl of Package class.

    The exception is thrown from wppm.Package.extract_infos(), line 155:

    elif bname.endswith(('.zip', '.tar.gz', '.whl')):
        # distutils sdist
        infos = utils.get_source_package_infos(bname)
        if infos is not None:
            self.name, self.version = infos
            return
    raise NotImplementedError("Not supported package type %s" % bname)
    

    because infos for bname=pyosc-0.3.5b5294-py2.py3-none-any.whl is None

    This in turn caused by the fact that the regular expression utils.SOURCE_PATTERN does not match the given bname, the match will be None:

    def get_source_package_infos(fname):
        """Return a tuple (name, version) of the Python source package"""
        match = re.match(SOURCE_PATTERN, osp.basename(fname))
        if match is not None:
            return match.groups()[:2]
    
     

    Last edit: algo99 2015-11-04
  • stonebig

    stonebig - 2015-11-04

    ah, ok, in your python-2.7.10.amd64\Lib\site-packages\winpython\utils.py , at line 466

    try to replace

    SOURCE_PATTERN = r'([a-zA-Z0-9\-\_\.]*)-([0-9\.\_]*[a-z]*[0-9]?)(\.zip|\.tar\.gz|\-(py[2-7]*|py[2-7]*\.py[2-7]*)\-none\-any\.whl)'
    

    per

    SOURCE_PATTERN = r'([a-zA-Z0-9\-\_\.]*)-([0-9\.\_]*[a-z]*[\-]?[0-9]*)(\.zip|\.tar\.gz|\-(py[2-7]*|py[2-7]*\.py[2-7]*)\-none\-any\.whl)'
    

    It's a bug as, for example, Theano-0.7.1a42-py2-none-any.whl will have the same issue.

     

    Last edit: stonebig 2015-11-04
  • algo99

    algo99 - 2015-11-05

    Works for me, thank you.

     
  • stonebig

    stonebig - 2015-11-05
    • status: New --> Fixed
     
  • stonebig

    stonebig - 2015-11-05

    fixed in next Winpython - 201508

     

Log in to post a comment.

MongoDB Logo MongoDB