Using pipenv and saving python environment

Pipenv workflow

If the Pipfile exists, run

pipenv install

To run,

pipenv run <command>

To enter a shell within the environment

pipenv shell

To add a package to your new project

pipenv install <package>

or edit the Pipfile directly, here added package requests

[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"

[dev-packages]

Save python environment

pipenv install <all packages i need>
pipenv lock --requirements > requirements.txt

Install a specific version of python

pipenv --python X.Y

Specify verion of a pckage

pipenv install requests~=1.2

Install from a website

# Need to keep the correct python 3.9 version -> 39
pipenv install https://download.pytorch.org/whl/cu111/torch-1.8.0%2Bcu111-cp39-cp39-linux_x86_64.whl

# below runs but does not save it to Pipfile
pipenv run pip install torch==1.8.0+cu111 -f https://download.pytorch.org/whl/torch_stable.html

Install from git

pipenv install -e git+https://github.com/requests/requests.git@v2.20.1#egg=requests