[Distutils] Installing from a wheel

Oscar Benjamin oscar.j.benjamin at gmail.com
Wed Aug 21 15:28:57 CEST 2013


On 21 August 2013 14:08, Paul Moore <p.f.moore at gmail.com> wrote:
> On 21 August 2013 13:59, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:
>>
>> $ cat spam.py
>> # spam.py
>> print('running spam from:', __file__)
[snip]
>
> Looks good. You might want to add the (undocumented) universal flag to
> setup.cfg, as your wheel is Python only and works for Python 2 and 3, and so
> not version-specific.

Really I need to import print_function for that universality to be
true but we'll overlook that :)

> setup.cfg:
>
> [wheel]
> universal=1

Okay so I need setup.cfg as well as setup.py.

[snip]
>
> Looks good. I thought wheel install gave some progress output, but it's a
> long time since I used it and I may be misremembering. You can also use pip
> install --use-wheel if you prefer (assuming you have pip 1.4+)

Okay, that's good. I'd rather just use the pip command than use wheel directly.

>> So now how do I uninstall it?
>>
>> $ pip uninstall spam
>> Can't uninstall 'spam'. No files were found to uninstall.
>>
>> The wheel command doesn't seem to have an uninstall option either
>
> Odd. pip uninstall should work. Can you confirm your version of pip and
> wheel? And can you list the contents of the spam-1.0.dist-info directory in
> your site-packages?

$ pip --version
pip 1.3.1 from q:\tools\python27\lib\site-packages\pip-1.3.1-py2.7.egg
(python 2.7)

$ wheel --version  # This gives a usage message

>>> import wheel
>>> wheel.__version__
'0.21.0'

$ ls /q/tools/Python27/Lib/site-packages/spam-1.0.dist-info/
DESCRIPTION.rst  METADATA  RECORD  WHEEL  pydist.json  top_level.txt
$ cat /q/tools/Python27/Lib/site-packages/spam-1.0.dist-info/*
UNKNOWN


Metadata-Version: 2.0
Name: spam
Version: 1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Platform: UNKNOWN

UNKNOWN


spam-1.0.dist-info\DESCRIPTION.rst,sha256=OCTuuN6LcWulhHS3d5rfjdsQtW22n7HENFRh6jC6ego,10
spam-1.0.dist-info\METADATA,sha256=N7NDv-twCNGywvm1HXdz67MoFL4xIUoT5p39--tGGB8,179
spam-1.0.dist-info\WHEEL,sha256=ceN1GNMAiWCEADx3_5pdpmZwt4A_AtSxSxYSCyHhhPw,98
spam-1.0.dist-info\pydist.json,sha256=rptnmxTtRo0YZfBQZbIxMdHWDAg48f0UhCDmdymzHbk,174
spam-1.0.dist-info\top_level.txt,sha256=KE4wKczjrl7gsFhmEA4wAEY1n1OuTHf-azTAWqenLO4,5
spam.py,sha256=_5V9b8A2xHt-590km2JzJniHeWIiXbdU_wVHONhTzms,48
spam-1.0.dist-info/RECORD,,
Wheel-Version: 1.0
Generator: bdist_wheel (0.21.0)
Root-Is-Purelib: true
Tag: py27-none-any

{"document_names": {"description": "DESCRIPTION.rst"}, "name": "spam",
"metadata_version": "2.0", "generator": "bdist_wheel (0.21.0)",
"summary": "UNKNOWN", "version": "1.0"}spam

So I tried updating everything e.g.:

$ pip install -U wheel pip setuptools
Requirement already up-to-date: wheel in q:\tools\python27\lib\site-packages
Downloading/unpacking pip from
https://pypi.python.org/packages/source/p/pip/pip-1.4.1.tar.gz#md5=6afbb46aeb48abac658d4df742bff714
  Downloading pip-1.4.1.tar.gz (445kB): 445kB downloaded
  Running setup.py egg_info for package pip

    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.rst' found under
directory 'docs\_build'
    no previously-included directories found matching 'docs\_build\_sources'
Downloading/unpacking distribute from
https://pypi.python.org/packages/source/d/distribute/distribute-0.7.3.zip#md5=c6c59594a7b180af57af8a0cc0cf5b4a
  Downloading distribute-0.7.3.zip (145kB): 145kB downloaded
  Running setup.py egg_info for package distribute

Downloading/unpacking setuptools>=0.7 from
https://pypi.python.org/packages/source/s/setuptools/setuptools-1.0.tar.gz#md5=3d196ffb6e5e4425daddbb4fe42a4a74
(from distribute)
  Downloading setuptools-1.0.tar.gz (679kB): 679kB downloaded
  Running setup.py egg_info for package setuptools

Installing collected packages: pip, distribute, setuptools
  Found existing installation: pip 1.3.1
    Uninstalling pip:
      Successfully uninstalled pip
  Running setup.py install for pip

    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.rst' found under
directory 'docs\_build'
    no previously-included directories found matching 'docs\_build\_sources'
    Installing pip-script.py script to q:\tools\Python27\Scripts
    Installing pip.exe script to q:\tools\Python27\Scripts
    Installing pip.exe.manifest script to q:\tools\Python27\Scripts
    Installing pip-2.7-script.py script to q:\tools\Python27\Scripts
    Installing pip-2.7.exe script to q:\tools\Python27\Scripts
    Installing pip-2.7.exe.manifest script to q:\tools\Python27\Scripts
Exception:
Traceback (most recent call last):
  File "q:\tools\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\basecommand.py",
line 139, in main
  File "q:\tools\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\commands\install.py",
line 271, in run
  File "q:\tools\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py",
line 1193, in install
  File "q:\tools\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py",
line 507, in commit_uninstall
  File "q:\tools\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\req.py",
line 1542, in commit
  File "q:\tools\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\util.py",
line 41, in rmtree
  File "q:\tools\Python27\lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "q:\tools\Python27\lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "q:\tools\Python27\lib\shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "q:\tools\Python27\lib\shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "q:\tools\Python27\lib\site-packages\pip-1.3.1-py2.7.egg\pip\util.py",
line 60, in rmtree_errorhandler
WindowsError: [Error 5] Access is denied:
'c:\\docume~1\\enojb\\locals~1\\temp\\pip-6echt4-uninstall\\tools\\python27\\scripts\\pip.exe'

Storing complete log in c:/Documents and Settings/enojb\pip\pip.log

Does that mean that pip is broken now? Or is it just that the .exe
wasn't replaced?

After this I deleted the site-packages/spam* files, rebuilt the wheel,
used wheel to install again and now I get:

$ pip list
Cython (0.19.1)
distribute (0.6.40)
docutils (0.11)
ipython (0.13.2)
Jinja2 (2.7.1)
line-profiler (1.0b3)
MarkupSafe (0.18)
matplotlib (1.2.1)
mpmath (0.17)
numpy (1.7.1)
pip (1.4.1)
Pygments (1.6)
pyreadline (2.0)
scipy (0.12.0)
Exception:
Traceback (most recent call last):
  File "q:\tools\Python27\lib\site-packages\pip\basecommand.py", line
134, in main
    status = self.run(options, args)
  File "q:\tools\Python27\lib\site-packages\pip\commands\list.py",
line 80, in run
    self.run_listing(options)
  File "q:\tools\Python27\lib\site-packages\pip\commands\list.py",
line 127, in run_listing
    self.output_package_listing(installed_packages)
  File "q:\tools\Python27\lib\site-packages\pip\commands\list.py",
line 136, in output_package_listing
    if dist_is_editable(dist):
  File "q:\tools\Python27\lib\site-packages\pip\util.py", line 347, in
dist_is_editable
    req = FrozenRequirement.from_dist(dist, [])
  File "q:\tools\Python27\lib\site-packages\pip\__init__.py", line
194, in from_dist
    assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

Storing complete log in c:/Documents and Settings/enojb\pip\pip.log

Is it because of distribute? I didn't think I'd installed that.

Here's how dist-info looks now:

$ ls /q/tools/Python27/Lib/site-packages/spam-1.0.dist-info/
DESCRIPTION.rst  METADATA  RECORD  WHEEL  pydist.json  top_level.txt
$ cat /q/tools/Python27/Lib/site-packages/spam-1.0.dist-info/*
UNKNOWN


Metadata-Version: 2.0
Name: spam
Version: 1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Platform: UNKNOWN

UNKNOWN


spam-1.0.dist-info\DESCRIPTION.rst,sha256=OCTuuN6LcWulhHS3d5rfjdsQtW22n7HENFRh6jC6ego,10
spam-1.0.dist-info\METADATA,sha256=N7NDv-twCNGywvm1HXdz67MoFL4xIUoT5p39--tGGB8,179
spam-1.0.dist-info\WHEEL,sha256=ceN1GNMAiWCEADx3_5pdpmZwt4A_AtSxSxYSCyHhhPw,98
spam-1.0.dist-info\pydist.json,sha256=rptnmxTtRo0YZfBQZbIxMdHWDAg48f0UhCDmdymzHbk,174
spam-1.0.dist-info\top_level.txt,sha256=KE4wKczjrl7gsFhmEA4wAEY1n1OuTHf-azTAWqenLO4,5
spam.py,sha256=_5V9b8A2xHt-590km2JzJniHeWIiXbdU_wVHONhTzms,48
spam-1.0.dist-info/RECORD,,
Wheel-Version: 1.0
Generator: bdist_wheel (0.21.0)
Root-Is-Purelib: true
Tag: py27-none-any

{"document_names": {"description": "DESCRIPTION.rst"}, "name": "spam",
"metadata_version": "2.0", "generator": "bdist_wheel (0.21.0)",
"summary": "UNKNOWN", "version": "1.0"}spam


Oscar


More information about the Distutils-SIG mailing list