Catalina and Python Package Problems

I'm attempting to get a working version of python3 installed on a mac running Catalina (10.15.7).

Calling python3 from the terminal ultimately errors with a software not available message. I've seen this problem already noted on this forum.

Installing Homebrew installs CLT as well, and a python3 version in /usr/local/bin (version 3.9). I can then install numpy with pip3, but I cannot install scipy, which kicks up about 800 lines of error starting with openblas issues.

Has anyone successfully installed scipy with Catalina? If so, how?
Answered by zazizoma in 644046022
I now have a working version of python3. Here's the steps in case anyone else has problems.
  1. Install Xcode (make sure to open and accept license)

  2. Install CLT from https://developer.apple.com/download/more/?=command%20line%20tools (otherwise software not found error with $ xcode-select --install)

  3. Install Homebrew

  4. brew install python (adds 3.9)

  5. add '/usr/local/opt/python@3.9/libexec/bin' to $PATH

  6. fix openblas with:

$ export LDFLAGS="-L/usr/local/opt/openblas/lib" 
and
$ export CPPFLAGS="-I/usr/local/opt/openblas/include"
7. use pip3 to install packages

I'm still interested in a non-Homebrew solution if such a thing is available. Never found one . . .
You really have to separate the concepts of running open source software on the Mac vs. running Homebrew. They are not the same!

Virtually every Linux/Unix-based open source project will build and run on the Mac. You may need to install some dependencies. Some of those projects, and their dependencies, may be difficult to build and/or install.

Homebrew is 100% different from that. If you have something that doesn't work in Homebrew, take it up with Homebrew.
Thank you, Etresoft, for your response. So you have successfully installed the scipy package for Python3 on Catalina? How did you do it?

This isn't a Homebrew problem, but a Catalina problem. I was using Homebrew as the solution to install python3.

If I install CLT from https://developer.apple.com/download/more/?=command%20line%20tools and then run

$pip3 install scipy

I get an error saying "ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.8'"

The same for numpy.

I'm using an admin account.

If I can't install common python packages, I can't get a useable implementation of python3 on Catalina. This was not a problem for previous OS versions. Does anyone else have this problem?
If you are using Homebrew, it is most definitely a Homebrew problem. You don't believe me? Install it without Homebrew.
Thanks again, Etresoft, for your reply.

Without Homebrew:

If I install CLT from https://developer.apple.com/download/more/?=command%20line%20tools and then run 

$pip3 install scipy

I get an error saying "ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/3.8'"

The same for numpy.

I'm using an admin account.

If I can't install common python packages, I can't get a useable implementation of python3 on Catalina. This was not a problem for previous OS versions. Does anyone else have this problem?
Accepted Answer
I now have a working version of python3. Here's the steps in case anyone else has problems.
  1. Install Xcode (make sure to open and accept license)

  2. Install CLT from https://developer.apple.com/download/more/?=command%20line%20tools (otherwise software not found error with $ xcode-select --install)

  3. Install Homebrew

  4. brew install python (adds 3.9)

  5. add '/usr/local/opt/python@3.9/libexec/bin' to $PATH

  6. fix openblas with:

$ export LDFLAGS="-L/usr/local/opt/openblas/lib" 
and
$ export CPPFLAGS="-I/usr/local/opt/openblas/include"
7. use pip3 to install packages

I'm still interested in a non-Homebrew solution if such a thing is available. Never found one . . .

I'm still interested in a non-Homebrew solution if such a thing is available. Never found one

There is nothing special about Homebrew. It is just a bunch of people who, for some reason, hack up Linux build scripts for free to work on a Mac so you don't have to. It looks like you found a bug in their scripts. You should probably contact them about it and submit a fix. I'm not sure if they will accept your fix or not. Python can get really complicated.

As others have said, Catalina and above lock down the system folders. That's probably the root cause of your errors. There's a way around it but best to leave them alone.

Rather than using homebrew, try compiling from source to a non-system folder, i.e., /usr/local, or even somewhere in your user $HOME folder. You can use xCode, or compile GNU make if you'd rather not use a GUI. Most 'nix apps compile just fine on a Mac.

So far as homebrew goes, it's OK, but learning to compile your own apps will give the best reward and you'll have a better understanding of what's actually entailed in creating an app. You're also able to update to the latest versions (OpenSSL, PHP, Apache, etc.) as they come out.

FWIW, I'm running 3.10.0 on 10.15.7 using venv's. There are some issues with the latest curties (bpython wants 0.3.5 but I've yet to get it to install so am still on 0.3.4), but that's the fun of rolling your own.

BTW, if you use terminal at all, get iTerm. Like bpython, it's awesome.

Catalina and Python Package Problems
 
 
Q