Dan
Dan

Reputation: 67

Openssl library is not loaded at Mac M1 (Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib)

Can someone help me please? I'm trying to run at my Mac a Python automation tests using PyTest in my venv environment but having such an error:

Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib

I've tried to reinstall openssl:

brew reinstall [email protected]
..........

A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in   /opt/homebrew/etc/[email protected]/certs

and run   /opt/homebrew/opt/[email protected]/bin/c_rehash

[email protected] is keg-only, which means it was not symlinked into /opt/homebrew, because macOS provides LibreSSL.

If you need to have [email protected] first in your PATH, run:   echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:   export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"   export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"

I did what was suggested above:

echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc 
source ~/.zshrc 
export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib" 
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include" 

echo $PATH 
/Users/danylokholodov/Documents/my-project/Core_Platform/Code/my-project-qa-framework/venv/bin:/opt/homebrew/opt/[email protected]/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands

which openssl 
/opt/homebrew/opt/[email protected]/bin/openssl

But still have the same error during executing tests:

../../../venv/lib/python3.9/site-packages/pymssql/__init__.py:3: in <module>
    from ._pymssql import *
E   ImportError: dlopen(/Users/danylokholodov/Documents/my-project/Core_Platform/Code/my-project-qa-framework/venv/lib/python3.9/site-packages/pymssql/_pymssql.cpython-39-darwin.so, 2): Library not loaded: /usr/local/opt/[email protected]/lib/libssl.1.1.dylib
E     Referenced from: /Users/danylokholodov/Documents/my-project/Core_Platform/Code/my-project-qa-framework/venv/lib/python3.9/site-packages/pymssql/_pymssql.cpython-39-darwin.so
E     Reason: image not found

Upvotes: 5

Views: 2651

Answers (3)

0swin
0swin

Reputation: 51

The correct solution on my M1 was @Bhupendra singh negi 's but with the correct version concerned

brew reinstall [email protected]

echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

source ~/.zshrc

Upvotes: 2

Bhupendra singh negi
Bhupendra singh negi

Reputation: 161

This worked on my M1

brew install openssl

echo 'export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

source ~/.zshrc

Upvotes: 0

nectar
nectar

Reputation: 11

I fixed it installing Anaconda, then I created a ENV with Conda Environment and Python 3.8 (in my case was python 3.8 because 3.9 isn't working with Psycopg2). then I downloaded Pymssql from Anaconda->Environments->not installed. Then i went to the python interpreter on pycharm preferences and I selected the anaconda little logo, then + and I installed manually pymssql on the ENV.

Upvotes: 0

Related Questions