Installing and using pipenv on Bluehost

Pipenv is by far the best thing to happen to python in 2017. It is so good, it is already the official recommendation for package management.

If you have a custom installation of python3 on Bluehost, these steps will be easy to follow.

        

# install pipenv using pip (locally for the user, recommended!)
pip install --user pipenv

# add pipenv to the PATH (usually in ~/.local/bin)
export PATH=~/.local/bin:${PATH}

        
    

There, you have pipenv installed on Bluehost. Now, using it is easy. This is a short summary of commonly performed actions.

        

# initiate a python3 project
pipenv --python 3.6.4

# install some package (for example, Flask)
pipenv install flask

# uninstall some package (for example, Flask-SQLAlchemy)
pipenv uninstall flask-sqlalchemy

# lock the Pipfile (to enable deployment somewhere else.)
pipenv lock

# start a pipenv shell to run with the python packages local to this project
pipenv shell

        
    

Now that you have a working website on your local machine, maybe you wish to deploy it on the server. Easy-peasy. Just make the Pipfile and Pipfile.lock part of your git and make it available on the web-server. Then to instantiate your project on the webserver, do the following steps.

        

# in the project directory with the Pipfile present. 
pipenv install

        
    

There, your project is ready to be served. Check out my article on (serve-flask-on-bluehost-using-mod-fcgi-with-pipenv)[serving Flask webpages using mod_fcgi on Bluehost with a pipenv configuration], if you intend to do so next.