How to install Google Cloud DLP on Mac M1?

462 Views Asked by At

I am trying to download Google Cloud DLP on my Mac M1 running macOS Monterey. I am using Python 3.10.4 and pip 22.0.4.

I first tried using pip install google-cloud-dlp, but got an error when I went to import it that I have the wrong architecture (arm instead of x86-64 – hence M1 error).

I then uninstalled DLP and followed the advice of a StackOverflow post to download the library directly from GitHub. I did this, navigated to the directory, and ran sudo python3 setup.py install.

Now, when I try to import the library, I get the error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [57], in <cell line: 1>()
----> 1 import google.cloud.dlp

ModuleNotFoundError: No module named 'google.cloud.dlp'

This is odd because when I run pip list I get this in the output:

google-api-core          2.7.2
google-auth              2.6.6
google-cloud-dlp         3.6.2
googleapis-common-protos 1.56.0

Now, when I run pip install google-cloud-dlp, I get a bunch of "Requirement already satisfied" messages, yet when I try to import, I get a ModuleNotFoundError.

I have tried importing in Atom, VSCode, and Jupyter-Notebook, and still get a ModuleNotFoundError. I feel dumb asking this question because it seems like it would be an easy fix, but any help is appreciated.

1

There are 1 best solutions below

0
On

One potential issue is that you have multiple python versions installed. Is it possible that the script ran under in a different Python environment than the one used to print the installed versions?

Could you try following these steps?

  1. Create virtualenv.
python3 -m venv env
source env/bin/activate
  1. Install google-cloud-dlp.
pip install google-cloud-dlp
  1. Run code.
$ python3
>>>import google.cloud.dlp
>>>

If you're still having trouble, try the steps on another environment like Cloud Shell to rule out an issue with your specific environment.