Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

60%
+1 −0
Q&A How to preserve pip install temporary directory for error analyse?

Honestly I have a solution, but honestly I could not give a medal for their work to the pip devs. Pip has a --no-clean flag. On the docs, it preserves the temporary directories for further ana...

posted 13h ago by peterh‭

Answer
#1: Initial revision by user avatar peterh‭ · 2025-06-07T08:36:04Z (about 13 hours ago)
Honestly I have a solution, but honestly I could not give a medal for their work to the pip devs.

1. Pip has a `--no-clean` flag. On the docs, it preserves the temporary directories for further analyse. In the reality, it preserves only some of them, and the others will be still deleted. But that is a good first try - if you have luck, you can find what you want to.

2. Somewhere I have also read, pip actually has configuration files, whose pathes you can get with the command `pip config -v list`. It has a .ini syntax and there are multiple places where you can ask pip to not delete things.

3. And this is what I have done. I have *executed pip with hooking the deletion-related libc calls to a doing-nothing function.* On this way, pip could not delete anything, note it might cause problems in the compilation, but it is also a working method. The steps are:

3.1. Create a .c file with this, for example with the name `hook.c`:

```
int unlink(char* path) {
  return 0;
}

int unlinkat(int dirfd, char* pathname, int flags) {
  return 0;
}

int rmdir(char* path) {
  return 0;
}
```

Then compile it to shared lib with the command `gcc -shared -o hook.so hook.c`.

Now, if you execute any command by prefixing it with a `LD_PRELOAD=/path/to/hook.so pip ....`, then it won't be able to delete anything any more. But it will think, it could. All the file or directory related libc calls will return success - but actually without doing anything.