ImageMagick + El Capitan Unable to Locate Module - macos

UPDATE: Solved with the solution here
I have spent the better part of my day trying to get ImageMagick to work with Grunt, with no luck. Grunt seems to be okay, but ImageMagick not so much, even though I've run the test on ImageMagick.org to make sure that it's installed correctly (I used HomeBrew for the install).
I get this error when trying to run a task:
Warning: Command failed: identify: unable to load module
'/usr/local/Cellar/imagemagick/6.9.2-4/lib/ImageMagick//modules-
Q16/coders/jpeg.la': file not found # error/module.c/OpenModule/1300.
identify: no decode delegate for this image format 'JPEG' #
error/constitute.c/ReadImage/501.
I've tried the solutions here and here, but none of them have helped.
(FYI I'm new to using the command line.)
Help?

As with any homebrew problem, I would suggest you run
brew doctor
first, to try and sort things out. It is an excellent diagnosis tool.
Now, to your specific problem... mmmm... the /opt/X11 part of your error message worries me because homebrew installs in /usr/local/bin and /usr/local/Cellar so your ImageMagick should not be looking anywhere in /opt at all. I guess you have installed freetype via MacPorts or some method other than homebrew.
I would suggest you install the freetype stuff using homebrew, i.e.
brew install freetype
Then I would suggest uninstalling any other freetype stuff you have installed any other way. Finally, I would suggest you check your PATH environment variable and make it point to /usr/local/bin before anything in /opt. You will need to log out and back in for the new PATH to take effect - you can check your PATH like this:
echo $PATH
and change it by editing $HOME/.profile if you need to.
The homebrew version of freetype provides version 19 of the library and is therefore compatible with the homebrew ImageMagick version.
Also, I am a little disconcerted by the X11 part in your error message - modern Macs don't really use X11 any more and it doesn't ship with OSX. Let's see if the above ideas sort you out before worrying about that too much though - unless you know, and can say for sure, that you need X11.

Related

Installing pyodbc and unixodbc on a mac

I've seen Pypyodbc: Can't open lib 'FreeTDS' : file not found") error when trying to connect to SQL server, but. that's 7 years old, and doesn't seem to be working for me, possibly because brew appears to be putting things in different places now?
I've used brew to install unixodbc, it's in /opt/homebrew/Cellar.
When I do pip install pyodbc, it appears to work, but I get:
connection = pyodbc.connect(connection_string)
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libtdsodbc.so' : file not found (0) (SQLDriverConnect)")
which is obviously wrong, because libtdsodbc is in /opt/homebrew/lib
I tried editing odbcinst.ini, but I'm not sure where that's supposed to live. There wasn't one in /etc, or a /etc/unixODBC directory... and when I create either one, the don't seem to be read, because it still complains about /usr/local/lib...
ETA: This is on a new Macbook, so on one of the new M1 chips.
Note: This is a BAD answer in the hopes of attracting a good one, but it technically seems to be working.
Homebrew for M1 installs everything in /opt/homebrew. Everything else expects things in /usr/local. On a new computer, /usr/local/lib didn't even exist. So I did
sudo ln -s /opt/homebrew/lib /usr/local/lib
THIS IS VERY BAD AND I KNOW IT But it's the only way I've figured out currently to deal with the problem. Maybe something hasn't caught up to M1? I'm not sure.
BETTER solution:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/homebrew/lib
There is a pull request that has been pretty much ignored for 13 months now by the pyodbc maintainer: https://github.com/mkleehammer/pyodbc/pull/870
You can install the forked version with this command (might need to uninstall the previous version or add extra arguments to force reinstall)
python3 -m pip install git+git://github.com/Aloisius/pyodbc.git#m1-homebrew

GDL not found after installing with homebrew

I used brew install GDL. The install was completed, but once I try to use GDL, it says " command not found: gdl".
I used "which gdl", but still can't be located. I tried reinstalling GDL via brew, but same error.
I tried changing the directory to the folder where brew installed GDL, but no luck either.
I looked through my other compilers and those are saved into bin, while GDL is not (if that's relevant at this point).
Anything will help!
If the intention was to install GNU Data Language, please try installing gnudatalanguage from homebrew-science: https://github.com/brewsci/homebrew-science/blob/master/Formula/gnudatalanguage.rb

How to use ImageMagick with XQuartz

I am trying to create animated visualization in R and people say needs to install ImageMagick. However, it seems that current Mac no longer support x11, while ImageMagick just needs X11 server on Mac. Install ImageMagick
I have also tried brew install imagemagick --with-x11, doesn't work and only returned so many errors.
Apples says need to use XQuartz to replace x11. I have XQuartz, but when I turned on it, typed the same commands here, still give me the same error
display: delegate library support not built-in '' (X11) # error/display.c/DisplayImageCommand/1891.
So, my questions is, how to install and use ImageMagick with Mac XQuartz?
I created a Homebrew ImageMagick X11 formula that can be used like this:
brew uninstall imagemagick # without X11 support
brew install --cask xquartz
brew install tlk/imagemagick-x11/imagemagick
Note that homebrew-core used to support formula options such as --with-x11 in order to enable a configure option of the same name. This is no longer the case as the Homebrew maintainer(s) decided to remove formula options from homebrew-core formulas.
Updated Answer
Note that things have changed a bit since I wrote this answer, Homebrew no longer supports installation options such as --with-x11. One possibility, pointed out in the comments by #MattWhite was to install ImageMagick interactively:
brew install imagemagick -i;
./configure --disable-osx-universal-binary --prefix=/usr/local/Cellar/imagemagick/7.0.8-66 --disable-silent-rules --with-x11
make install
exit
Another option that occurred to me was that, rather than installing all of XQuartz, you could just add your own delegate that uses macOS's built-in Preview app and tell ImageMagick to use that, i.e. delegate to it. This means you can do things like:
magick SomeImage.png -crop 100x100+10+10 display:
For this to work, you need to find your delegates.xml file. I used this:
magick -list delegate | awk '/^Path/ {print $2}'
and mine is at:
/opt/homebrew/Cellar/imagemagick/7.1.0-16/etc/ImageMagick-7/delegates.xml
Then I edited that file and added a line very close to the end, but just above the last line like this:
<delegate decode="miff" encode="display" spawn="True" command="magick %i %u.png ; /usr/bin/open -a Preview %u.png"/>
That converts any file formats that ImageMagick knows into a PNG which the Preview app understands and should be able to represent most images, even those with 16-bit depth and transparency.
Original Answer
In general, to use ImageMagick with X11, you will probably be most likely to succeed if you follow the following steps:
Step 1 - Install or update Xcode command line tools
It is important that your developer tools are up-to-date, especially if you have updated your macOS version since setting them up originally. You can do this with:
xcode-select --install
Step 2 - Ensure ImageMagick is correctly installed
The easiest way to do this is first to ensure that old versions of ImageMagick are removed and cleaned up and that you then install (or re-install) with the latest version:
brew update # update homebrew itself
brew rm imagemagick # remove old IM versions
brew install imagemagick --with-x11 # install latest IM version including X11 support
Step 3 - Check
If you have been trying for ages to install ImageMagick, you may have left some old versions lying around. It is important that you use the homebrew-installed version in /usr/local/bin, so check you are running the version you expect with the following:
which convert # should report "/usr/local/bin/convert"
which magick # should report "/usr/local/bin/magick"
identify -version # should report same version as next command
brew info imagemagick
Step 4 - Start X11
Start X11, it is probably easiest to fire up xclock, which not only starts X11, but also checks everything X11 is running and your X11 environment is configured correctly:
xclock &
Step 5 - Run ImageMagick X11
Now you can test your ImageMagick configuration, without needing any test images as follows - since the wizard: image is built-in:
display wizard:

How can i use ghost4j on OS X 10.9

When i want to use ghost4j on OS X 10.9, i see this error:
Unable to load library 'gs': dlopen(libgs.dylib, 9): image not found
I have installed ghostscript library on my macbook using this site.
how can i fix this problem. I can not install ghostscript using port and brew for some reason.
First you need to find the file libgs.dylib which was installed by the installer package compile the libgs.dylib library from source, and make a note of where you installed it to.
Hopefully it should have been installed to a standard library location, and there should be nothing more you need to do. If not, you need to set the environment variable DYLD_LIBRARY_PATH. In a terminal this would be done by typing export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/directory, replacing /directory with the full path of the actual directory containing libgs.dylib. After typing this, in that terminal, if you run your application, it should work. To make it take effect permanently you would need to add the export command to your ~/.bash_profile. Or to make it take effect for all user accounts on your computer, you could add it to your /etc/profile.
If this doesn't work, I suppose the Ghostscript library could be 32-bit - you would need a 64-bit library I think.
A bit of an old thread but maybe useful for people still looking for an answer.
Install ghostscript using port
port install ghostscript
That done, you need to create a link so ghost4j finds the dylib.
cd /usr/lib
sudo ln -s /opt/local/lib/libgs.9.10.dylib libgs.dylib
Once I did that it worked like a charm.

installing scipy on mac 10.6.8

I try to install scipy on my mac 10.6.8 but always have problem with it. I've installed ipython (sudo /usr/bin/easy_install-2.6 ipython) and numpy (python setup.py build/install), but when I installed scipy by the same way, I got always this error message:
RuntimeError: Running cythonize failed!
Could someone tell me how to solve this problem?
Have you tried using the binaries provided for OSX? That should ensure everything works.
EDIT
The easiest way I've found to keep package dependencies under control is to use MacPorts as much as possible because unlike Homebrew, the packages are designed to work together and dependencies are (almost always) automagically installed when you try to install something.
So, first, install MacPorts using the installer for Snow Leopard. Choose the option to install ports in a unique directory like /opt/local, so they don't conflict with whatever built-in versions the OS depends on. Also, ensure that /opt/local/bin and /opt/local/sbin are added to your $PATH before the system directories like /usr/bin, /bin, /sbin etc. so that when you run python from the command prompt you get the version you want. Your ~/.profile should have something like export PATH="/opt/local/bin:/opt/local/sbin:$PATH as its last line.
After MacPorts has been installed, you may want to restart just for fun to ensure that all of your environment variable are set up properly. Start Terminal.app (or your favorite replacement) and enter which port, which should return /opt/local/bin/port if everything worked correctly. Next, run sudo port selfupdate just to make sure everything is synced properly. Once that is done, we can install python and some modules. port allows you to pass a list of ports to be installed, so a command like sudo port install foo bar baz will install the latest versions of the foo, bar, and baz ports, along with any dependencies they may require, in the correct order. Some ports have binary distributions, and others are compiled as needed, so the first time you run it there may be a lot of dependencies to install. A nice feature of MacPorts is that you can have multiple versions of some packages installed at the same time, and you can switch between them if needed. Also, if port search is giving too many results, the online search engine can help you find what you're looking for.
To get a decent IPython-based Python 2 development environment going, you'll need the following:
python27
py27-ipython
py27-numpy
py27-scipy
py27-matplotlib (if you like drawing pretty pictures, but mainly so you can get pylab)
py27-pandas (DataFrames are your friend!)
and perhaps py27-pyqt4 if you run ipython via the qtconsole option
I'd also install py-pip and py27-distribute so you can install modules on your own if there is no MacPort version.
Finally, if you're a forward-looking person and want to use numpy et al. on Python 3, MacPorts has you covered! There are py32- and py33-based versions of all of the above packages except scipy, which is only py32 for now. However, I was able to install it just fine with pip, although I have a whole bunch of other devel tools on my machine, and I'm running 10.8.2, so YMMV.
Good luck!

Resources