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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on pre-commit.ci - missing ensurepip #148

Open
takluyver opened this issue Feb 9, 2022 · 4 comments
Open

Fails on pre-commit.ci - missing ensurepip #148

takluyver opened this issue Feb 9, 2022 · 4 comments
Labels

Comments

@takluyver
Copy link

Thanks for this tool, which we're using for h5py. 馃檪

We're running this inside pre-commit on https://pre-commit.ci/ (a dedicated CI platform for pre-commit). At the moment, we have version 0.39, which works. However, pre-commit is keen to upgrade to the latest (0.47), which fails with this message:

check-manifest...........................................................Failed
- hook id: check-manifest
- exit code: 2

['/pc/clone/G2JdS4VyRWO1npwWqn8cWA/py_env-python3/bin/python', '-m', 'build', '--sdist', '.', '--outdir', '/tmp/check-manifest-3l6quvt4-sdist'] failed (status 1):
* Creating venv isolated environment...
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt install python3.8-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/tmp/build-env-dkf2wbiu/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']

It looks like if you depend on build[virtualenv], build will prefer virtualenv to venv, which I think should fix this (https://github.com/pypa/build/blob/96f9188ad181907fbd3e0efdf32dd3dc959d39c3/src/build/env.py#L61-L71 ).

It's frustrating that Debian is willing to break things that we can otherwise assume are always available. 馃槥

takluyver added a commit to takluyver/check-manifest that referenced this issue Feb 9, 2022
Fixes mgedmin#148 (I hope) by allowing build to use virtualenv instead of venv.
@mgedmin
Copy link
Owner

mgedmin commented Feb 9, 2022

TBH I would make sure my CI build environment is not broken by doing a sudo apt-get install -y python3-venv instead of trying to work around it.

(I also don't think a pip-installed virtualenv would work on a Debian-packaged Python 3 without python3-venv being installed. IIRC virtualenv depends on stdlib's venv on Python 3, or at least it used to at one point.)

@takluyver
Copy link
Author

I don't think pre-commit.ci has any way to install extra apt packages - I'd be happy to hear that I'm wrong, but I think the idea is that it has minimal config and runs very fast because it just needs to run the pre-commit hooks, so it can use a standard image and heavy caching.

@takluyver
Copy link
Author

I've tried filing an issue on pre-commit.ci itself - we'll see what comes of that: pre-commit-ci/runner-image#114

@takluyver
Copy link
Author

Anthony - the maintainer of pre-commit - pointed out that network access is disabled when hooks run, so installing stuff in a virtualenv wouldn't work anyway, and the only option for this hook on pre-commit.ci is to use the --no-build-isolation option, as mentioned in the Readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants