On 30 August 2013 13:49, Daniel Holth <dho...@gmail.com> wrote: > On Fri, Aug 30, 2013 at 7:54 AM, Oscar Benjamin <oscar.j.benja...@gmail.com> > wrote: >> >> I just tried to install bento to test it out and: >> >> $ pip install bento >> Downloading/unpacking bento >> Downloading bento-0.1.1.tar.gz (582kB): 582kB downloaded >> Running setup.py egg_info for package bento >> Installing collected packages: bento >> Running setup.py install for bento >> Could not find .egg-info directory in install record for bento >> Cleaning up... >> 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\install.py", >> line 241, in run >> requirement_set.install(install_options, global_options, >> root=options.root_path) >> File "Q:\tools\Python27\lib\site-packages\pip\req.py", line 1298, in >> install >> requirement.install(install_options, global_options, *args, **kwargs) >> File "Q:\tools\Python27\lib\site-packages\pip\req.py", line 668, in install >> os.remove(record_filename) >> WindowsError: [Error 32] The process cannot access the file because it >> is being used by another process: >> 'c:\\docume~1\\enojb\\locals~1\\temp\\pip-aae65s-record\\install-record.txt' >> >> Storing complete log in c:/Documents and Settings/enojb\pip\pip.log >> >> I tried deleting the mentioned file but just got the same error >> message again. Is that a bento/pip/setuptools bug? I notice that the >> bento docs don't mention pip on the installation page: >> http://cournape.github.io/Bento/html/install.html >> >> Here's the appropriate version information: >> >> $ pip --version >> pip 1.4.1 from q:\tools\python27\lib\site-packages (python 2.7) >> $ python --version >> Python 2.7.5 >> $ python -c 'import setuptools; print(setuptools.__version__)' >> 1.1 >> >> (I just very carefully updated pip/setuptools based on Paul's previous >> instructions). >> >> The bento setup.py uses bento's own setup() command: >> https://github.com/cournape/Bento/blob/master/setup.py > > It looks like you cannot install bento itself using pip on Windows. It > might be a Windows bug "WindowsError: [Error 32] The process cannot > access the file because it is being used by another process:". It's a > little better on Linux (it gets installed) but I don't think Bento is > really meant to be installed in this way.
I't's a bug in pip. The file in question is opened by pip a few lines above. The particular code path is called because the else logger.warn() clause gets triggered (i.e. where it says "## FIX ME" :) ) f = open(record_filename) for line in f: line = line.strip() if line.endswith('.egg-info'): egg_info_dir = prepend_root(line) break else: logger.warn('Could not find .egg-info directory in install record for %s' % self) ## FIXME: put the record somewhere ## FIXME: should this be an error? return f.close() new_lines = [] f = open(record_filename) for line in f: filename = line.strip() if os.path.isdir(filename): filename += os.path.sep new_lines.append(make_path_relative(prepend_root(filename), egg_info_dir)) f.close() f = open(os.path.join(egg_info_dir, 'installed-files.txt'), 'w') f.write('\n'.join(new_lines)+'\n') f.close() finally: if os.path.exists(record_filename): os.remove(record_filename) os.rmdir(temp_location) The error comes from the os.remove line 2nd from bottom. The file was opened in the top line. The logger.warn code path returns without closing the file. If I add f.close() just before return then I get: $ pip install bento Downloading/unpacking bento Downloading bento-0.1.1.tar.gz (582kB): 582kB downloaded Running setup.py egg_info for package bento Installing collected packages: bento Running setup.py install for bento Could not find .egg-info directory in install record for bento Successfully installed bento Cleaning up... It's probably better to use the with statement though. Oscar _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig