Manim Community v0.7.0 - ValueError: Your installation does not support converting .dvi files to SVG - manim

I have the following simple code in a file called latex.py:
from manim import *
class Formula(Scene):
def construct(self):
formula_text=Tex(r"cucumber").scale(2)
self.add(formula_text)
I run it using the below command:
manim -p -ql latex.py Formula
And I get the following error:
ValueError: Your installation does not support converting .dvi files to SVG. Consider updating dvisvgm to at least version 2.4. If this does not solve the problem, please refer to our troubleshooting guide at:
https://docs.manim.community/en/stable/installation/troubleshooting.html
I have Manim Community v0.7.0 installed.
My dvisvgm version is 2.11.1.
I have followed all the directions in the link above and can confirm that dvisvgm -h and dvisvgm -l return values as expected. Moreover, if I try to use dvisvgm command on it's own (by giving it a random .dvi file) - it works fine.
I only get this problem when using Tex or MathTex mobjects (Text mobject works fine).
Any suggestion what else I could do to try to get to the bottom of it??

Looks like I just needed to reinstall LaTeX!

Related

Running lua ML model from Google Colab

I am trying to run the AdaIN-style model in Google Colab. In order to do this, I need to install Lua. I saw this question and tried the solution given (reproduced below for convenience), both with the given distro and the official torch distro.
%cd /content/
!git clone https://github.com/nagadomi/distro.git torch --recursive
import os
os.chdir('./torch/')
!bash install-deps
!./install.sh
!. ./install/bin/torch-activate
Now it should work using absolute path to th:
!/content/torch/install/bin/th neural_style.lua -style_image examples/inputs/picasso_selfport1907.jpg -content_image examples/inputs/brad_pitt.jpg
However, the last line fails, giving me the below error
/bin/bash: . ./install/bin/torch-activate: No such file or directory
However, the binary for th seems to exist at the given filepath. Thus, I try to run the given command
th test.lua -content input/content/cornell.jpg -style input/style/woman_with_hat_matisse.jpg
but I get the following error
/content/torch/install/bin/luajit: /content/torch/install/share/lua/5.1/trepl/init.lua:389: module 'cudnn' not found:No LuaRocks module found for cudnn
I tried looking this up further, but wasn't able to make much progress.
I also tried this method, which seems similar to the above, but I get the same errors.
Any pointers would be appreciated.

pydrake is not available for installation anymore through google colab?

I have been using a google colab template for iterative LQR that uses the Pydrake, however, it seems like the code repository is removed and I can't reinstall it on google Colab:
try:
import pydrake
import underactuated
except ImportError:
!curl -s https://raw.githubusercontent.com/RussTedrake/underactuated/master/scripts/setup/jupyter_setup.py > jupyter_setup.py
from jupyter_setup import setup_underactuated
setup_underactuated()
# Setup matplotlib backend (to notebook, if possible, or inline).
from underactuated.jupyter import setup_matplotlib_backend
plt_is_interactive = setup_matplotlib_backend()
File "/content/jupyter_setup.py", line 1
404: Not Found
^
SyntaxError: invalid syntax
I tried clicking this link https://raw.githubusercontent.com/RussTedrake/underactuated/master/scripts/setup/jupyter_setup.py, and the page is not found... everything was working fine yesterday
Sorry. You're correct... I updated it this morning, and don't have a good deprecation policy in place on that repo, and this setup script is two versions ago. The path you want is https://raw.githubusercontent.com/RussTedrake/underactuated/master/setup/jupyter_setup.py
(remove the script from the directory). But if you look at that file, you'll see that even that is pointing to an updated setup script which you might want to point to.
This is actually all good news... we are on the path to a much better solution. You can now just pip install drake on colab (see the drake installation guide). Once I land the pip install underactuated (probably in time for my Spring offering of the class), then all of that nasty setup will be gone.

Problems with updating pfgplots inside docker with tds file structure

I have a docker image with texlive installed (via apt not tlmgr). I have a pgfplot in my project which needs a newer pgfplot version. I'm searching for ways to update my pgplots because I can't update it with tlmgr because of base install via apt.
Initial error message if I try to compile with texlive 2014:
! Package pgfkeys Error: Choice '1.16' unknown in choice key '/pgfplots/compat/
anchors'. I am going to ignore this key.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.7 \pgfplotsset{compat=1.16}
?
! Emergency stop.
...
l.7 \pgfplotsset{compat=1.16}
I downloaded the pgfplots.tds and did the following steps like the manual said:
docker cp pgfplots.tds docker_container_name:/root/texmf/pgfplots
export TEXINPUTS=/root/texmf/pgfplots/tex//:
export TEXDOCS=/root/texmf/pgfplots/doc//:
export LUAINPUTS=/root/texmf/pgfplots//:
texhash
Of course the export and texhash were done inside the container and not on the host system.
After this, the error message is gone, but I have a new issue:
package pgfplots notification 'compat/show suggested version=true': you might b
enefit from \pgfplotsset{compat=1.18} (current compat level: 1.16).
! Illegal parameter number in definition of \pgfmaththisrow#.
<to be read again>
I searched online and got the response that this is because of a broken pgfplots installation. In many articles the fix was just to install the texlive new. But I can't do that.
The issue should also not be in the tex code itself. If I install texlive on my host system, which is the most recent Ubuntu distro, the tex compiles just fine.
Can somebody help me in fixing this or lead me to a better way of upgrading pgfplots?
Resolution:
The pgfplots package 1.18.1 and also 1.16 were to recent. It had conflicts with the pgf package. I tried to go further back and landed on \pgfplotsset{1.14} and version 1.14 of pgfplots.tds.
This works fine now. I was probably pretty lucky that my plot looks and functions the same with this version as in 1.18.
This approach probably won't work for you if your more bound to version 1.18.

cv2.error: OpenCV(4.3.0) ../opencv_contrib/modules/dnn_superres/src/dnn_superres.cpp:97: error: (-2:Unspecified error) Model not specified

Im trying out this article;
https://towardsdatascience.com/deep-learning-based-super-resolution-with-opencv-4fd736678066
this is the code copied out of the article;
import cv2
from cv2 import dnn_superres
sr = dnn_superres.DnnSuperResImpl_create()
image = cv2.imread('./input.png')
path = "EDSR_x3.pb"
sr.readModel(path)
sr.setModel("edsr", 3)
result = sr.upsample(image)
cv2.imwrite("./upscaled.png", result)
i also tried opencv Super Resolution Tutorial;
https://docs.opencv.org/master/d5/d29/tutorial_dnn_superres_upscale_image_single.html
import cv2
from cv2 import dnn_superres
sr = dnn_superres.DnnSuperResImpl_create()
image = cv2.imread('./image.png')
path = "EDSR_x4.pb"
sr.readModel(path)
sr.setModel("edsr", 4)
result = sr.upsample(image)
cv2.imwrite("./upscaled.png", result)
My enviroment is anaconda3 opencv 4.3.0.
I either get the error from the title or i get "killed" when i run the opencv example.
*My file directory is all on the same level of the sample codes. I would just change my image file names.
I did try to compile opencv and opencv_contrib from cmake but, i didn't know how to have python refer to opencv and opencv_contrib from source.
ifollow this documentation to install opencv from source;
https://d*ocs.opencv.org/3.4/d2/de6/tutorial_py_setup_in_ubuntu.html
I opted to use anaconda wrapping of opencv 4.3.0 because i ran into too many dependency and wrongly installed package problems.
My friend from a meetup managed to apply the code from the article just as the article depicted while i tried to follow exactly what he did, using an anaconda enviorment. Would my problem stem from my virtual enviorment or opencv package version or the code itself? i did have another colleague run my code from my github branch and he had my exact same problems. How should i apprach the bugs im having and apply the super resolution examples i found?
The error 'Model not specified' comes from the fact that the Net is empty. You have to actually download the model and then provide the path to the 'sr.readModel()' function.
If you did that and it still does not work, you could try these two things:
Try a smaller image (in .png format).
Build OpenCV from source. Do not forget the contrib modules (this is where the dnn_superres module resides). You said you had a problem linking python. I would suggest to use this tutorial. After following that tutorial, do the following command (after you already did sudo make install), to link the python libraries:
sudo ldconfig

Doxygen - latex issue

I need some hel regarding doxygen. I have a c++ code and i want to generate the pdf documentation using doxygen. The problem is that doxygen runs, produces the html output as expected, but the refman.tex file isnt generated (it generates the "d" folders and the doxygen.sty file). I have activated the "GENERATE_LATEX" option on the configuration file and there is no visible error on the console...
Im running doxygen 1.8.1.2 on ubuntu 12.10 x64 and i have texlive 2012/Debian (latest available).
Any help will be very much appreciated.

Resources