On 21 August 2013 14:56, Paul Moore <p.f.mo...@gmail.com> wrote:
> On 21 August 2013 14:28, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote:
>>
>> So I tried updating everything e.g.:
>>
>> $ pip install -U wheel pip setuptools
>
> [lots omitted for brevity]
>
> Some thoughts.
>
> pip 1.3.1 predates pip's wheel support so you wouldn't have had pip install
> --use-wheel there.
>
> The upgrade error may have been because pip install -U pip tries to install
> a new pip.exe while pip.exe is in use. The error might not be too bad
> (pip.exe doesn't actually need to change).

Maybe, although the path
c:\\docume~1\\enojb\\locals~1\\temp\\pip-6echt4-uninstall\\tools\\python27\\scripts\\pip.exe
is not the location of the pip I used and is not on PATH.

> For safety, "python -m pip install -U pip --force-reinstall" might be worth
> doing.

Okay done. Seems to work fine.

> You quite probably shouldn't have upgraded setuptools like you did. It looks
> like you had a pre-merge version, and upgrading across the distribute merge
> appears to be fun (I have personally never encountered that particular
> flavour of fun, but that's what I'm led to believe).

This is not an old Python installation. I installed this as a clean
installation to test the patches I uploaded for issue12641 2-3 months
ago. I wouldn't have deliberately installed distribute (I know it's
obsoleted) so I don't know how it got there.

> For safety you should
> check your site-packages for setuptools and distribute installations. Maybe
> manually remove distribute if present,

I got this far:
$ rm -r /q/tools/Python27/Lib/site-packages/distribute-0.6.40-py2.7.egg/

and then
$ pip
Traceback (most recent call last):
  File "q:\tools\Python27\Scripts\pip-script.py", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

> and then "python -m pip install -U setuptools --force-reinstall"

Alas, this one doesn't work any more either:
$ python -m pip
q:\tools\Python27\python.exe: No module named pkg_resources; 'pip' is
a package and cannot be directly executed

> (don't do a combined run of pip and setuptools
> together, that's one of the scary failure modes IIRC).

Okay so I manually deleted everything for
pip/setuptools/distribute/easy_install from Scripts and site-packages
and started again. Following the instructions for install pip and
setuptools for Windows I downloaded and ran ez_setup.py followed by
get-pip.py. Then I got this error:

$ py -2.7 get-pip.py
Downloading/unpacking pip

pip can't proceed with requirement 'pip' due to a pre-existing build directory.
 location: c:\docume~1\enojb\locals~1\temp\pip-build-enojb\pip
This is likely due to a previous installation that failed.
pip is being responsible and not assuming it can delete this.
Please delete it and try again.

Cleaning up...
Exception:
Traceback (most recent call last):
  File 
"c:\docume~1\enojb\locals~1\temp\unpacker-c3e81q-scratchdir\pip\basecommand.py",
line 134, in main
    status = self.run(options, args)
  File 
"c:\docume~1\enojb\locals~1\temp\unpacker-c3e81q-scratchdir\pip\commands\install.py",
line 236, in run
    requirement_set.prepare_files(finder,
force_root_egg_info=self.bundle, bundle=self.bundle)
  File "c:\docume~1\enojb\locals~1\temp\unpacker-c3e81q-scratchdir\pip\req.py",
line 1071, in prepare_files
    raise e
PreviousBuildDirError:
pip can't proceed with requirement 'pip' due to a pre-existing build directory.
 location: c:\docume~1\enojb\locals~1\temp\pip-build-enojb\pip
This is likely due to a previous installation that failed.
pip is being responsible and not assuming it can delete this.
Please delete it and try again.

The path it refers to doesn't exist but deleting a similar directory
gets it working:

$ rm -r ~/Local\ Settings/temp/pip-6echt4-uninstall/
enojb@ENM-OB:/q$ py -2.7 get-pip.py
Downloading/unpacking pip
  Downloading pip-1.4.1.tar.gz (445kB): 445kB downloaded
  Running setup.py egg_info for package pip
   ...

Okay so now I'm back in business ('pip list' works etc.).

> pip 1.4.1 should be able to pip uninstall a distribution installed from a
> wheel (but TBH, I would have expected 1.3.1 to be able to, as well. The
> installed data looked OK).

Yes it can:

$ pip uninstall spam
Uninstalling spam:
  q:\tools\python27\lib\site-packages\spam-1.0.dist-info\description.rst
  q:\tools\python27\lib\site-packages\spam-1.0.dist-info\metadata
  q:\tools\python27\lib\site-packages\spam-1.0.dist-info\pydist.json
  q:\tools\python27\lib\site-packages\spam-1.0.dist-info\record
  q:\tools\python27\lib\site-packages\spam-1.0.dist-info\top_level.txt
  q:\tools\python27\lib\site-packages\spam-1.0.dist-info\wheel
  q:\tools\python27\lib\site-packages\spam.py
Proceed (y/n)? y
  Successfully uninstalled spam

Also 'pip install --use-wheel' has a more intuitive interface than wheel:

$ pip install --use-wheel dist/spam-1.0-py27-none-any.whl
Unpacking .\dist\spam-1.0-py27-none-any.whl
Installing collected packages: spam
Successfully installed spam
Cleaning up...

> For people watching at home, upgrading pip really isn't this scary :-) I'm
> just making it sound scary (a) because I don't know the precise upgrade
> instructions for setuptools and (b) because you need to do setuptools and
> pip separately, and use python -m pip on Windows to upgrade pip (neither of
> which are immediately obvious).

Is it perhaps safer to suggest the following?
a) uninstall pip/setuptools/distribute
b) run ez_setup.py
c) run get-pip.py

That's what I just did and it worked fine. Perhaps there could be one
script that does steps a), b) and c) to smooth the path for anyone
upgrading?


Oscar
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to