Discussion:
In Spyder, Python doesn't find some external programs (ffmeg) (Pb with PATH ?)
Laurent PARISE
2013-03-01 12:04:53 UTC
Permalink
Excuse me for my English first.

I use Mac OS 10.6.8 Spyder for some time with great pleasure. Thank you for
your work!
However, since yesterday I have a problem with creating animations (MP4)
with matplotlib.

1. My script works from the command line (and make an mp4 file), but I get
an error in Spyder with the same script:

/Applications/Spyder.app/Contents/Resources/lib/python2.7/matplotlib/animation.py:
598:
UserWarning: ffmpeg MovieWriter unavailable
warnings.warn ("% s MovieWriter unavailable" writer%)

It seems that Spyder's Python can not find the 'ffmpeg' program that
creates the MP4 file.

2. I did some tests: if I start Spyder in the console command line, my script
is compiled correctly in Spyder ! But if I start Spyder by clicking on the
icon in the Applications folder, python does not find 'ffmpeg' that is in
'/usr/local/bin'.

In fact, '/usr/local/bin' is in my PATH in the console (I type 'env' in the
console to see it), but Spyder do not know if I run it from the
Applications folder ...

Could you tell me if it is possible to tell Spyder, it must use the PATH variable
to launch external programs (if my problem is it) ?


Thanks again.
Laurent.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to spyderlib-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Carlos Córdoba
2013-03-05 16:59:01 UTC
Permalink
X-Received: by 10.49.49.193 with SMTP id w1mr1509776qen.3.1362502754089;
Tue, 05 Mar 2013 08:59:14 -0800 (PST)
X-BeenThere: spyderlib-/***@public.gmane.org
Received: by 10.49.73.225 with SMTP id o1ls2331908qev.90.gmail; Tue, 05 Mar
2013 08:59:12 -0800 (PST)
X-Received: by 10.224.185.201 with SMTP id cp9mr21462647qab.6.1362502752671;
Tue, 05 Mar 2013 08:59:12 -0800 (PST)
X-Received: by 10.224.185.201 with SMTP id cp9mr21462645qab.6.1362502752653;
Tue, 05 Mar 2013 08:59:12 -0800 (PST)
Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com [209.85.216.54])
by gmr-mx.google.com with ESMTPS id f34si6361899qco.1.2013.03.05.08.59.12
(version=TLSv1 cipherìDHE-RSA-RC4-SHA bits8/128);
Tue, 05 Mar 2013 08:59:12 -0800 (PST)
Received-SPF: pass (google.com: domain of ccordoba12-***@public.gmane.org designates 209.85.216.54 as permitted sender) client-ip 9.85.216.54;
Received: by mail-qa0-f54.google.com with SMTP id hg5so2023670qab.13
for <spyderlib-/***@public.gmane.org>; Tue, 05 Mar 2013 08:59:12 -0800 (PST)
X-Received: by 10.49.34.140 with SMTP id z12mr43094207qei.10.1362502752529;
Tue, 05 Mar 2013 08:59:12 -0800 (PST)
Received: from [192.168.0.39] ([186.80.103.146])
by mx.google.com with ESMTPS id hn9sm43603288qab.8.2013.03.05.08.59.03
(version=TLSv1 cipherìDHE-RSA-RC4-SHA bits8/128);
Tue, 05 Mar 2013 08:59:10 -0800 (PST)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Firefox/17.0 Thunderbird/17.0.3
In-Reply-To: <da5913b0-c0ca-497c-b25d-6761bde2f4e5-/***@public.gmane.org>
X-Original-Sender: ccordoba12-***@public.gmane.org
X-Original-Authentication-Results: gmr-mx.google.com; spf=pass
(google.com: domain of ccordoba12-***@public.gmane.org designates 209.85.216.54 as
permitted sender) smtp.mailÌordoba12-***@public.gmane.org; dkim=pass header.i=@gmail.com
Precedence: list
Mailing-list: list spyderlib-/***@public.gmane.org; contact spyderlib+owners-/***@public.gmane.org
List-ID: <spyderlib.googlegroups.com>
X-Google-Group-Id: 771623949029
List-Post: <http://groups.google.com/group/spyderlib/post?hl=en_FR>, <mailto:spyderlib-/***@public.gmane.org>
List-Help: <http://groups.google.com/support/?hl=en_FR>, <mailto:spyderlib+help-/***@public.gmane.org>
List-Archive: <http://groups.google.com/group/spyderlib?hl=en_FR>
Sender: spyderlib-/***@public.gmane.org
List-Subscribe: <http://groups.google.com/group/spyderlib/subscribe?hl=en_FR>, <mailto:spyderlib+subscribe-/***@public.gmane.org>
List-Unsubscribe: <http://groups.google.com/group/spyderlib/subscribe?hl=en_FR>,
<mailto:googlegroups-manage+771623949029+unsubscribe-/***@public.gmane.org>
Archived-At: <http://permalink.gmane.org/gmane.comp.python.scientific.spyder/2087>

Hi Laurent,

I don't know what could be happening. I opened Issue 1298 so we don't
forget to solve the problem for the next release.

Cheers,
Carlos
Post by Laurent PARISE
Excuse me for my English first.
I use Mac OS 10.6.8 Spyder for some time with great pleasure. Thank
you for your work!
However, since yesterday I have a problem with creating animations
(MP4) with matplotlib.
1. My script works from the command line (and make an mp4 file), but I
UserWarning: ffmpeg MovieWriter unavailable
warnings.warn ("% s MovieWriter unavailable" writer%)
It seems that Spyder's Python can not find the'ffmpeg' program that
creates the MP4 file.
2. I did some tests: if I start Spyder in the console command line, my
script is compiled correctly in Spyder ! But if I start Spyder by
clicking on the icon in the Applications folder, python does not find
'ffmpeg' that isin '/usr/local/bin'.
In fact, '/usr/local/bin' is in myPATH in the console (I type 'env' in
the console to see it), but Spyder do not know if I run it from the
Applications folder...
Could you tell me if it is possible to tell Spyder, it must use the
PATH variable to launch external programs (if my problem is it)?
Thanks again.
Laurent.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to spyderlib-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
mrclary
2013-03-05 18:21:59 UTC
Permalink
If I understand your problem correctly:
1. you have the executable path /usr/local/bin/ffmpeg
2. your script executes successfully if run in a python (or ipython)
interpreter started from the terminal
3. your script executes unsuccessfully if run from within Spyder
(standalone app)

If the above is correct, then I think I know what the problem is.
When Spyder is started, the interpreter inherits the following system PATH:

In[6]: os.environ['PATH']
Out[6]:
'/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Spyder.app/Contents/Resources'

which does not include '/usr/local/bin'

I have run into this problem before and found one solution is to modify the
system path in the interpreter's startup script. I've attached the startup
script that I use. The script captures the environment variables from a
standard terminal session, including any statements contained in your bash
profile scripts. On my system I use ~/.profile and /etc/profile for my bash
profiles, but if you use something else (e.g. bashrc, bash_profile, etc.)
you will want to modify the attached script appropriately. In Spyder's
preferences, specify the attached script as the startup script.

Your system path (os.environ['PATH']) in Spyder should now match your PATH
environment variable in a Terminal session (echo $PATH), and scripts run
from within Spyder should be able to find any executables in
'/usr/local/bin'.

Ryan Clary
Post by Laurent PARISE
Excuse me for my English first.
I use Mac OS 10.6.8 Spyder for some time with great pleasure. Thank you for
your work!
However, since yesterday I have a problem with creating animations (MP4)
with matplotlib.
1. My script works from the command line (and make an mp4 file), but I
UserWarning: ffmpeg MovieWriter unavailable
warnings.warn ("% s MovieWriter unavailable" writer%)
It seems that Spyder's Python can not find the 'ffmpeg' program that
creates the MP4 file.
2. I did some tests: if I start Spyder in the console command line, my script
is compiled correctly in Spyder ! But if I start Spyder by clicking on
the icon in the Applications folder, python does not find 'ffmpeg' that isin
'/usr/local/bin'.
In fact, '/usr/local/bin' is in my PATH in the console (I type 'env' in
the console to see it), but Spyder do not know if I run it from the
Applications folder ...
Could you tell me if it is possible to tell Spyder, it must use the PATH variable
to launch external programs (if my problem is it) ?
Thanks again.
Laurent.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to spyderlib-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Laurent PARISE
2013-03-16 15:33:29 UTC
Permalink
Thanks a lot for your answer. Sorry for my late reply, I was away for
several days.
Post by mrclary
1. you have the executable path /usr/local/bin/ffmpeg
2. your script executes successfully if run in a python (or ipython)
interpreter started from the terminal
3. your script executes unsuccessfully if run from within Spyder
(standalone app)
You're right : It happens exactly 1, 2 and 3, but I would add that if I run
Spyder from a terminal (and not from the "Applications" menu)
by typing "/Applications/Spyder.app/Contents/MacOS/Spyder", Spyder then recognizes
the paths that are in the PATH variable and ffmpeg starts correctly when
called by Matplotlib.

Laurent.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to spyderlib-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Carlos Córdoba
2013-03-25 04:20:34 UTC
Permalink
Hi Ryan,

Thanks a lot for your script, it made my day. Just yesterday I wasted a
couple of hours trying to find a way to add environment variables to our
app.

I really missed your code the first time but now I added it (with due
credit of course) to our tree.

Thanks again,
Carlos
Post by mrclary
1. you have the executable path /usr/local/bin/ffmpeg
2. your script executes successfully if run in a python (or ipython)
interpreter started from the terminal
3. your script executes unsuccessfully if run from within Spyder
(standalone app)
If the above is correct, then I think I know what the problem is.
In[6]: os.environ['PATH']
'/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Spyder.app/Contents/Resources'
which does not include '/usr/local/bin'
I have run into this problem before and found one solution is to
modify the system path in the interpreter's startup script. I've
attached the startup script that I use. The script captures the
environment variables from a standard terminal session, including any
statements contained in your bash profile scripts. On my system I use
~/.profile and /etc/profile for my bash profiles, but if you use
something else (e.g. bashrc, bash_profile, etc.) you will want to
modify the attached script appropriately. In Spyder's preferences,
specify the attached script as the startup script.
Your system path (os.environ['PATH']) in Spyder should now match your
PATH environment variable in a Terminal session (echo $PATH), and
scripts run from within Spyder should be able to find any executables
in '/usr/local/bin'.
Ryan Clary
Excuse me for my English first.
I use Mac OS 10.6.8 Spyder for some time with great pleasure.
Thank you for your work!
However, since yesterday I have a problem with creating animations
(MP4) with matplotlib.
1. My script works from the command line (and make an mp4 file),
UserWarning: ffmpeg MovieWriter unavailable
warnings.warn ("% s MovieWriter unavailable" writer%)
It seems that Spyder's Python can not find the'ffmpeg' program
that creates the MP4 file.
2. I did some tests: if I start Spyder in the console command
line, my script is compiled correctly in Spyder ! But if I start
Spyder by clicking on the icon in the Applications folder, python
does not find 'ffmpeg' that isin '/usr/local/bin'.
In fact, '/usr/local/bin' is in myPATH in the console (I type
'env' in the console to see it), but Spyder do not know if I run
it from the Applications folder...
Could you tell me if it is possible to tell Spyder, it must use
the PATH variable to launch external programs (if my problem is it)?
Thanks again.
Laurent.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to spyderlib-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/spyderlib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Han ZHANG
2014-11-18 05:22:25 UTC
Permalink
Come into the same problem. Where can I find the interpreter's startup
script? Or which directory should I put your file into? Thanks

Best
Han

圚 2013幎3月5日星期二UTC-5䞋午1时21分59秒mrclary写道
Post by mrclary
1. you have the executable path /usr/local/bin/ffmpeg
2. your script executes successfully if run in a python (or ipython)
interpreter started from the terminal
3. your script executes unsuccessfully if run from within Spyder
(standalone app)
If the above is correct, then I think I know what the problem is.
In[6]: os.environ['PATH']
'/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Spyder.app/Contents/Resources'
which does not include '/usr/local/bin'
I have run into this problem before and found one solution is to modify
the system path in the interpreter's startup script. I've attached the
startup script that I use. The script captures the environment variables
from a standard terminal session, including any statements contained in
your bash profile scripts. On my system I use ~/.profile and /etc/profile
for my bash profiles, but if you use something else (e.g. bashrc,
bash_profile, etc.) you will want to modify the attached script
appropriately. In Spyder's preferences, specify the attached script as the
startup script.
Your system path (os.environ['PATH']) in Spyder should now match your PATH
environment variable in a Terminal session (echo $PATH), and scripts run
from within Spyder should be able to find any executables in
'/usr/local/bin'.
Ryan Clary
Post by Laurent PARISE
Excuse me for my English first.
I use Mac OS 10.6.8 Spyder for some time with great pleasure. Thank you for
your work!
However, since yesterday I have a problem with creating animations (MP4)
with matplotlib.
1. My script works from the command line (and make an mp4 file), but I
UserWarning: ffmpeg MovieWriter unavailable
warnings.warn ("% s MovieWriter unavailable" writer%)
It seems that Spyder's Python can not find the 'ffmpeg' program that
creates the MP4 file.
2. I did some tests: if I start Spyder in the console command line, my script
is compiled correctly in Spyder ! But if I start Spyder by clicking on
the icon in the Applications folder, python does not find 'ffmpeg' that
is in '/usr/local/bin'.
In fact, '/usr/local/bin' is in my PATH in the console (I type 'env' in
the console to see it), but Spyder do not know if I run it from the
Applications folder ...
Could you tell me if it is possible to tell Spyder, it must use the PATH variable
to launch external programs (if my problem is it) ?
Thanks again.
Laurent.
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
Ryan Clary
2014-11-18 20:59:54 UTC
Permalink
It doesn't matter where you put the script. But in Spyder's preferences >> console >> advanced settings, select "use the following startup script" and specify the file.

Thanks,
Ryan Clary
Come into the same problem. Where can I find the interpreter's startup script? Or which directory should I put your file into? Thanks
Best
Han
--
You received this message because you are subscribed to the Google Groups "spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spyderlib+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/d/optout.
Loading...