Theano problems in macOS Catalina

I upgraded to macOS Catalina and now I’m having a problem PyMC3 issues with theano.

Exception: Compilation failed (return status=1): In file included from /Users/benjamv/.theano/compiledir_Darwin-19.0.0-x86_64-i386-64bit-i386-3.7.5-64/lazylinker_ext/mod.cpp:1:. In file included from /Users/benjamv/opt/anaconda3/include/python3.7m/Python.h:25:. /Users/benjamv/opt/anaconda3/bin/../include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found. #include_next <stdio.h>.               ^~~~~~~~~. 1 error generated.. 

I previous had this problem under macOS Mojave but was solvable (eg Help with issues starting pymc3 (problems with theano?)).But this solution does not work with Catalina. Best I can find is this question https://stackoverflow.com/questions/58278260/cant-compile-a-c-program-on-a-mac-after-upgrading-to-catalina-10-15/58278392#58278392 Problem is I can’t follow it. It’s not entirely clear what I needs to be done to fix the problem.

Hoping someone can help me out.

I dont have a mac to test it out, did you do all the usually steps of updating also Xcode, accept licence etc?
@fonnesbeck said he’s on Catalina and does not have problem upgrading - Chris how did you do the upgrade?

Definitely make sure you update your Xcode command line tools, and toss out your ~/.theano folder for good measure. Worked with no issues on a new MBP.

I already had the Command Line Tools. But I deleted them from /Library/Developer/CommandLineTools/ and reinstalled with xcode-select --install.
I deleted ~/.theano. I made sure I am up to date with:

conda update --all
conda install -c conda-forge pymc3

Still no luck, I get the same theano related error when importing PyMC3.

To be honest I’ve had theano related errors after almost every single slight Mac OS update. It’s been a real headache.

I’ll download the full Xcode rather than just the Command Line Tools and see if that does anything.

EDIT: after restarting the terminal I can import pymc3 without error, but I get basically the same error when trying to build a model with PyMC

EDIT 2: I reinstalled Anaconda (which still fails to add Python to the path). I only randomly encountered the Xcode agreement thing by typing Python3 which I never do (I use ipython or jupyter notebooks). But even after having reinstalled, done the Xcode agreement, still no luck. (Seems that you can manually do the agreement with sudo xcodebuild -license)

EDIT 3: Installed full Xcode and opened it up to let it do its thing. Still no luck. Out of ideas at this point.

I just upgrade to Catalina - reinstall conda (using miniconda) and does not see any problem. Also I opt in to use zsh instead of the default bash and thus reset all the path in .zshrc - not sure if it helps in your situation or not.

Updating the path in .zshrc allowed me to open ipython, Jupiter lab etc. But still getting same compilation error with theano. Will do some more searching, but it’s becoming quite dispiriting. I appreciate the help though

Ok. Looks like it’s working after this https://stackoverflow.com/a/58323411/5172570

1 Like