1

I am trying to add BigQuery to a Django-AppEngine project and I am finding a lot of problems in doing that since the google library for BigQuery use a package named google and this folder is already in use for AppEngine purposes. What I find now is that, if I install BigQuery, it will overwrite this package and then nothing works!

The content of the two google packages

Is there maybe someone who faced this problem before and has any idea how to solve this?

It is some way to combine existing folders using pip or something else?

Thanks!!

Possible Solution:

For those who are facing the same problem, I was able to find a solution which was not too bad. Just creating an appengine_config.py file and adding them there:

from google.appengine.ext import vendor vendor.add('sitepackages/prod')

...but still looking for a better solution.

*note: all my third party libraries are placed there instead of in a lib folder like Google says.

Tysoncete
  • 199
  • 3
  • 6
  • Potentially relevant: http://stackoverflow.com/questions/41399303/using-two-python-libraries-with-conflicting-names – Dan Cornilescu Jan 04 '17 at 18:09
  • We have the bq library installed under /lib, as per Google's vendoring instructions and it's working ok, but I seem to recall encountering this problem when we first installed it. Can you add the traceback that you are seeing to the question so we can see which packages are having problems? Are your vendored packages [installed as Google recommend](https://cloud.google.com/appengine/docs/python/tools/using-libraries-python-27#installing_a_third-party_library)? – snakecharmerb Jan 04 '17 at 19:13
  • We do not follow completely Google's vendoring instructions since they limit us for a few things. I could eventually solve the problem by adding `from pkgutil import extend_path __path__ = extend_path(__path__, __name__)` into the `__init__.py` files of every conflicting module. In my case in google.cloud and google.appengine, both in $projectfolder/sitepackages/prod. However, I would like to learn from another solution since this is pretty messy to work with. – Tysoncete Jan 05 '17 at 11:11
  • @TysonRodez Glad you got it working. Maybe add your solution as an answer to this question and accept it so that others can see it. It's also worth noting Google's [instructions for setting up a test environment](https://cloud.google.com/appengine/docs/python/tools/localunittesting#Python_Setting_up_a_testing_framework), which cover path manipulation for offline code execution. – snakecharmerb Jan 06 '17 at 06:12
  • Thanks mate, already done. ;) – Tysoncete Jan 06 '17 at 09:51
  • That page is very useful as well – Tysoncete Jan 06 '17 at 09:51

1 Answers1

0

I could solved the problem I was facing by adding an extra appengine_config.py file containing this two lines:

from google.appengine.ext import vendor vendor.add('sitepackages/prod')

This file is going to be automatically called by google appengine adding the libs on sitepackages/prod(in this case) to the libs on our virtualenv.

Thanks to @snakecharmerb for showing me the way to do this.

Tysoncete
  • 199
  • 3
  • 6