2

I am having trouble importing a library called pymssql.

I have read previous solutions regarding this issue on stack overflow. The following are the solutions that did not work:

  1. Error importing pymssql
  2. import pymssql Unicode DecodeError in windows 7

I am running a conda virtual environment with Python 3.7.9. The following is the output when I run python in the terminal.

Python 3.7.9 (default, Aug 31 2020, 07:22:35)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

So, this confirmed that I was using the correct Python version. Next, I tried to import a library called pymssql.

This looked like:

>>> import pymssql

This returned an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/__init__.py", line 3, in <module>
    from ._pymssql import *
  File "src/pymssql/_pymssql.pyx", line 1, in init pymssql._pymssql
ImportError: dlopen(/usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/_mssql.cpython-37m-darwin.so, 2): Symbol not found: _iconv
  Referenced from: /usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/_mssql.cpython-37m-darwin.so
  Expected in: flat namespace
 in /usr/local/anaconda3/envs/conda_env/lib/python3.7/site-packages/pymssql/_mssql.cpython-37m-darwin.so
>>>

I have tried conda install pymssql and pip install pymssql. Neither of these solved the issue.

0 Answers0