0

I manually removed /Library/Python/2.7/site-packages/google through terminal (rm), however it still seems I can import the package in python 2.7.

I am able to run import google but when I print google.__path__ it displays ['/Library/Python/2.7/site-packages/google'] even though that directory no longer exists because I deleted it.

I initially deleted this package because it was giving me import errors when trying to run google's app engine api, so I need to have import google be unlinked to this directory.

Any help would be greatly appreciated!

  • Did you try uninstalling the package? I guess the path exists in your sys.path(). Import errors can be generally avoided by using [virtualenv](https://cloud.google.com/appengine/docs/flexible/python/quickstart#download_the_hello_world_app). – Jomy Jun 17 '16 at 12:39
  • I think in the past I installed it using a script instead of with pip so I don't really know how to go about uninstalling it. Is there a way to manually remove it from sys.path? – Peter H. Jun 18 '16 at 03:02
  • [this](http://stackoverflow.com/questions/13793921/removing-path-from-python-search-module-path) and [this](http://askubuntu.com/questions/87111/if-i-build-a-package-from-source-how-can-i-uninstall-or-remove-completely) might help you. Btw, does it show any import error when using [virtualenv](https://cloud.google.com/appengine/docs/flexible/python/quickstart#download_the_hello_world_app)? – Jomy Jun 18 '16 at 06:12
  • Using virtalenv gives me no errors. Thanks! But I still can't seem to remove the package from my path otherwise. My sys.path includes `/Library/Python/2.7/site-packages/` which is why I'm confused as to why `/Library/Python/2.7/site-packages/google` still seems to be linked – Peter H. Jun 20 '16 at 06:10
  • `google` comes under `site-packages/`, so it could be linked. Are you able to `cd` into that path from your terminal? Also what is the output by starting python in verbose mode? – Jomy Jun 20 '16 at 09:56
  • how was the package originally installed? – Jaxian Jun 20 '16 at 10:04
  • @Peter, I guess you are using Linux, which distro? – Jomy Jun 20 '16 at 10:39

1 Answers1

0

Try starting python in verbose mode. This will show from where packages are imported. Since the output can overflow, write it to a text file.

python -v 2>&1 | tee out.txt 
>>import google
>>exit()

Open out.txt and see from where google package is being imported. As suggested earlier, import issues can be avoided by using virtualenv.

Jomy
  • 368
  • 4
  • 11