10

I am hoping to run my app without any problem, but I got this attached error. Could someone help or point me into the right direction as to why this is happening?

Traceback (most recent call last):
  File "/Users/andre.sitorus/Documents/GitHub/nexus/automation-api/app/main.py", line 4, in <module>
    from configurations import config  # noqa # pylint: disable=unused-import
  File "/Users/andre.sitorus/Documents/GitHub/nexus/automation-api/app/configurations/config.py", line 7, in <module>
    from google.cloud import secretmanager
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/cloud/secretmanager.py", line 20, in <module>
    from google.cloud.secretmanager_v1 import SecretManagerServiceClient
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/cloud/secretmanager_v1/__init__.py", line 24, in <module>
    from google.cloud.secretmanager_v1.gapic import secret_manager_service_client
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/cloud/secretmanager_v1/gapic/secret_manager_service_client.py", line 25, in <module>
    import google.api_core.gapic_v1.client_info
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/api_core/gapic_v1/__init__.py", line 18, in <module>
    from google.api_core.gapic_v1 import config
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
    import grpc
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/__init__.py", line 22, in <module>
    from grpc import _compression
  File "/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_compression.py", line 15, in <module>
    from grpc._cython import cygrpc
ImportError: dlopen(/Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so, 2): Symbol not found: _CFRelease
  Referenced from: /Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so
  Expected in: flat namespace
 in /Users/andre.sitorus/opt/miniconda3/envs/nexus/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-darwin.so

I'm running this in Apple M1.

I already upgraded pip and setuptools before installing all the requirements in my virtual environment using conda. Here is my python, pip, and setuptools version:

python 3.9.12
pip 21.2.4
setuptools 62.4.0
enchant3dmango
  • 303
  • 3
  • 13
  • Not enough info to give specific answer. Generally, dynamic library issues are often caused by [mixing channels](https://stackoverflow.com/a/66356877/570918). We'd probably need to see a `conda env export` output to give more precise answer. – merv Jun 15 '22 at 04:35

2 Answers2

26

Had the same issue; turned out it's because of the grpcio build. Doing this helped:

pip uninstall grpcio
conda install grpcio

(Make sure you use the conda-forge channel with conda; the community puts in work to make sure packages play well with M1/arm64)

Alex
  • 439
  • 5
  • 16
Cygorger
  • 772
  • 7
  • 15
6

I was able to get around the problem by rebuilding grpcio from source like this:

pip uninstall grpcio
export GRPC_PYTHON_LDFLAGS=" -framework CoreFoundation"
pip install grpcio --no-binary :all:
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302