Pyenv-virtualenv: Can't see the __future__ in a pyenv virtualenv

Created on 1 Jun 2018  路  1Comment  路  Source: pyenv/pyenv-virtualenv

I'm using Google Cloud Platform's gcloud tool. It uses the python2 on my PATH.

When I set pyenv global 2.7.12, gcloud works.

When I make an old-fashioned virtualenv and activate it, gcloud works.

When I make a 2.7.12 virtualenv with pyenv-virtualenv and set pyenv local the-2.7.12-virtualenv, gcloud blows up:

[15:40:40 ~] gcloud
Traceback (most recent call last):
  File "/Users/daveschweisguth/lib/google-cloud-sdk/lib/gcloud.py", line 19, in <module>
    from __future__ import absolute_import
ImportError: No module named __future__

Is pyenv-virtualenv not setting something up correctly?

This is all on current OS X.

Most helpful comment

I was getting the same error when trying to docker pull from GCR. I was able to resolve the issue by exporting CLOUDSDK_PYTHON to the pyenv shim path and reinstalling the google cloud sdk. You can get that path via which python. The sdk can be reinstalled by executing the install.sh file again.

export CLOUDSDK_PYTHON=/Users/<user>/.pyenv/shims/python
./install.sh

>All comments

I was getting the same error when trying to docker pull from GCR. I was able to resolve the issue by exporting CLOUDSDK_PYTHON to the pyenv shim path and reinstalling the google cloud sdk. You can get that path via which python. The sdk can be reinstalled by executing the install.sh file again.

export CLOUDSDK_PYTHON=/Users/<user>/.pyenv/shims/python
./install.sh

Was this page helpful?
0 / 5 - 0 ratings