2

I setup Python 3.6 using pyenv so I could manage multiple Python versions (e.g. 3.7 and 3.8) in the future. I didn't use Homebrew to install Python since it changes the system version. It's my first time to use zsh shell since it's the default shell in Catalina OS. Currently, I use 3.6.8 version for my existing project.

So here's my current setup:

% pyenv versions

result:

  system
* 3.6.8 (set by /Users/macbook/.python-version)
  3.7.3

% python -V results to Python 3.6.8

% which python results to /Users/macbook/.pyenv/shims/python

% echo $PATH results to /Users/macbook/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

The content of my ~/.zshrc is PATH=$(pyenv root)/shims:$PATH

I created a virtual env using % python -m venv venv, installed all the necessary packages, and when I activate it and get the python path,

(venv) % python -V
Python 3.6.8

(venv) % which python
/Users/macbook/python-project/venv/bin/python

(venv) % echo $PATH
/Users/macbook/python-project/venv/bin:/Users/macbook/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Finally, when I try to run the app, I always get zsh: abort error:

(venv) % python app.py
zsh: abort      python app.py

(venv) % export FLASK_APP=app.py
(venv) % flask run
zsh: abort      flask run

I don't know what else is still missing or are there anything wrong with my python path?

Thanks!

Zhanrah
  • 239
  • 1
  • 3
  • 14
  • Is it possible for you to use anaconda? – Jerry Jul 24 '20 at 19:40
  • @NavanK. I haven't used it yet but I might as well try it in my next projects. Can you recommend the best site that gives a good strategy to set it up alongside my other package management? – Zhanrah Jul 24 '20 at 19:51
  • 1
    https://problemsolvingwithpython.com/01-Orientation/01.03-Installing-Anaconda-on-Windows/ is the one I would prefer. However , you might want to look into Youtube videos as per your requirements. Anaconda will also help you set up multiple environments for your needs. – Jerry Jul 24 '20 at 19:55
  • Anaconda has nothing to do with your problem. (Also conda is the environment manager, not anaconda, which is a distribution of Python that comes with conda and certain Python packages). Why do you think this is a path issue? Don't your steps clearly show your path is fine? Have you tried using bash instead to launch your program? I would assume `zsh: abort` means the program threw a `SIGABRT` signal. – alkasm Jul 25 '20 at 07:49
  • On macOs to get more insights why the Python process crashed you can open the Console app and look at the crash reports – lhaferkamp Feb 26 '21 at 12:01

2 Answers2

3

After searching through the web, I think this is a common issue with the latest MacOS or Homebrew. This thread fixed the issue.

  1. brew update && brew upgrade && brew install openssl

  2. copy the two files from /usr/local/Cellar/openssl@1.1/1.1.1g to /usr/local/lib/

    cd /usr/local/Cellar/openssl@1.1/1.1.1g/

    sudo cp libssl.1.1.1.dylib libcrypto.1.1.1.dylib /usr/local/lib/

  3. add symlink to missing openssl libs

    cd /usr/local/lib

    sudo ln -s libssl.1.1.1.dylib libssl.dylib

    sudo ln -s libcrypto.1.1.1.dylib libcrypto.dylib

Zhanrah
  • 239
  • 1
  • 3
  • 14
1

For me, the below worked:

Python 3.6.9 MacOs Catalina 10.15.7

cd /usr/local/Cellar/openssl@1.1/1.1.1h/
cp lib/libssl.1.1.dylib lib/libcrypto.1.1.dylib /usr/local/lib
cd /usr/local/lib
sudo ln -s libssl.1.1.dylib libssl.dylib
sudo ln -s libcrypto.1.1.dylib libcrypto.dylib

Thanks to the answer by Zhanrah