For a project, I can't let users use pip install before running the app.
My project is a python flask app that I used pip to grab the dependencies. How do I bundle it so the apps can run without using pip install?
For a project, I can't let users use pip install before running the app.
My project is a python flask app that I used pip to grab the dependencies. How do I bundle it so the apps can run without using pip install?
I've done this before. I created a virtualenv for my project so all dependencies (including the python executable) are contained within the project sub-directory tree. Then just zip up that directory tree. To install elsewhere, just unzip and run it.
I'm pretty sure python checks it's install directory for file dependencies and inside the same directory as the python file you are running. You can copy the packages from the pip install directory and place them in the same directory as your python file. It should see them.
It's pretty easy to make a bash script. Open a text editor, save it with a .sh extension. type in your commands.
This is a linux bash script:
#!/bin/bash
#This is a comment
sudo pip install -U memory_profiler
sudo pip install pympler
This is a windows batch script. Save as a .bat file
ECHO
cd [pip install directory]
pip command
pip command
when python runs a file, it adds the current working directory to where it will look for modules to import.
you just need to install the requirements directly into your project folder.
the easiest way to do this is:
virtualenv
somewhere and do your pip install -r requirements.txt
site-packages
folder from the environment ( $VIRTUAL_ENV/lib/python2.7/site-packages
note: you might have to change accordingly for python version) to your project folder.edit: to add that I remembered that you're doing something similar to packaging an AWS Lambda.