Random Man
Random Man

Reputation: 46

Include a PIP module in my project so that user doesn't have to download it

Edit: I am self taught, I don't know the right terms.

This question is probably a duplicate but I am not able to find it. I need to include a python pip package in my application say numpy. I don't want the user to pip install -r requirements.txt I want to include the module when the user downloads the application.

Upvotes: 0

Views: 342

Answers (3)

Kieran Wood
Kieran Wood

Reputation: 1447

Vendoring

The only way I can think of besides pip to do this with pure source code would be to vendor the code you need. This means downloading the source code of the package (like numpy) and including it in your project.

This comes with many potential issues including:

  • licensing issues
  • issues with installation if there are cpython files that need to be compiled
  • Having to manually update the files when new releases come out
  • increased download size for your source code
  • etc.

I would not recommend doing this unless there is a hard technical requirement for it, because it's a real hassle to deal with. If there is something in particular besides having to run the extra command as to a reason why you want to avoid pip it might help to better address this question.

Binary distribution

Also depending on the app you could look into something like pyinstaller to make a single .exe or binary file out of your app so they don't even need python or your dependencies, but be warned this has it's own set of complexities to look out for like having to build for every target platform (Windows, Mac and Linux).

Upvotes: 1

alexakarpov
alexakarpov

Reputation: 1920

It's a whole world to explore, honestly ) you need to explore the subjects of deployment and distribution; those will depend on target operating systems... I would suggest investigating Docker, which allows you to package the OS (some Unix), runtime and dependencies into one "thing".

Upvotes: 1

Twfyq Bhyry
Twfyq Bhyry

Reputation: 170

you don't have to include pip when you build the app, because when you build the app, all depencies will be included in the app resources, i am not sure which app you are building, but in general, all depencies will be converted to pyc packages when building the app and compiled

Upvotes: 1

Related Questions