GCloud compute tunnel always shows warning telling to install numpy

Viewed 720

I am setting up a tunnel with gcloud from a remote machine with:

gcloud compute start-iap-tunnel ...

Everything used to be fine until a few days ago when it started to show the following message:

To increase the performance of the tunnel, consider installing NumPy. To install
NumPy, see: https://numpy.org/install/.
After installing NumPy, run the following command to allow gcloud to access
external packages:
  export CLOUDSDK_PYTHON_SITEPACKAGES=1

I did exactly what it says, I have installed numpy with pip install numpy and exported the variable, but the warning doesn't go away.

Have you experienced this?

1 Answers

As mentioned by @john-hanley, it may be due to Python installed in Library directory, as in case of universal installed for macOS, and gcloud installed in user's home directory as advised by GCP documentation. This can be fixed by re-installing either gcloud or python3. You can find installation locations by running in terminal:

which gcloud
which python3

In my case it was easier to reinstall gcloud to Library. The only drawback though is that I need to run component install with sudo as:

sudo /Library/google-cloud-sdk/bin/gcloud components install ...

Another cause might be that you are using ZSH shell and not Bash. GCP documentation provides the command to be added into .bashrc file with remark that unless added it will have effect only in the current terminal instance.

In my case after reinstalling gcloud to the Library and running the above command, I stopped receiving the NumPy warning in that specific tab but it was present in other tabs. I ran the following command to add the line to Zsh:

echo "export CLOUDSDK_PYTHON_SITEPACKAGES=1" >> ~/.zshrc

And the warning has disappeared. I hope that the above will help others.

Related