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

Is it possible for python to write to its own zip archive? #44

Open
RoyTinker opened this issue Jun 24, 2024 · 3 comments
Open

Is it possible for python to write to its own zip archive? #44

RoyTinker opened this issue Jun 24, 2024 · 3 comments

Comments

@RoyTinker
Copy link

RoyTinker commented Jun 24, 2024

For example, I'd like to be able to install a pip upgrade and other packages inside the ape archive:

$ ./python -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /zip/Lib/site-packages (23.1.2)
Collecting pip
  Downloading pip-24.1-py3-none-any.whl (1.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 23.6 MB/s eta 0:00:00
Installing collected packages: pip
  WARNING: The scripts pip, pip3 and pip3.11 are installed in '/Users/roy/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-24.1

But it looks like the path /zip/Lib is not writable from within python execution, so it defaults to $HOME/.local/bin instead.

Is there a way to enable writing to /zip/Lib/site-packages?

@franalbani
Copy link

/zip is read only. See this.

1 similar comment
@franalbani
Copy link

/zip is read only. See this.

@ahgamut
Copy link
Owner

ahgamut commented Dec 14, 2024

/zip used to be writable on Linux/FreeBSD (definitely back when it was zip:) but it had too many edge cases and weird interactions, so the feature was removed. For adding packages (like say click) to Python APEs, I usually run:

./python.com -m pip download click
mkdir -p ./Lib/site-packages
cd Lib/site-packages
unzip ../../click*.whl
cd ../../
zip -qr python.com Lib/

I wonder if it's possible to patch pip or setuptools to do the above thing automatically for a pip install.

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

No branches or pull requests

3 participants