Library not loaded: #rpath/libtbb.dylib in Prophet / Python - facebook-prophet

I'm on a Mac X1, Monterey.
I've installed prophet and run into this issue when trying to fit a model.
RuntimeError: Error during optimization: console log output:
dyld[90668]: Library not loaded: #rpath/libtbb.dylib
Referenced from: /Users/{username}/opt/anaconda3/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin
Reason: tried: '/private/var/folders/cd/dfrqgp4s4ll55cwb7rtgccbw0000gq/T/pip-install-rjpuj450/prophet_d7e4cce10e414c89a572fe3605ae9269/build/lib.macosx-11.1-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/private/var/folders/cd/dfrqgp4s4ll55cwb7rtgccbw0000gq/T/pip-install-rjpuj450/prophet_d7e4cce10e414c89a572fe3605ae9269/build/lib.macosx-11.1-arm64-cpython-39/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib' (no such file), '/usr/local/lib/libtbb.dylib' (no such file), '/usr/lib/libtbb.dylib' (no such file)
I know this has to do with the wrong paths being searched. I can find the dylib in
/Users/{user}/opt/anaconda3/lib/python3.9/site-packages/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/
But, it seems prophet doesn't know to look there. I'm curious how I can update/fix either the rpath variable or find another solution?
I tried to create a symbolic link with sudo ln -s, but don't have permissions on the laptop.
TIA!

I got it to work on Apple Silicon (M1 Max in my case) by installing older versions of both pystan and prophet:
pip install pystan==2.19.1.1
pip install prophet==1.0
The other important piece of the puzzle is that you should use Python 3.8 to get it working.
Installing older versions of the libraries and using Python 3.8 are both talked about in issue #2002 on Github, but there's not really an explanation of the libtbb.dylib error message.

Related

pdflatex is not installed in google colab

I'm trying to use lcapy's python library to draw some electrical circuits in google colab. Unfortunately, I'm always getting an error:
RuntimeError: pdflatex is not installed
Even though I did pip install pdflatex
I couldn't find anything related to this error in lcapy's docs.
the notebook can be found here
I experienced a similar issue/error trying to render PDFs from latex output generated by pandas in google colab recently. The error I got was complaining about a file (Error Code 2), listed 'pdflatex' as the missing file, but I confirmed the install had completed as you reported. This led me to realize there were missing LaTex dependencies that were generating the error; the traceback seemed a bit misleading to me. Here is the solution that worked for me:
First, install components and dependencies in colab notebook:
!pip install folium==0.2.1
!pip install pdflatex
!sudo apt-get install texlive-latex-recommended
!sudo apt install texlive-latex-extra
!sudo apt install dvipng
In my first attempt, There was an error buried in the install of pdflatex with an incompatible version of folium 0.8.x, so the first command rolls it back to the compatible version from the error trace. Probably not totally necessary to roll back folium, but I haven't tested.
The latex install commands were shamelessly lifted from this answer for latex-equations-do-not-render-in-google-colaboratory-when-using-matplotlib, where they offer a bit more explanation. The whole install process produced quite a bit of output and took some time.
After completed, I was able to generate a pdf file from my LaTex string similar to the example from the package docs:
import pdflatex as ptex
pdfl = ptex.PDFLaTeX.from_texfile(r'/content/my_tex_string_file.tex')
pdf, log, completed_process = pdfl.create_pdf()
with open('testPDF.pdf', 'wb') as pdfout:
pdfout.write(pdf)
my_tex_string_file.tex was generated from pandas in my test case, and I added a preamble manually (string concatenation) to include the correct latex packages for my desired output, but a quick look through the github page for lcapy shows the same approach may work for lcapy as well.
I ran into the same issue myself and after verifying pdflatex is installed with !pdflatex -help, I looked into Lcapy's code. The easiest workaround I found is to comment out line 73 of system.py. I only need schematic tools, so this solution is adequate for me. If you need a proper solution, all the relevant functions are in the same file and it seems that import pdflatex is unnecessary as the library searches for the binary.

How to fix Illegal instruction (core dumped)

Hi i am trying to fix this issue when i run python3 brain.py below i get this error
Illegal instruction (core dumped)
from imageai.Prediction import ImagePrediction
import os
execution_path=os.getcwd()
prediction = ImagePrediction()
prediction.setModelTypeAsSqueezeNet()
prediction.setModelPath(os.path.join(execution_path, "squeezenet_weights_tf_dim_ordering_tf_kernels.h5"))
prediction.loadModel()
predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "giraffe.jpg"), result_count=5 )
for eachPrediction, eachProbability in zip(predictions, probabilities):
print(eachPrediction , " : " , eachProbability)
I have tried to downgrade Tensorflow to 1.5.0 but then after i run that i get these errors
[ons mar 25 23:11:45] Jonathan#Whats next?:~/ReallySmartBrain$ pip3 install tensorflow==1.5.0
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement tensorflow==1.5.0 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.2.0rc0, 2.2.0rc1)
ERROR: No matching distribution found for tensorflow==1.5.0
The other solution is to compile it from source code but i'don't have any idea to compile it from source code.
Can i fix this anyway?
I had the same problem. It seems that this problem is for older CPUs. As you said, one solution is with a downgrade to tensorflow 1.5.0.
The other solution (that one that worked for me) is to build tensorflow from source.
I compiled the version 2.1.0, it took me around 25 hours with a Intel(R) Pentium(R) Dual CPU T2370 # 1.73GHz and 2GB RAM.
You would need to install the proper version of Bazel. Find below the complete instructions from tensorflow:
https://www.tensorflow.org/install/source
I needed to add a swap file of 4GB. Otherwise you will go out of memory during the compilation.
Anyway, I have uploaded my .whl file in case you don't want to expend 25 hours (or more) to compile your own file:
https://drive.google.com/open?id=1ISgMcDiCw5W5MFvS5Zbme6pNBbA7xWMH
I've got a similar problem with an old CPU on a vintage Mac OS now running Linux because no recent Mac OS can run on it. I've tried to compile from sources and got a bunch of problems (Bazel, compiler, flags, dependencies, ...). Finally, I've lost few hours to learn that could be a real nightmare. Good advice, don't even try it!

repose.who-friendlyform dependency in TurboGears 2

I am trying to install TurboGear 2. I was following the steps given in this documentation. Link: http://toscawidgets.org/documentation/tw2.core/turbogears.html
On executing this command
pip install -e .
i got this error
No distributions at all found for repose.who-friendlyform>=1.0.4 (from example==0.1dev)
Then with this command
python setup.py develop
i got this error
Searching for repose.who-friendlyform>=1.0.4
Reading https://pypi.python.org/simple/repose.who-friendlyform/
Couldn't find index page for 'repose.who-friendlyform' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for repose.who-friendlyform>=1.0.4
error: Could not find suitable distribution for Requirement.parse('repose.who-friendlyform>=1.0.4')
I tried to install it with easy_install but it didn't work. How can i overcome this error?
The documentation you are pointing to is quite outdated, which TurboGears version are you trying to use? Latest TG versions don't depend on repoze.who-friendlyform anymore. Try to delete your virtualenv, recreate it and then install TurboGears with pip install tg.devtools.
You can find latest TG version documentation on http://turbogears.readthedocs.org/en/latest/#installing-turbogears with a tutorial on using ToscaWidgets at http://turbogears.readthedocs.org/en/latest/cookbook/TwForms.html
Also latest ToscaWidgets documentation has been moved at http://tw2core.readthedocs.org/en/latest/
If you want to experiment with TG2 and Forms there are also a bunch of runnables you can play with: http://runnable.com/TurboGears

Library not loaded - ogr2ogr - topojson (Mike Bostock's d3.js map tutorial)

I'm trying to use ogr2ogr to filter a shapefile. I'm working through Mike Bostock's Let's Make a Map tutorial. A bit of googling - including here - hasn't led to any solutions yet. I'm also VERY new to topojson (and shapefiles in general; my background is in economics/statistical software like Stata), so I'm not sure what I'm doing and where things are going wrong. Either way - here's the error result I'm getting:
dyld: Library not loaded: /usr/local/lib/liblwgeom-2.1.1.dylib
Referenced from: /usr/local/Cellar/libspatialite/4.1.1/lib/libspatialite.5.dylib
Reason: image not found
Trace/BPT trap: 5
No idea what liblwgeom-2.1.1.dylib is, what it does, where I get it, etc. Google hasn't helped much on defining it either.
FWIW, I'm on a Mac, I brew installed npm and gdal, and then npm installed topojson.
Thanks,
a
Edited to add: I just brew reinstalled gdal, because I remembered getting a warning (Caveats). See below:
==> Caveats
For non-homebrew python (2.x), you need to amend your PYTHONPATH like so:
export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
This version of GDAL was built with Python support. In addition to providing
modules that makes GDAL functions available to Python scripts, the Python
binding provides additional command line tools.
I actually tried to run export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH literally as-is, and it returned nothing. (Not sure if something happened in the background?) Basically fumbling in the dark!

Not getting TBB to compile test examples

I am not getting TBB to work. I am following the steps in the "Getting started" document.
I am doing the following steps:
downloading the linux files + the sources files.
extracting them in 1 directory
calling make
going to tbb.../bin calling source tbbvars.sh intel64
going to examples/Getting_started/sub_string_finder
calling make
I then get the error:
sub_string_finder.cpp:32:30: fatal error: tbb/parallel_for.h: No such file or directory
I really googled a lot but can't find any related stuff.
I did also try to add some -I statement but it didnt help
I assume it is kind of a including/linking problem but I dont know how to fix.
This is all done on fedora 16 64bit. (kernel 3.1.4) // TBB version 4.0
The solution was to install tbb-devel package.