h

    hallowed-australia-10473

    4 months ago
    I’m trying to use Python to instantiate some resources on DigitalOcean. The problem is that I’m using an M1 Mac. When I try to import pulumi, I get an error:
    ImportError: dlopen(/blah/venv/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so, 0x0002): tried: '/blah/venv/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
    How do I get past this?
    I saw a thread from about a week ago that said they fixed it by running Python 3.9, alas, that’s not fixing it for me. Trying other things from that thread as well, hoping something works right.
    b

    breezy-painter-29573

    4 months ago
    Sound like you’ve installed amd64(x86_64) instead of arm64 version of Python 3.9 on your M1 laptop
    file $(which python3.9)
    h

    hallowed-australia-10473

    4 months ago
    /blah/venv/bin/python3.9: Mach-O 64-bit executable arm64
    I think I got python3 from brew, there’s probably an arch switch I should have used to get the native one
    b

    breezy-painter-29573

    4 months ago
    https://github.com/grpc/grpc/issues/28387#issuecomment-1016166913 Then I think you need to pass
    --no-binary
    when you are installing grpcio
    h

    hallowed-australia-10473

    4 months ago
    I did try that and it didn’t help 😞
    I’m now trying to figure out how to make sure all my brew packages are native
    b

    breezy-painter-29573

    4 months ago
    did you use pip or pip3?
    I do believe on macos pip resolves to the 2.7 Python
    h

    hallowed-australia-10473

    4 months ago
    I think I used pip. Let me make a new venv, run pip3 install --upgrade pip to make sure it’s up to date, then try pip3 install -r requirements.txt (which includes pulumi-digitalocean)
    b

    breezy-painter-29573

    4 months ago
    I mean, pip could be pointing to the system python or wrong venv
    Check it please
    h

    hallowed-australia-10473

    4 months ago
    It’s the right venv
    And now I can import pulumi
    I think the trick was
    arch -arm64 brew install python3
    That caused the pulumi installation to build the right grpc
    And success, I can create a DNS entry. Next step is to tinker with templating to make a cloud-init user data file. Thanks!
    m

    mysterious-mouse-98391

    4 months ago
    Weirdly I just installed python and pulumi via brew and it worked fine on my M1, though I have since found other errors related to Kubernetes and yaml