I want to animate some plots with matplotlib. The version I have is the Enthough Canopy distribution (Version: 1.1.0.1371), running in a mac os x 10.8 (Mountain Lion). I have used the FuncAnimation routine from the animation package of matplotlib. My problem comes saving the animation. I want to save in mp4 format:
anim.save('test.mp4',fps=30)
The error I get is:
UserWarning: MovieWriter ffmpeg unavailable
warnings.warn("MovieWriter %s unavailable" % writer)
So I installed ffmpeg via Macports. But I am still having the same error. Do you know how to setup matplotlib in order to recognise ffmpeg? Do I have to change the matplotlibrc file?
Thanks.
EDIT: I have realized that I can manually put '/opt/local/bin' in the PYTHONPATH, but it does not change the PATH in Enthough Canopy. Do anyone know how to change the PATH in canopy?
I had the same problem. My solution was very simple.
Download the binary from here.
Then do
sudo mv ~/Downloads/ffmpeg /usr/bin/
I had success when installing with homebrew:
brew install ffmpeg
After that set up the FFMpegWriter yourself by:
mywriter = animation.FFMpegWriter()
anim.save('mymovie.mp4',writer=mywriter)
I think the solution can be found in the workaround in this and this post.
It seems that the path of the shell is not loaded by matplotlib, and since macports are installed in /opt/local/bin, ffmpeg can't be found.
Either go for the hack described above, try making a symlink in /bin for ffmpeg, or try adding the path to ffmpeg to the python path as suggested in the comments of the second link
Related
I have a problem with installing graphviz in PyCharm. Im using windows. I already installed graphviz library onto my PyCharm project, however error occurs when executing dot.render:
graphviz.backend.execute.ExecutableNotFound: failed to execute WindowsPath('dot')
I tried adding
import os
os.environ["PATH"] += os.pathsep + 'D:/Program Files (x86)/Graphviz2.38/bin/'
as said here: "RuntimeError: Make sure the Graphviz executables are on your system's path" after installing Graphviz 2.38
but it still doesent work?
any ideas?
Im new to pycharm and advanced coding in general, go easy please...
This is a very common problem. While it may have several causes (see suggestions above), the solution you found is out-of-date.
Unfortunately, there are two software systems named Graphviz. You need both.
Go here https://graphviz.gitlab.io/download/ and download the appropriate version.
To check that you have installed the "real" Graphviz package, bring up a cmd window & type dot -V
I know this question has been asked many times before but I cannot find a solution that works for me. I'm running Python 3.5.3 under Blender 2.79 in Windows 10. As I require Blender 2.79, upgrading the Python version is not possible.
I've installed matplotlib and I can import it. However, when I try to import pyplot (e.g. import matplotlib.pyplot as plt), I get a crash to desktop with no error messages of any kind. This happens if I run Python externally or from inside Blender. The weird thing is that I was able to avoid this by changing backends to agg (matplotlib.use('agg')) and this is still working in a previous installation (so I know it's possible to get this to work !), but not in a separate, new installation of Blender. I've tried other backends but they make no difference.
The exact procedure I've tried is as follows :
Downloaded Blender 2.79 from a zip file (I'm using Windows 10) and unpacked it (call this directory /Blender/)
In /Blender/2.79/python/bin I run the command ./python -m ensurepip
In /Blender/2.79/python/scripts I run pip3 install --upgrade pip --user. This gives me pip3 version 20.2.4
In the same directory I run pip3 install --target="/Blender/2.79/python/lib/site-packages" matplotlib --upgrade. The "upgrade" switch is to prevent warnings that the "/bin" directory exists. Doesn't make any difference if I remove it, there's no existing installation of matplotlib. This gives me matplotlib version 3.0.3
Finally I start Python by /Blender/2.79/python/bin/python.exe, and do the above mentioned importmatplotlib.pyplot command which causes the crash.
I've tried this from a completely fresh installation of Blender, which comes with no existing external modules installed. Could there be some conflict with other Python modules elsewhere ? How would I go about diagnosing what's going on ?
Thanks for any ideas !
FIXED ! I remembered I found the solution months ago, but stupidly wrote down the answer in the wrong file...
The problem is that matplotlib is looking for a file that doesn't exist. In c:/users/me/.matplotlib (a hidden file), there's a file ""fontlist-vXXX.json", where XXX is the version number. This is set in line 951 of the file "font_manager.py", located in /python/lib/site-packages/matplotlib. In my case, the font_manager was looking for version 300 but the actual file was 310. Changing the version number in the font_manager.py made everything work correctly.
in the last couple of days I was developing an APP on python IDLE.
I tried to import the vlc module, when I run it I get this error:
OSError: dlopen(libvlccore.dylib, 6): image not found
I installed the module with this command: pip install python-vlc.
I hope you can help me getting it work!
Thanks in advance!
Zaid Zaim
python-vlc is just Python bindings for libVLC.
Without that library, it won't do you any good, because all it does is try to load that library (a .dylib, .so, or .dll, depending on your platform) and call functions out of it.
There should be installation instructions at the wiki page linked above, but on a Mac, the easiest way is to just install the VLC player. I know that if you install it with Homebrew, you get the library, in a location that python-vlc can find. But I think even the binary installer from the front page of the main VideoLAN website will work as well.
If you're using Homebrew, you'll want to read the docs for when to search brew vs. brew cask vs. other taps,1 or search somewhere like Mac App Store for the current status. But at present, the appropriate command appears to be:
brew cask install vlc
1. Generally, anything that you'd expect to find as a double-clickable app in /Applications, as opposed to a Unix command-line tool or a support library, is going to be a cask, and therefore in the tap cask, which has special shortcuts to access it. But that's a relatively new thing, and not every recipe has been converted yet.
brew install --cask vlc
Is the latest command, and it works for me!
So many times after i type plot(g, layout=layout) poping out the error message:
I installed Cairo and py2cairo successfully as the doc said, but it didn't work.
I'm using mac os 10.8.x and I use ipython to try to plot as the tutorial.
First, make sure the python's real path by which python
Then, check the sys.path of current python.
I found that the brew install cairo is not installed in the python sys.path, so I have to
add another PYTHONPATH:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
to my .bashrc.
Sorry if this has been answered somewhere already, I couldn't find the answer.
I have installed python 2.7.3 onto a windows 7 computer. I then downloaded the pandas-0.10.1.win-amd64-py2.7.exe and tried to install it. I have gotten past the first window, but then it states "Python 2.7 is required, which was not found in the registry".
I then get the option to put the path in to find python, but I cannot get it to work.
How would I fix this? Sorry for the silly question.
Thanks.
~Kututo
I faced the same issue. Here is what worked
Changed to PATH to include C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;
uninstall 64bit numpy and pandas
install 32win 2.7 numpy and pandas
I had to also install dateutil and pytz
pandas and numpy work import work fine
After you have installed python check to see if the appropriate path variables are set by typing the following at the command line:
echo %PATH%
if you do not see something like:
C:\Python27;C:\Python27\Scripts
on the output (probably with lots of other paths) then type this:
set PATH=%PATH%;C:\\Python27\\;C:\\Python27\Scripts
Then try installing the 32-bit pandas executable.
You should try the anaconda distribution for windows. Is free, comes with all the package you will ever need, and one click installation.
http://continuum.io/downloads.html