pythonpython-3.xmacospippymssql

symbol not found in flat namespace '_bcp_batch'


I'm using pyenv to manage my python versions. When i use python 3.12.4 or python3.9^, i get this error:

 File "src/pymssql/_pymssql.pyx", line 1, in init pymssql._pymssql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pymssql/_mssql.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_bcp_batch'

my script:

from sqlalchemy import create_engine, text
import bi_pass

v_server = bi_pass.v_server
v_user = bi_pass.v_user
v_password = bi_pass.v_password
v_database = bi_pass.v_database

source_engine = create_engine(f"mssql+pymssql://{v_user}:{v_password}@{v_server}:1433/{v_database}")
source_conn = source_engine.connect()

query = text( """ SELECT * from test""")
result = source_conn.execute(query)

rows = result.fetchall()
source_conn.close()
source_engine.dispose()

I have a Mac m3 chip, how can I fix it?

Thanks


Solution

  • also another way that works:

    pip install --no-binary :all: pymssql --no-cache --force