Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use setup.py directly rather than pip install #203

Merged
merged 15 commits into from
Feb 9, 2015

Conversation

mdboom
Copy link
Collaborator

@mdboom mdboom commented Jan 30, 2015

This results in building the project in the same directory every time, giving ccache a better chance of doing its thing. An alternate solution to #201.

pip install /some/local/path has been used in asv to install the benchmarked project on the assumption that pip knows better about the details of how to install a Python package beyond just the usual setup.py install. However, I wonder if that's really the case...

Note that I tried to use the --build flag for pip install to force it to build in a specific directory. This seems to work for remote packages, but it's ignored when given a local path...

Attn: @pv

@mdboom mdboom mentioned this pull request Jan 30, 2015
@pv
Copy link
Collaborator

pv commented Jan 30, 2015

I think pip refuses to uninstall packages installed by setup.py install --- at least for the case when setup.py is not using setuptools.

Perhaps just running python setup.py build; pip install . will work (or just build_ext instead of build)?
At least for Numpy, this appears to skip the build completely in the second step, so ccache has the opportunity to work with non-random paths.

@pv
Copy link
Collaborator

pv commented Jan 30, 2015

The second question is then what to do with building dependencies --- if the environment in asv is not torn down every time, using ccache for those is probably not so important?

@mdboom
Copy link
Collaborator Author

mdboom commented Jan 30, 2015

I think pip refuses to uninstall packages installed by setup.py install --- at least for the case when setup.py is not using setuptools.

Perhaps just running python setup.py build; pip install . will work (or just build_ext instead of build)?

At least experimentally on a dummy package that uses only vanilla distutils and no setuptools, this appears to be true. python setup.py install makes something that isn't pip uninstall-able. python setup.py build followed by pip install ./project works, though. That seems like a good solution, then.

As for the dependencies, you are correct that they are still being built with random paths, therefore ccache doesn't work. But they are cached in the env directory tree and don't need to be built each time, so it's less of an issue. If it were an issue, we could pass --build ./some-static-tmp-directory to pip when building the dependencies, since --build does work when installing from downloaded packages, just not when installing from the local filesystem.

@pv
Copy link
Collaborator

pv commented Feb 1, 2015

This works fine for me. Does it break the parallel build feature however?

@mdboom
Copy link
Collaborator Author

mdboom commented Feb 1, 2015

I does break the parallel build feature. For a couple of other corner case reasons, I've been meaning to fix the parallel build feature so that each parallel thread would use its own git clone anyway, so this might just be onus to do that...

@mdboom
Copy link
Collaborator Author

mdboom commented Feb 2, 2015

This now makes a separate clone of the project repository for each environment (these are --shared clones, so their .git directories don't take up much space). That way parallel building can work without clobbering another environment's build. This also includes @pv's wheel caching support, so the last N builds are retained and can be reinstalled next time much faster.

The combination of parallel building, ccache working and cached wheels makes things much faster overall. Too bad there isn't a tool to measure that ;)

@mdboom mdboom force-pushed the install-same-place branch from 00427ec to 201042a Compare February 3, 2015 19:37
@pv
Copy link
Collaborator

pv commented Feb 4, 2015

Seems to break asv dev, cf pv/asv@1addad0
asv dev also seems to unnecessarily clone the repo.

if self._wheel_cache_size == 0:
return None

if not os.path.isdir(self._path):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check should be moved --- the directory is first created by the call to _get_wheel _create_wheel_cache_path below.
My logic here with _get_wheel_cache_path creating the directory was a bit funky...
pv/asv@6762b7dd29f

@pv
Copy link
Collaborator

pv commented Feb 4, 2015

Worksforme apart from those two

@mdboom
Copy link
Collaborator Author

mdboom commented Feb 4, 2015

Thanks. I think I've addressed those two issues.

@pv
Copy link
Collaborator

pv commented Feb 5, 2015

The isdir check probably needs to be added to _get_wheel pv/asv@6762b7d ?

@mdboom
Copy link
Collaborator Author

mdboom commented Feb 5, 2015

Indeed. I think it's fixed now.

def _get_wheel(self, commit_hash):
cache_path = self._get_wheel_cache_path(commit_hash)

if not os.isdir(cache_path):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.path.isdir

orig_level = self._logger.level
self._logger.setLevel(level)
yield
self._logger.setLevel(orig_level)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't set the level back if an exception is raised (eg build failure), may be related to gh-209

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've cherry-picked 044b8d6 over to this branch.

Copy link
Collaborator

@pv pv Feb 9, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdboom mdboom mentioned this pull request Feb 9, 2015
mdboom added a commit that referenced this pull request Feb 9, 2015
Use `setup.py` directly rather than `pip install`
@mdboom mdboom merged commit 77a2944 into airspeed-velocity:master Feb 9, 2015
@mdboom mdboom mentioned this pull request Feb 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants