I wanted to import fitz in my code. To do that, I tried installing PyMuPDF using
pip3 install PyMuPDF
However, this installation fails and returns this error:
fitz/fitz_wrap.c:2754:10: fatal error: 'fitz.h' file not found
#include <fitz.h>
^~~~~~~~
1 error generated.
error: command '/opt/homebrew/clang' failed with exit code 1
I also tried installing mupdf and mupdf-tools via Homebrew. None of them could fix this issue.
I would appreciate any help to fix this installation error!
Assuming you are using M1 Mac, you can solve this problem installing mupdf, swig, freetype and latest version of PyMuPDF:
brew install mupdf swig freetype
pip install https://github.com/pymupdf/PyMuPDF/archive/master.tar.gz
Source: https://github.com/pymupdf/PyMuPDF/discussions/875
The instructions provided by Juan Garcia worked until June 18th 2022 for me. There's a few workarounds.
Solution #1
Install the wheel package using pip and swig + freetype using homebrew. PyMuPDF should build itself successfully when running pip install pymupdf. This takes about five minutes on a late model M1 MBP. This does not require the mupdf package installed via homebrew.
Solution #2
If you're using homebrew you can downgrade to 1.19.x with the following:
cd "$(brew --repo homebrew/core)" && git checkout 457cb59a52ff7666dc146c1c480d2ea98d63564f;
# If you already have mupdf installed use `brew reinstall` instead of `brew install`
cd "$(brew --repo homebrew/core)" && HOMEBREW_NO_AUTO_UPDATE=1 brew install mupdf;
cd "$(brew --repo homebrew/core)" && git checkout master && brew pin mupdf;
brew install swig freetype;
pip install https://github.com/pymupdf/PyMuPDF/archive/refs/tags/1.19.6.tar.gz;
For reference here is the Formula commit history: https://github.com/Homebrew/homebrew-core/commits/master/Formula/mupdf.rb
Related
I used
./configure --prefix=$HOME
make
make install
to install sdl2,
after which I tried to install pygame by
cd ../pygame-1.9.1release/
python setup.py install
but I am getting an error:
linuxnx:~/python/library/pygame-1.9.1release> python setup.py install
WARNING, No "Setup" File Exists, Running "config.py"
Using UNIX configuration...
Hunting dependencies...
sh: sdl-config: command not found
WARNING: "sdl-config" failed!
sh: smpeg-config: command not found
WARNING: "smpeg-config" failed!
Unable to run "sdl-config". Please make sure a development version of SDL is installed.
I searched a long time, cause I needed the package for Python Crash Course by Eric Matthes, but couldn't find the answer that would help running
pip install pygame
without errors and finally found 1 line solution that worked for me
sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev
I'm seeing that this thread has been around for a long time, but I think it's a good idea to leave this here in case it helps someone.
I found these lines on a website that might help:
At the moment, 5/1/2020, you cannot install the pygame libraries in
python 3.8 with pip install pygame, bu you can install them with a
particular version of them, still for dev. You can install Python 3.8
in the command line using this version: pip install pygame==2.0.0.dev6
Latest version: pip install pygame==2.0.0.dev10
I don't know if you use python3 but it throws me more errors apart from sdl
as well as freetype-config ... Before I used "python3 -m pip install pygame".
:~$ python3 -m pip install pygame==2.0.0.dev10
Collecting pygame==2.0.0.dev10
Downloading pygame-2.0.0.dev10-cp38-cp38-manylinux1_x86_64.whl (14.3 MB)
|████████████████████████████████| 14.3 MB 130 kB/s
Installing collected packages: pygame
Successfully installed pygame-2.0.0.dev10
Nice programming time for all!! =)
ORIGINAL: 2013.10.25
PyGame-1.9.1 was created in 2009 so it still use old SDL 1.2 not new SDL2.
PySDL2 use SDL2
EDIT: 2021.10.17
Question and my original answer is almost 8 years old and it seems author removed PySDL2 from URL in my old answer. He moved code from bitbucket to github
Using Google I found
doc: https://pysdl2.readthedocs.io/
pypi: https://pypi.org/project/PySDL2/
github: https://github.com/marcusva/py-sdl2
And meanwhile PyGame started to use SDL2.
Pygame.org: pygame 2 — 28 Oct, 2020
GitHub: Release note
See also all releases
Try this in the terminal , It should installs the sdl 1.2
# make a temporary directory where we can download and build stuff
mkdir tmp
cd tmp
# download and install SDL
wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure
sudo make all
After I read top answer above,
I installed python-dev, libsdl-image1.2-dev.
Then I got
Hunting dependencies...
WARNING: "pkg-config freetype2" failed!
WARNING: "freetype-config" failed!
SDL : found 1.2.15
FONT : not found
IMAGE : found
MIXER : not found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: not found
PORTTIME: not found
FREETYPE: not found
Missing dependencies
So I just installed these and it worked.
sudo apt install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libportmidi-dev libfreetype6-dev
This error showed up once again in Pygame-2.0.0.dev12
The solution for me was:
sudo apt-get install libsdl2-dev
Then I got
Hunting dependencies...
SDL : found 2.0.9
FONT : not found
IMAGE : not found
MIXER : not found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: found
PORTTIME: found
FREETYPE: found 22.1.16
So I ran this command below:
sudo apt-get install libsdl2-mixer-dev libsdl2-image-dev libsdl2-ttf-dev
To wrap up the missing dependencies
I tried install the postgresSQL adapter for the Python:
$ pipenv install psycopg2
And I got this error:
Installing dependencies from Pipfile.lock (45527d)…
An error occurred while installing psycopg2==2.8.2...
The error stack is soo long, here the last lines:
(...)bin/../include/site/python3.7/psycopg2" failed with error code 1 in /private/var/folders/wq/wp6z48kj7_z3ynpkchsmqjp80000gn/T/pip-install-8ffakjrp/psycopg2/']
Any tip about?
Use this:
pipenv clean
pipenv install psycopg2-binary
I had solved installing just the binaries an others libs. Here is:
$ brew install libxml2 libxmlsec1 pkg-config
$ pipenv install psycopg2-binary
I tried a bunch of stuff but I think this worked better.
$ xcode-select --install
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl/include"
I'm trying to install node with homebrew on macOS Sierra.
I run
brew install node
After a seemingly successful install I get the following when trying to run node:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
Abort trap: 6
This is the series of incantations that eventually worked for me based on this link suggested by #robertklep and #vovkasm.
brew uninstall --force node
brew uninstall icu4c && brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node
I'm not sure if they're all needed, but given that I can't get my machine in the previous state... I'll just leave this info here, maybe it'll be useful for somebody else.
In my case, brew upgrade node resolve the problem :)
Well I got this error trying to install #angular/cli, realized node might be out of date. Following #mircealungu 's exact steps didn't quite work for me, here is the modified version that worked for me.
brew uninstall --ignore-dependencies --force node
brew uninstall --ignore-dependencies --force icu4c
brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node
Upgrading node fixed a problem.
brew upgrade node
I recently encountered a similar issue (after doing
brew switch node 9.8.0 to downgrade to a previous version of node)
dyld: Library not loaded:
/usr/local/opt/icu4c/lib/libicui18n.60.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
Abort trap: 6
The issue is that node is picky about which version of icu4c it's looking for, and the version I had installed (62) was higher than node was expecting.
To fix, I made sure I had version 60 of icu4c selected.
First I found which versions I had with brew info icu4c, then did
brew switch icu4c 60.2 to select the one node was expecting.
For me it was apparently a problem with the icu4c installation from brew.
brew reinstall icu4c
will reinstall icu4c.
if you don't have it installed,
brew install icu4c
Seems file /usr/local/opt/icu4c/lib/libicui18n.58.dylib does not exists in you system.
Please ensure that icu4c installed with Homebrew.
brew info icu4c
If already installed, try reinstall: brew reinstall icu4c
If not installed, try install: brew install icu4c
For high seirra, just "brew upgrade" makes magic!
First I uninstall node and icu4c, force to uninstall all versions
brew uninstall --force --ignore-dependencies node icu4c
After install version 8 of Node
brew install node#8
If it already install, please just upgrade
brew upgrade node#8
And enter
node -v
v8.11.1
This was triggered for me after a brew upgrade and brew update ran. I was able to fix it by simply re-installing the two items flagged as problems (which made sense to me):
brew reinstall node
brew reinstall icu4c
None of the above worked for me. I'm using High Sierra.
What fixed it for me was brew upgrade
I found a solution that works great over here. I'll briefly give the commands below.
First, cd into the homebrew formula directory:
cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
Git log:
git log --follow icu4c.rb
Choose the commit hash that matches the version you need. I needed version 61.1, thus chose the 6d9815 commit:
git checkout -b icu4c-61.1 6d9815
Reinstall:
brew reinstall ./icu4c.rb
Switch:
brew switch icu4c 61.1
That fixed it for me.
Credit: hanxue
Nothing worked for me but running this worked
brew link --overwrite node
brew uninstall --force node
brew uninstall --ignore-dependencies icu4c
brew unlink icu4c && brew link icu4c --force
brew install node
This error was given to me after migrating machines.
Even though everything was installed, when I went to check node -v or npm version, I'd get this error.
What fixed it was brew reinstall icu4c.
I had the same problem with my local php installation.
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
Abort trap: 6
Solved the problem with this command. (check your version)
brew link --overwrite --force php#7.1
I removed export PATH="/usr/local/opt/icu4c/bin:$PATH" from my ~/.bash_profile file and it fixed my problem.
My error was:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
Referenced from: /usr/local/opt/node#10/bin/node
Reason: image not found
Abort trap: 6
My /usr/local/opt/icu4c/lib contains libicui18n.64.dylib
I fixed by
cd /usr/local/Cellar
rm -rf node*/
rm -rf icu4c/
brew install node
it seems like your icu4u Reference path is not set properly
first check you might instal icu4c or not by putting below comment in comment promt
brew info icu4c
or else reinstall
brew reinstall icu4c
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
hope This might help !!!!!
It's as easy as a common software, just download installation package from official site:NodeJS
and then download a recommended version(currently 8.11.3, end with .pkg), install it as a common software, then u can use it. I tried so many methods, and only this works for me.
Try restarting your machine. That helped me.
i run this on macos:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
it takes around 20 minu
I'm trying to install PhantomJS v2.0.0 using npm and after trying a couple of methods I've not found a working solution...
On NPM the latest version is 1.9.16, so I've tried the following in my package.json:
"phantomjs": "https://github.com/ariya/phantomjs/archive/2.0.0.tar.gz"
This gives me an error because there isn't a package.json for this version in the github repo.
"phantomjs": "2.0.0"
This tells me there is no version with this number available.
Am I missing something here?
phantomjs-prebuilt was renamed from phantomjs and now additionally contains binaries for version 2.1+.
npm -g install phantomjs-prebuilt
The fork phantomjs2 is still available which contains version 2.0.
npm -g install phantomjs2
Keep in mind that not all platforms might be supported.
Phantomjs may be installed as a brew package. Confirm this:
brew ls | grep phantomjs
If you do have phantomjs installed as a brew package, you can easily uninstall it:
brew uninstall phantomjs
Then try rerunning npm install after updating your package.json for "2.0.0".
FYI: Please read semantic versioning: https://stackoverflow.com/a/22345808/3412545
I had troubles to install it via npm.
I decided to build it. I'm running Ubuntu 15.10.
First, check you have all the development packages installed :
sudo apt-get install build-essential g++ flex bison gperf ruby perl libsqlite3-dev libfontconfig1-dev libicu-dev libfreetype6 libssl-dev libpng-dev libjpeg-dev python libx11-dev libxext-dev
Then download the source code : https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-source.zip
And run :
cd phantomjs-2.0.0-source
sudo ./build.sh
It's a very long process to build it ! Be sure you know what you're doing.
npm install phantomjs-prebuilt try this for node users
I am trying to install GITLAB. I get this error executing "sudo gem install charlock_holmes --version '0.6.9'" (section Install Gems)
GEOGIT:/geogit/Administrative_Tools # sudo gem install charlock_holmes --version '0.6.9'
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9 extconf.rb
checking for main() in -licui18n... no
which: no brew in (/usr/sbin:/bin:/usr/bin:/sbin)
checking for main() in -licui18n... no
***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9
--with-icu-dir
--without-icu-dir
--with-icu-include
--without-icu-include=${icu-dir}/include
--with-icu-lib
--without-icu-lib=${icu-dir}/
--with-icui18nlib
--without-icui18nlib
--with-icui18nlib
--without-icui18nlib
Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9/ext/charlock_holmes/gem_make.out
Someone, can help me debug those logs and error?
This looks like issue 1952
It was actually weirdness with the way my ubuntu VPS is commissioned. Mine did not come with a C compiler or libdev obviously.
The problem fix I found was to install libdev first, then the GCC
Then apt-get install libicu-dev.
Update 2015: additional comments include:
yum install libicu-devel worked for me
You just need to make sure "patch" is installed (yum install patch) then it should work
For MacOS install the following dependency:
brew install icu4c
According to the documentation (https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md) the package libicu-dev is required
Install it with "apt-get install libicu-dev" and then charlock_holmes could be installed
I used "yum install libicu-devel" and then I could install charlock_holmes
I got the same mistake on a Centos 5.4 server, the yum repository only have the icu version 3.6, so i have to search and install manually the library icu 4.2 which solve the problem. In case someone else need to know how to do it, i recommend to check this link http://source.icu-project.org/repos/icu/icu/tags/release-4-2-1/readme.html#HowToBuildUNIX
I had kind of the same problem: when I was trying to install charlock_holmes gem, I had this error:
charlock_holmes-0.7.3/mkmf.log
have_library: checking for main() in -licui18n... -------------------- no
I fixed it by running the first command of #VonC:
sudo apt-get install libicu-dev
Hope I helped someone!