How to pass on path of ZLIB to ImageMagick? - imagemagick

Executing, both:
a)$/home/julia/displayImage.jl
b) julia> /home/julia/displayImage.jl
throw error:
...could not load library ...deps/usr/lib/libMagickWand-6.Q16.so" lib64/libz.so.1: version ZLIB_1.2.9,
where displayImage.jl, is:
#! /opt/julia-1.1.0/bin/julia
using Images, TestImages, FileIO, Colors, ImageView;
function displayImage(path::String)
img = nothing;
if isfile(path)
img = load(path);
imshow(img);
else
info("ERROR: While loading image!");
end
end
the same code works when each command is copied, pasted and executed at julia prompt during the ImageMagick's build session but not after exit from the session!
It is observed that: a)julia is not using the ZLIB installed in its deps folder after build session of ImageMagick. b)the os and julia packages CodecZlib, Conda, ZipFile, ImageMagick... have different versions of ZLIB.
Please advise me on a) how to pass on ZLIB path which is inside the folder of package, ImageMagick while executing at shell prompt and b) also using single updated version!

Executing the followong line at shell prompt resolves the issue for the session.
$export LD_LIBRARY=/opt/julia/julia-1.1.0/share/julia/stdlib/v1.1/ImageMagick/deps/usr/lib:/usr/lib64:$LD_LIBRARY_PATH
where the first path is of ZLIB inside ImageMagick package.

Related

textclips in moviepy on google colab (imagemagick error)

I'm trying to add text to a moviepy video, but I'm having trouble getting imagemagick to work on google colab.
The code:
!apt install imagemagick
from moviepy.editor import TextClip
txtClip = TextClip('Cool effect',color='white',
font="Amiri-Bold", kerning = 5, fontsize=100)
The error:
OSError: MoviePy Error: creation of None failed because
of the following error:
[Errno 2] No such file or directory: 'unset': 'unset'.
.This error can be due to the fact that ImageMagick is
not installed on your computer, or (for Windows users)
that you didn't specify the path to the ImageMagick
binary in file conf.py, or that the path you specified
is incorrect
research:
Not able to add Text Clip in Moviepy. Getting error related to Imagemagic
Getting error about ImageMagick With Python/MoviePy when I try add text clip
Attempt at resolving the issue:
Based on the error message, I started looking for the conf.py file. I ran
!find / -type d -name "conf.py" but none of the files returned seemed to be under the subdirectory of imagemagick.
I also modified the policy.xml file under /etc/ImageMagick-6 by commenting out the line <!--<policy domain="path" rights="none" pattern="#*"/>--> but to no avail seemingly.
Any ideas??
I had the same issue. Check if this work for you: Install with:
!apt install
imagemagick
Then to fix the issue that it thinks ImageMagick is not installed use this:
!cat /etc/ImageMagick-6/policy.xml | sed 's/none/read,write/g'>
/etc/ImageMagick-6/policy.xml

local luarocks package install (luarepl) does not work

I'm new to luarocks and I just tried to install luarepl.
The installation apparently went fine:
$ luarocks install luarepl
Installing https://luarocks.org/luarepl-0.8-1.rockspec...
Using https://luarocks.org/luarepl-0.8-1.rockspec... switching to 'build' mode
Updating manifest for /Users/me/.luarocks/lib/luarocks/rocks-5.1
luarepl 0.8-1 is now built and installed in /Users/me/.luarocks (license: MIT/X11)
but if I try to launch the executable, it seems that the installation is broken:
$ ~/.luarocks/bin/rep.lua
/usr/local/bin/lua5.1: ...cks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin/rep.lua:23: module 'repl.console' not found:
no field package.preload['repl.console']
no file './repl/console.lua'
no file '/usr/local/share/lua/5.1/repl/console.lua'
no file '/usr/local/share/lua/5.1/repl/console/init.lua'
no file '/usr/local/lib/lua/5.1/repl/console.lua'
no file '/usr/local/lib/lua/5.1/repl/console/init.lua'
no file './repl/console.so'
no file '/usr/local/lib/lua/5.1/repl/console.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file './repl.so'
no file '/usr/local/lib/lua/5.1/repl.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
...cks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin/rep.lua:23: in main chunk
[C]: ?
I look into the ~/.luarocks dir:
$ cd ~ ; find .luarocks
.luarocks
.luarocks/bin
.luarocks/bin/rep.lua
.luarocks/config.lua
.luarocks/lib
.luarocks/lib/luarocks
.luarocks/lib/luarocks/rocks-5.1
.luarocks/lib/luarocks/rocks-5.1/luarepl
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/bin/rep.lua
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/COPYING
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/IDEAS.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/plugins.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/README.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/doc/Roadmap.md
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/luarepl-0.8-1.rockspec
.luarocks/lib/luarocks/rocks-5.1/luarepl/0.8-1/rock_manifest
.luarocks/lib/luarocks/rocks-5.1/manifest
.luarocks/share
.luarocks/share/lua
.luarocks/share/lua/5.1
.luarocks/share/lua/5.1/repl
.luarocks/share/lua/5.1/repl/console.lua
.luarocks/share/lua/5.1/repl/init.lua
.luarocks/share/lua/5.1/repl/plugins
.luarocks/share/lua/5.1/repl/plugins/autoreturn.lua
.luarocks/share/lua/5.1/repl/plugins/completion.lua
.luarocks/share/lua/5.1/repl/plugins/example.lua
.luarocks/share/lua/5.1/repl/plugins/filename_completion.lua
.luarocks/share/lua/5.1/repl/plugins/history.lua
.luarocks/share/lua/5.1/repl/plugins/keep_last_eval.lua
.luarocks/share/lua/5.1/repl/plugins/linenoise.lua
.luarocks/share/lua/5.1/repl/plugins/pretty_print.lua
.luarocks/share/lua/5.1/repl/plugins/rcfile.lua
.luarocks/share/lua/5.1/repl/plugins/rlwrap.lua
.luarocks/share/lua/5.1/repl/plugins/semicolon_suppress_output.lua
.luarocks/share/lua/5.1/repl/sync.lua
.luarocks/share/lua/5.1/repl/utils.lua
and I can find that stuff.
I tried adding a line to config.lua to load packages from local installation to no avail:
$ cat ~/.luarocks/config.lua
local_by_default=true
(removing it has no effect)
did I miss some obvious step?
running luarocks with no arguments gives me:
CONFIGURATION
Lua version: 5.1
Configuration files:
System: /usr/local/etc/luarocks51/config-5.1.lua (ok)
User : /Users/me/.luarocks/config.lua (ok)
Rocks trees in use:
/Users/me/.luarocks ("user")
/usr/local ("system")
it seems that the user rock tree is not in the package path:
$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print(package.path)
./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua
why?
From https://github.com/luarocks/luarocks/wiki/Using-LuaRocks:
Most LuaRocks installations will feature two rocks trees:
"system" rock tree (used by default)
"user" rock tree
To be able to use the module, we need to make sure that Lua can find that dkjson.lua file when we run require("dkjson"). You can check your Lua paths from the Lua environment, using
print(package.path)
print(package.cpath)
These variables can be pre-configured from outside Lua, using the LUA_PATH and LUA_CPATH environment variables.
If you installed both Lua and LuaRocks in their default directories (/usr/local on Linux and Mac OSX), then the "system" tree is /usr/local and it will work by default. However, the "user" tree (for installing rocks without admin privileges) is not detected by Lua by default. For that we'll need to configure these environment variables.
LuaRocks offers a semi-automated way to do this. If you type the following command:
luarocks path --bin
it will print commands suitable for your platform for setting up your environment. On typical Unix terminal environments, you can type this:
eval $(luarocks path --bin)
and it apply the changes, temporarily, to your shell. To have these variables set permanently, you have to configure the environment variables to your shell configuration (for example, by adding the above line to your .bashrc file if your shell is Bash).

How to get CMake find_file to accept UNIX-style paths on MSYS2?

I'm using CMake 3.4.1, on Windows 10, with MSYS2 (everything up-to-date as of Dec. 25 2015).
When I use CMake's find_file command, it won't work unless the path is in Windows-style. This is a problem for me, because I'm trying to use findwxWidgets.cmake, which fails because of this.
For example:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
find_file(version_h version.h PATHS /mingw64/include/wx-3.0/wx)
message(STATUS "version_h: ${version_h}")
Running cmake spits out:
-- version_h: version_h-NOTFOUND
But it's clearly in there:
>>> file /mingw64/include/wx-3.0/wx/version.h
/mingw64/include/wx-3.0/wx/version.h: C source, ASCII text
I'm wondering if this is a bug, or if there's some obscure flag I have to set to get this to work. How do I get CMake's find_file to find files with UNIX-style paths?
MinGW-w64 cmake can't understand MSYS2 paths. You might propose a path transformation test program to the CMake developers, but that's fairly gross and I'd hope the would reject that. Instead these things must be solved case-by-case. wx-config, being a shell script, is providing an MSYS2 path.
This is a bug in the currently release MSYS2 wxWidgets packages that will be fixed in the next release. To work around it, find the line in /mingw64/bin/wx-config or /mingw32/bin/wx-config:
prefix=${input_option_prefix-${this_prefix:-/mingw64}}
(or /mingw32 of course) and add after it:
if [ "x${MSYSTEM}" = "xMINGW32" ] || [ "x${MSYSTEM}" = "xMINGW64" ]; then
prefix=$(cygpath -m ${prefix})
fi
Be careful to remove it at upgrade time though.

image::magick not installing with cpan in perl v5.14.2 from dwimperl

I am attempting to rebuild my development/test environment on a new laptop running windows7 32 bit. imageMagick is one of the modules I had installed in an (ancient) version on my old laptop. I have downloaded and installed perl from dwimperl, which is v5.14.2 and had a couple modules install, and several did not.
cpanm Image::Magick - failed
cpanm DB_File - failed
cpanm Time::HiRes - failed
I searched around and found a discussion on magick failing to install on v5.12, but couldn't tell if that was supposed to have been fixed, or if I need to attempt to recreate the fix discussed for 5.12
should I try installing perl from Strawberry? looks like it is a little newer v5.18 ?
is there something I can tweak and re-run cpan installs?
I installed the binaries from imagemagick, from Link first, then cpan again, and cpan still fails....
This is the top part of the build log down to where it really goes south and starts kicking out errors:
cpanm (App::cpanminus) 1.6941 on perl 5.014002 built for MSWin32-x86-multi-thread
Work directory is C:\Users\dtbaker/.cpanm/work/1377281741.8420
You have make C:\Dwimperl\c\bin\dmake.exe
You have LWP 6.03
Falling back to Archive::Tar 1.80
Searching Image::Magick on cpanmetadb ...
--> Working on Image::Magick
Fetching http://www.cpan.org/authors/id/J/JC/JCRISTY/PerlMagick-6.86.tar.gz
-> OK
Unpacking PerlMagick-6.86.tar.gz
Entering PerlMagick-6.86
META.yml/json not found. Creating skelton for it.
Configuring PerlMagick-6.86
Running Makefile.PL
################################### WARNING! ###################################
# It seems that you are trying to install Perl::Magick on a MS Windows box with
# perl + gcc compiler (e.g. strawberry perl), however we cannot find ImageMagick
# binaries installed on your system.
#
# Please check the following prerequisites:
#
# 1) You need to have installed ImageMagick Windows binaries from
# http://www.imagemagick.org/script/binary-releases.php#windows
#
# 2) We only support dynamic (DLL) ImageMagick binaries
# note: it is not possible to mix 32/64-bit binaries of perl and ImageMagick
#
# 3) During installation select that you want to install ImageMagick's
# development files (libraries+headers)
#
# 4) You also need to have ImageMagick's directory in your PATH
# note: we are checking the presence of convert.exe and/or identify.exe tools
#
# 5) You might need Visual C++ Redistributable Package installed on your system
# see instructions on ImageMagick's Binary Release webpage
#
# We are gonna continue, but chances for successful build are very low!
################################################################################
Checking if your kit is complete...
Looks good
Note (probably harmless): No library found for -lMagickCore-6.Q16
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.62)
Building and testing Image-Magick-6.86
cp Magick.pm blib\lib\Image\Magick.pm
AutoSplitting blib\lib\Image\Magick.pm (blib\lib\auto\Image\Magick)
C:\Dwimperl\perl\bin\perl.exe C:\Dwimperl\perl\lib\ExtUtils\xsubpp -typemap C:\Dwimperl\perl\lib\ExtUtils\typemap -typemap typemap Magick.xs > Magick.xsc && C:\Dwimperl\perl\bin\perl.exe -MExtUtils::Command -e mv -- Magick.xsc Magick.c
gcc -c -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"6.86\" -DXS_VERSION=\"6.86\" "-IC:\Dwimperl\perl\lib\CORE" -D_LARGE_FILES=1 -DHAVE_CONFIG_H Magick.c
Magick.xs:60:31: error: magick/MagickCore.h: No such file or directory
Magick.xs:167: error: expected specifier-qualifier-list before 'MagickRealType'
Magick.xs:188: error: expected specifier-qualifier-list before 'ImageInfo'
Magick.xs:210: error: 'MagickNoiseOptions' undeclared here (not in a function)
however we cannot find ImageMagick binaries installed on your system.
Is ImageMagick is in your path, as recommanded in the 4) point? Open cmd.exe and type convert -v or convert.exe -v. If you don't see informations about Image Magick (Windows have a built-in convert command), it is very likely you have to add it to your path.
You also have to check points 1), 3), and 5). After that try again to run installation process through cpanm.
Trying to install for Citrus Perl, I discovered on debugging through the Perl part of the install that the mingw64 install had not included 'pexports.exe'. Downloading that from https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/
and placing it in the mingw64 directory was necessary to solve the problem of a long list of library export symbols not found.
Prior to that I had also set the environment variables CPATH, C_INCLUDE_PATH, and CPLUS_INCLUDE_PATH to point to the "include" directory of the ImageMagick install include directory in C:\Program Files (x86). (When you install ImageMagick you should check the box to install also for Strawberry Perl.)

scons does not find LaTeX DVI builder

I installed MacTex-2009 (from http://www.tug.org/mactex/2009/) and scons (1.2.0) on my iMac running Snow Leopard. Then I tested the installation with a trivial SConstruct file:
env = Environment()
dvi = env.DVI(target="hello.dvi",source="hello.tex")
and an obvious LaTeX "hello.tex" file. When I execute "scons", I get:
scons: Reading SConscript files ...
AttributeError: SConsEnvironment instance has no attribute 'DVI':
File "/Users/tsf/temp/SConstruct", line 2:
dvi = env.DVI(target="hello.dvi",source="hello.tex")
After the first line I added the command:
print str(env["BUILDERS"])
and I could see that the DVI builder does not appear. I am using the same files on a Linux machine (different TeX installation) and it works.
Any hints?
I solved the problem already. It seems that scons does not find MacTex-2009, so that the SConstruct file should look like:
import os
env = Environment(ENV = os.environ)
dvi = env.DVI(target="hello.dvi",source="hello.tex")
Now it works!
-- Tsf

Resources