Reputation: 7148
To install dependences, the appengine-python-flask-skeleton docs advise running this command:
pip install -r requirements.txt -t lib
That works simply enough.
Now say I want to add the Requests package.
Ideally I just add it to the requirements.txt
file:
# This requirements file lists all third-party dependencies for this project.
#
# Run 'pip install -r requirements.txt -t lib/' to install these dependencies
# in `lib/` subdirectory.
#
# Note: The `lib` directory is added to `sys.path` by `appengine_config.py`.
Flask==0.10
requests
And then re-run the command:
pip install -r requirements.txt -t lib
However, as this Github issue for pip notes, pip is not idempotent with the -T
option recommended by Google here. The existing flask packages will be re-added and this will lead to the following error when running the devapp
ImportError: cannot import name exceptions
How can I best work around this problem?
Upvotes: 0
Views: 210
Reputation: 3893
Like said, updating pip solves the issue for many, but for what it's worth I think you can get around all of this if the use of virtualenv is an option. Symlink /path/to/virtualenv's/sitepackages/
to lib/
and just always keep an up to date requirements.txt
file. There are no duplication of packages this way and one won't have to manually install dependencies. See also https://stackoverflow.com/a/30447848/2295256
Upvotes: 1
Reputation: 7148
Upgrading to the latest version of pip solved my problem (that issue had been closed):
pip install -U pip
Otherwise, as noted in that thread, you can always just wipe out your lib
directory and reinstall from scratch. One note of warning: if you manually added additional packages to the lib
directory not tracked in requirements.txt
, they would be lost and have to be re-installed manually.
Upvotes: 0