Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MacOSX SpeechRecognition installation problems

44 views
Skip to first unread message

3dB

unread,
Dec 8, 2016, 1:09:54 AM12/8/16
to
trying to install SpeechRecognition for Python results in error:

running install_lib
creating /Library/Python/2.7/site-packages/speech_recognition
error: could not create '/Library/Python/2.7/site-packages/speech_recognition': Permission denied


Any advice on how to fix?

Follow information may be helpful:

MacOSX 10.12.1
Python 2.7.10 (default, Jul 30 2016, 18:31:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin

/usr/local/bin/brew
/usr/bin/python

pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

Michael Torrie

unread,
Dec 8, 2016, 1:18:59 AM12/8/16
to
On 12/07/2016 11:09 PM, 3dB wrote:
> trying to install SpeechRecognition for Python results in error:
>
> running install_lib
> creating /Library/Python/2.7/site-packages/speech_recognition
> error: could not create '/Library/Python/2.7/site-packages/speech_recognition': Permission denied
>
>
> Any advice on how to fix?

Are you using sudo?

Anton Mamaenko

unread,
Dec 8, 2016, 4:16:07 AM12/8/16
to
I would suggest using virtual environment (virtualenv, for example) for installing such packages.

Dealing with directory permissions on MacOS is complicated, and using "sudo" is not the right way. Moreover, during the next OS upgrade the permissions will be updated as well, and chances are that your global package configuration breaks anyways.

Regards,
Anton

>> On 8 Dec 2016, at 09:18, Michael Torrie <tor...@gmail.com> wrote:
>>
>> On 12/07/2016 11:09 PM, 3dB wrote:
>> trying to install SpeechRecognition for Python results in error:
>>
>> running install_lib
>> creating /Library/Python/2.7/site-packages/speech_recognition
>> error: could not create '/Library/Python/2.7/site-packages/speech_recognition': Permission denied
>>
>>
>> Any advice on how to fix?
>
> Are you using sudo?
>
>>
>> Follow information may be helpful:
>>
>> MacOSX 10.12.1
>> Python 2.7.10 (default, Jul 30 2016, 18:31:42)
>> [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
>>
>> /usr/local/bin/brew
>> /usr/bin/python
>>
>> pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
>
> --
> https://mail.python.org/mailman/listinfo/python-list

3dB

unread,
Dec 8, 2016, 1:23:34 PM12/8/16
to
Anton, Thanks for the detailed response. I will look into virtualenv and others. Please excuse beginner's question, but is Xcode of any use in this type of situation?

Michael Torrie

unread,
Dec 8, 2016, 1:35:14 PM12/8/16
to
Not directly, but it does provide a C compiler, which some Python
modules require when you build and install them. So having Xcode
installed could be a requirement for installing some python modules (but
not all, nor is it required to run python scripts).

Are you asking if there are some nice IDEs available for working with
Python?

3dB

unread,
Dec 8, 2016, 3:26:46 PM12/8/16
to
Thanks Michael,

I think I was confusing Virtual Environment (VE) with IDE.

Probably best if I get to grips with virtualenv to start with since I can't complete installations at present and VE appears to offer best solution.

3dB

unread,
Dec 8, 2016, 3:48:47 PM12/8/16
to
Michael,

I tried installing virtual env but got similar permissions error:

IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py'

Michael Torrie

unread,
Dec 8, 2016, 4:10:22 PM12/8/16
to
Despite Anton's warning about sudo, you definitely could use it to
install the module to /Library and get on with using it for now, and
learn about virtual environments once you've got some python experience.
The problem was that the install function of the package wanted to
write files to that location in /Library, which non-root users cannot
do. Prefacing that command with sudo will elevate access temporarily
allowing the installation to proceed. That's what I would do if I were
you.

Who cares if you have to redo it after you reinstall the OS, or even
move to a different computer. Yes virtual environments are nice and
self-contained and require no special privileges to use. But if you
don't know anything about python, that's going to be an advanced topic
for now.

Michael Torrie

unread,
Dec 8, 2016, 4:11:28 PM12/8/16
to
Just to get virtual environment support you definitely have to install
this package, and it must go to the system packages area. So I think
sudo is a must for this one.

sudo <whatever command you typed before>


Skip Montanaro

unread,
Dec 8, 2016, 4:27:19 PM12/8/16
to
Sorry, I haven't been following this thread carefully. Michael's use of
"sudo" caught my eye though. I know virtualenv might be "special", but
shouldn't this work?

pip install --user virtualenv

It will wind up in $HOME/.local/lib/python2.7/site-packages (or similar) I
believe.

Skip

On Thu, Dec 8, 2016 at 3:11 PM, Michael Torrie <tor...@gmail.com> wrote:

> On 12/08/2016 01:48 PM, 3dB wrote:
> Just to get virtual environment support you definitely have to install
> this package, and it must go to the system packages area. So I think
> sudo is a must for this one.
>
> sudo <whatever command you typed before>
>
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Michael Torrie

unread,
Dec 8, 2016, 4:28:47 PM12/8/16
to
On 12/08/2016 02:27 PM, Skip Montanaro wrote:
> Sorry, I haven't been following this thread carefully. Michael's use of
> "sudo" caught my eye though. I know virtualenv might be "special", but
> shouldn't this work?
>
> pip install --user virtualenv
>
> It will wind up in $HOME/.local/lib/python2.7/site-packages (or similar) I
> believe.

Ahh yes, that's probably correct.

3dB

unread,
Dec 8, 2016, 7:19:42 PM12/8/16
to
> > pip install --user virtualenv
> >
> > It will wind up in $HOME/.local/lib/python2.7/site-packages (or similar) I
> > believe.

Michael, Skip,

I've noticed that Python is in the highest level of the drive, HDD/Library/Python as opposed to usr/Library. Does that present a problem?

Also noticed that Python folder contains both versions 2.6 and 2.7.

3dB

unread,
Dec 8, 2016, 7:22:46 PM12/8/16
to
> pip install --user virtualenv
>
> It will wind up in $HOME/.local/lib/python2.7/site-packages (or similar) I
> believe.

Skip, thanks, that worked for virtualenv.

I'll now try sudo for Speechrecognition.

Michael Torrie

unread,
Dec 8, 2016, 7:30:08 PM12/8/16
to
OS X ships with both Python 2.6 and 2.7 apparently. The default is
probably 2.7.

System-wide libraries and other data are installed to /Library, which is
not typically writable to a normal user. There are versions of all of
these directories installed in your user home directory, which are
writable to you and don't require any special privileges. Skip was
saying if you can install to the directories in your home directory,
($HOME/Library/whatever instead of /Library/whatever) that is best since
it doesn't modify the system at all and so it won't get overwritten by
system updates or re-installs. If you can run without root privileges
(without sudo) and use directories in your own home directory for python
modules you should. I don't use OS X, so beyond this I am not of much
help. Perhaps other Mac users will see this thread and pipe up.

Michael Torrie

unread,
Dec 8, 2016, 7:43:06 PM12/8/16
to
You should be able to install speach recognition to the local virtualenv
also. Shouldn't need sudo now. I think, anyway.

0 new messages