python error

Lisa Kachold lisakachold at obnosis.com
Wed Mar 21 05:37:11 MST 2012


On Wed, Mar 21, 2012 at 12:35 AM, Michael Havens <bmike1 at gmail.com> wrote:

> > Did you add the paths for python to your .bashrc as I suggested?
>
> When did you suggest it? I  must have missed it.
> Here is my bashrc:
> Do you mean this:
> [[ -s $HOME/.pythonbrew/etc/bashrc ]] && source
> $HOME/.pythonbrew/etc/bashrc
>

Yes, that's a path entry.

$HOME is a built in path that refers to your $HOME or /home/bmike1

And there is no file there; which is why you get the error "no such file or
directory"

>
> That is the only line in my bashrc and that is what you told me to put
> in there. Did I do that wrong? Is that a PATH?
>
> This is weird; look at what happened in the shell:
>
>   bmike1 at Michaels-Laptop ~ $ sudo su
>   [sudo] password for bmike1:
>    Traceback (most recent call last):
>

This is the known python virtualenv error (that we tried to fix with
pythonbrew:

>> >>> >> >> bmike1 at Michaels-Laptop ~ $ sudopybrew venv use proj
>> >>> >> >> # Using `proj` environment (found in
>> >>> >> >> /home/bmike1/.pythonbrew/venvs/Python-2.7.2)
>> >>> >> >> # To leave an environment, simply run `deactivate`
>> >>> >> >> bash: /home/bmike1/.pythonbrew/etc/venv.run: Permission denied

Did you also make sure that that /home/bmike1/.pythonbrew/etc/venv.run
exists and is writable?

$ ls -al /home/bmike1/.pythonbrew/etc/venv.run
$ chmod ug+ /home/bmike1/.pythonbrew/etc/venv.run



>     File "<string>", line 1, in <module>
>   ImportError: No module named virtualenvwrapper.hook_loader
>
  virtualenvwrapper.sh: There was a problem running the initialization
> hooks.
>


>   If Python could not import the module virtualenvwrapper.hook_loader,
> check
>   that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON=/usr
>    /bin/python and that PATH is  set properly.
>

What is your complete /home/bmike1/.bashrc?

   Michaels-Laptop bmike1 # nano ~/.bashrc
>   Michaels-Laptop bmike1 # su bmike1
>   mkdir: cannot create directory `/root': Permission denied
>

I am not sure until I see your complete /home/bmike1/.bashrc  - this is the
file that is invoked to initiate and setup your shell.


>   bmike1 at Michaels-Laptop ~ $ nano ~/.bashrc
>
> Why did it try to make a directory when I switched back to my regular
> user??
>

Mike, use the correct command syntax.  You usually don't WORK as root,
since you will change a lot of permissions.

You work as bmike1, and use the sudo command in front of any command that
root will be required:

EXAMPLES:

sudo /bin/bash
sudo nano /etc/ssh/sshd

you then use "exit" to return to your bmike1 from the shell.

>
> > Did you try running a new terminal after you ran python the first time?
>
> What do you mean?
>

After each TEST or change of files, you would logout and log back in -
completely to see if your shell python error was fixed?

>
> >
> >
> > On 20 Mar 2012 17:32, "Michael Havens" <bmike1 at gmail.com> wrote:
> >>
> >> I get the error with 'sudo su'
> >>
> >> On Tue, Mar 20, 2012 at 5:31 PM, Michael Havens <bmike1 at gmail.com>
> wrote:
> >> > On Tue, Mar 20, 2012 at 5:03 PM, Lisa Kachold <
> lisakachold at obnosis.com>
> >> > wrote:
> >> >
> >> >> Can you (as bmike1) run:
> >> >>
> >> >> $ /usr/bin/python -v
> >> >
> >> > It runs but a lot of stuff pops up before you get to the prompt.
> >> >  $ /usr/bin/python -v
> >> > # installing zipimport hook
> >> > import zipimport # builtin
> >> > # installed zipimport hook
> >> > # /usr/lib/python2.7/site.pyc matches /usr/lib/python2.7/site.py
> >> > import site # precompiled from /usr/lib/python2.7/site.pyc
> >> > # /usr/lib/python2.7/os.pyc matches /usr/lib/python2.7/os.py
> >> > import os # precompiled from /usr/lib/python2.7/os.pyc
> >> > import errno # builtin
> >> > import posix # builtin
> >> > # /usr/lib/python2.7/posixpath.pyc matches
> >> > /usr/lib/python2.7/posixpath.py
> >> > import posixpath # precompiled from /usr/lib/python2.7/posixpath.pyc
> >> > # /usr/lib/python2.7/stat.pyc matches /usr/lib/python2.7/stat.py
> >> > import stat # precompiled from /usr/lib/python2.7/stat.pyc
> >> > # /usr/lib/python2.7/genericpath.pyc matches
> >> > /usr/lib/python2.7/genericpath.py
> >> > import genericpath # precompiled from
> /usr/lib/python2.7/genericpath.pyc
> >> > # /usr/lib/python2.7/warnings.pyc matches
> /usr/lib/python2.7/warnings.py
> >> > import warnings # precompiled from /usr/lib/python2.7/warnings.pyc
> >> > # /usr/lib/python2.7/linecache.pyc matches
> >> > /usr/lib/python2.7/linecache.py
> >> > import linecache # precompiled from /usr/lib/python2.7/linecache.pyc
> >> > # /usr/lib/python2.7/types.pyc matches /usr/lib/python2.7/types.py
> >> > import types # precompiled from /usr/lib/python2.7/types.pyc
> >> > # /usr/lib/python2.7/UserDict.pyc matches
> /usr/lib/python2.7/UserDict.py
> >> > import UserDict # precompiled from /usr/lib/python2.7/UserDict.pyc
> >> > # /usr/lib/python2.7/_abcoll.pyc matches /usr/lib/python2.7/_abcoll.py
> >> > import _abcoll # precompiled from /usr/lib/python2.7/_abcoll.pyc
> >> > # /usr/lib/python2.7/abc.pyc matches /usr/lib/python2.7/abc.py
> >> > import abc # precompiled from /usr/lib/python2.7/abc.pyc
> >> > # /usr/lib/python2.7/_weakrefset.pyc matches
> >> > /usr/lib/python2.7/_weakrefset.py
> >> > import _weakrefset # precompiled from
> /usr/lib/python2.7/_weakrefset.pyc
> >> > import _weakref # builtin
> >> > # /usr/lib/python2.7/copy_reg.pyc matches
> /usr/lib/python2.7/copy_reg.py
> >> > import copy_reg # precompiled from /usr/lib/python2.7/copy_reg.pyc
> >> > # /usr/lib/python2.7/traceback.pyc matches
> >> > /usr/lib/python2.7/traceback.py
> >> > import traceback # precompiled from /usr/lib/python2.7/traceback.pyc
> >> > # /usr/lib/python2.7/sysconfig.pyc matches
> >> > /usr/lib/python2.7/sysconfig.py
> >> > import sysconfig # precompiled from /usr/lib/python2.7/sysconfig.pyc
> >> > # /usr/lib/python2.7/re.pyc matches /usr/lib/python2.7/re.py
> >> > import re # precompiled from /usr/lib/python2.7/re.pyc
> >> > # /usr/lib/python2.7/sre_compile.pyc matches
> >> > /usr/lib/python2.7/sre_compile.py
> >> > import sre_compile # precompiled from
> /usr/lib/python2.7/sre_compile.pyc
> >> > import _sre # builtin
> >> > # /usr/lib/python2.7/sre_parse.pyc matches
> >> > /usr/lib/python2.7/sre_parse.py
> >> > import sre_parse # precompiled from /usr/lib/python2.7/sre_parse.pyc
> >> > # /usr/lib/python2.7/sre_constants.pyc matches
> >> > /usr/lib/python2.7/sre_constants.py
> >> > import sre_constants # precompiled from
> >> > /usr/lib/python2.7/sre_constants.pyc
> >> > # /usr/lib/python2.7/sitecustomize.pyc matches
> >> > /usr/lib/python2.7/sitecustomize.py
> >> > import sitecustomize # precompiled from
> >> > /usr/lib/python2.7/sitecustomize.pyc
> >> > # /usr/lib/python2.7/dist-packages/apport_python_hook.pyc matches
> >> > /usr/lib/python2.7/dist-packages/apport_python_hook.py
> >> > import apport_python_hook # precompiled from
> >> > /usr/lib/python2.7/dist-packages/apport_python_hook.pyc
> >> > import encodings # directory /usr/lib/python2.7/encodings
> >> > # /usr/lib/python2.7/encodings/__init__.pyc matches
> >> > /usr/lib/python2.7/encodings/__init__.py
> >> > import encodings # precompiled from
> >> > /usr/lib/python2.7/encodings/__init__.pyc
> >> > # /usr/lib/python2.7/codecs.pyc matches /usr/lib/python2.7/codecs.py
> >> > import codecs # precompiled from /usr/lib/python2.7/codecs.pyc
> >> > import _codecs # builtin
> >> > # /usr/lib/python2.7/encodings/aliases.pyc matches
> >> > /usr/lib/python2.7/encodings/aliases.py
> >> > import encodings.aliases # precompiled from
> >> > /usr/lib/python2.7/encodings/aliases.pyc
> >> > # /usr/lib/python2.7/encodings/utf_8.pyc matches
> >> > /usr/lib/python2.7/encodings/utf_8.py
> >> > import encodings.utf_8 # precompiled from
> >> > /usr/lib/python2.7/encodings/utf_8.pyc
> >> > Python 2.7.2+ (default, Oct  4 2011, 20:03:08)
> >> > [GCC 4.6.1] on linux2
> >> > Type "help", "copyright", "credits" or "license" for more information.
> >> > dlopen("/usr/lib/python2.7/lib-dynload/readline.so", 2);
> >> > import readline # dynamically loaded from
> >> > /usr/lib/python2.7/lib-dynload/readline.so
> >> >>>>
> >> >
> >> >> Now try your original failing commands and see if you still get a
> >> >> python
> >> >>> > error?
> >> >>>  I still get the same error but it appears whenever I open a shell.
> I
> >> >>> don't issue any commands.
> >> >>>
> >> >> Is that when you run a root /bin/bash or shell? Or is that when you
> run
> >> >> a
> >> >> bmike1 /bin/bash?
> >> >>
> >> > <cnt><alt>T from user account to get the terminal up and this appears:
> >> > Traceback (most recent call last):
> >> >  File "<string>", line 1, in <module>
> >> > ImportError: No module named virtualenvwrapper.hook_loader
> >> > virtualenvwrapper.sh: There was a problem running the initialization
> >> > hooks. If Python could not import the module
> >> > virtualenvwrapper.hook_loader, check that virtualenv has been
> >> > installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH
> >> > is set properly.
> >> > bmike1 at Michaels-Laptop ~ $
> >> >
> >> >> Did you do this step:
> >> >>
> >> >>
> >> >>> It looks like your .bashrc is messed up:
> >> >>> Please move your .bashrc to a backup file:
> >> >>>
> >> >>> # cd ~ | mv .bashrc bashrc-old
> >> >>> # sudo su
> >> > I didn't see that.
> >> > do you want me to move it to the new name or copy it to the new name?
> >> >
> >> >>
> >> >> Does sudo su also give you the error?
> >> >>
> >> >> You can obviously ignore the error?  Python is used for a great
> number
> >> >> of
> >> >> things, so you can't remove it.  You can have more that one.
> >> >>
> >> >> The reason you get the bash errors is due to the virtvenv errors
> (which
> >> >> are
> >> >> a known issue).
> >> >>
> >> >> Did you do an apt-get update, etc?
> >> >>>
> >> >>>
> >> >>>
> >> >>> >
> >> >>> >>
> >> >>> >> ls: cannot access
> >> >>> >>
> >> >>> >>
> >> >>> >>
> >> >>> >>
> /home/bmike1/.pythonbrew/bin:/home/bmike1/.pythonbrew/pythons/Python-2.7.2/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/python:
> >> >>> >> No such file or directory
> >> >>> >> bmike1 at Michaels-Laptop ~ $
> >> >>> >>
> >> >>> >>
> >> >>> >> On Tue, Mar 20, 2012 at 12:04 PM, Lisa Kachold
> >> >>> >> <lisakachold at obnosis.com>
> >> >>> >> wrote:
> >> >>> >> > This is all basic linux user group file permissions, I think.
> >> >>> >> >
> >> >>> >> > On Sun, Mar 18, 2012 at 10:52 AM, Michael Havens
> >> >>> >> > <bmike1 at gmail.com>
> >> >>> >> > wrote:
> >> >>> >> >>
> >> >>> >> >> Welp.... none of that worked. (see below) Maybe I should
> apt-get
> >> >>> >> >> remove python. But what about the one I got with curl?
> >> >>> >> >>
> >> >>> >> >> > 1) How many python installs do you find?
> >> >>> >> >> >
> >> >>> >> >> > # locate python |more
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > # sudo locate python | more
> >> >>> >> >
> >> >>> >> > You should see the location and version of your python.
> >> >>> >> >
> >> >>> >> > # sudo which python
> >> >>> >> >
> >> >>> >> > You should see the python and path.
> >> >>> >> >
> >> >>> >> > # ls -al $PATH/python
> >> >>> >> >
> >> >>> >> > You should see if you have user permissions to run it (drop the
> >> >>> >> > results
> >> >>> >> > into
> >> >>> >> > this email reply):
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >>
> >> >>> >> >> nothing  returned? How strange! I know there must be at least
> >> >>> >> >> one
> >> >>> >> >> because:
> >> >>> >> >>
> >> >>> >> >>     bmike1 at Michaels-Laptop ~ $ sudopybrew install -n -v -j2
> >> >>> >> >> 2.7.2
> >> >>> >> >>     You are already installed `Python-2.7.2`
> >> >>> >> >>
> >> >>> >> >> Do you want me to apt-get python?
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > No it says you are already installed.
> >> >>> >> >>
> >> >>> >> >>
> >> >>> >> >> >
> >> >>> >> >> > 2) What is your PATH now?  After you edited your .bashrc to
> >> >>> >> >> > add
> >> >>> >> >> > the
> >> >>> >> >> > environmental variable did you invoke it?
> >> >>> >> >> >
> >> >>> >> >> > # /bin/bash
> >> >>> >> >> >
> >> >>> >> >> bmike1 at Michaels-Laptop ~ $ sudo /bin/bash
> >> >>> >> >> Traceback (most recent call last):
> >> >>> >> >>  File "<string>", line 1, in <module>
> >> >>> >> >> ImportError: No module named virtualenvwrapper.hook_loader
> >> >>> >> >> virtualenvwrapper.sh: There was a problem running the
> >> >>> >> >> initialization
> >> >>> >> >> hooks. If Python could not import the module
> >> >>> >> >> virtualenvwrapper.hook_loader, check that virtualenv has been
> >> >>> >> >> installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and
> that
> >> >>> >> >> PATH
> >> >>> >> >> is set properly.
> >> >>> >> >> Michaels-Laptop ~ # su bmike1
> >> >>> >> >> Traceback (most recent call last):
> >> >>> >> >>  File "<string>", line 1, in <module>
> >> >>> >> >> ImportError: No module named virtualenvwrapper.hook_loader
> >> >>> >> >> virtualenvwrapper.sh: There was a problem running the
> >> >>> >> >> initialization
> >> >>> >> >> hooks. If Python could not import the module
> >> >>> >> >> virtualenvwrapper.hook_loader, check that virtualenv has been
> >> >>> >> >> installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and
> that
> >> >>> >> >> PATH
> >> >>> >> >> is set properly.
> >> >>> >> >> bmike1 at Michaels-Laptop ~ $ $PATH
> >> >>> >> >> bash:
> >> >>> >> >>
> >> >>> >> >>
> >> >>> >> >>
> >> >>> >> >>
> /home/bmike1/.pythonbrew/bin:/home/bmike1/.pythonbrew/pythons/Python-2.7.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
> >> >>> >> >> No such file or directory
> >> >>> >> >> bmike1 at Michaels-Laptop ~ $
> >> >>> >> >>
> >> >>> >> > It looks like your .bashrc is messed up:
> >> >>> >> > Please move your .bashrc to a backup file:
> >> >>> >> >
> >> >>> >> > # cd ~ | mv .bashrc bashrc-old
> >> >>> >> > # sudo su
> >> >>> >> >
> >> >>> >> > What do you see now - please drop it into this email.
> >> >>> >> >
> >> >>> >> >>
> >> >>> >> >> > 3) A child process can't fork here, so bash can't run or
> write
> >> >>> >> >> > to
> >> >>> >> >> > venv.run
> >> >>> >> >> > (known error).  I would try it simply with:
> >> >>> >> >> >
> >> >>> >> >> > sudo pythonbrew venv use proj
> >> >>> >> >>
> >> >>> >> >> bmike1 at Michaels-Laptop ~ $ sudo pythonbrew venv use proj
> >> >>> >> >> sudo: pythonbrew: command not found
> >> >>> >> >> bmike1 at Michaels-Laptop ~ $ sudopybrew venv use proj
> >> >>> >> >> # Using `proj` environment (found in
> >> >>> >> >> /home/bmike1/.pythonbrew/venvs/Python-2.7.2)
> >> >>> >> >> # To leave an environment, simply run `deactivate`
> >> >>> >> >> bash: /home/bmike1/.pythonbrew/etc/venv.run: Permission denied
> >> >>> >> >> (proj)bmike1 at Michaels-Laptop ~ $
> >> >>> >> >>
> >> >>> >> > # sudo locate pythonbrew
> >> >>> >> >
> >> >>> >> > # sudo /pathyouseeabove/pythonbrew venv use proj
> >> >>> >> >
> >> >>> >> > Looks like your home permissions are all fouled up?
> >> >>> >> >
> >> >>> >> > # cd ~/bmike1 | chown -R bmike1:bmike1 .
> >> >>> >> > # cd ~bmike1 | chown -r ug+rwx .
> >> >>> >> > # cd ~bmike1 | chmod -r ug+rwx .pythonbrew/
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> >
> >> >>> >> > ---------------------------------------------------
> >> >>> >> > PLUG-discuss mailing list -
> PLUG-discuss at lists.plug.phoenix.az.us
> >> >>> >> > To subscribe, unsubscribe, or to change your mail settings:
> >> >>> >> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >> >>> >>
> >> >>> >>
> >> >>> >>
> >> >>> >> --
> >> >>> >> :-)~MIKE~(-:
> >> >>> >> ---------------------------------------------------
> >> >>> >> PLUG-discuss mailing list -
> PLUG-discuss at lists.plug.phoenix.az.us
> >> >>> >> To subscribe, unsubscribe, or to change your mail settings:
> >> >>> >> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> > --
> >> >>> > (503) 754-4452 Android
> >> >>> > (623) 239-3392 Skype
> >> >>> > (623) 688-3392 Google Voice
> >> >>> > **
> >> >>> > it-clowns.com
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> >
> >> >>> > ---------------------------------------------------
> >> >>> > PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> >> >>> > To subscribe, unsubscribe, or to change your mail settings:
> >> >>> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> :-)~MIKE~(-:
> >> >>> ---------------------------------------------------
> >> >>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> >> >>> To subscribe, unsubscribe, or to change your mail settings:
> >> >>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> (503) 754-4452 Android
> >> >> (623) 239-3392 Skype
> >> >> (623) 688-3392 Google Voice
> >> >> **
> >> >> it-clowns.com
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> ---------------------------------------------------
> >> >> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> >> >> To subscribe, unsubscribe, or to change your mail settings:
> >> >> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >> >
> >> >
> >> >
> >> > --
> >> > :-)~MIKE~(-:
> >>
> >>
> >>
> >> --
> >> :-)~MIKE~(-:
> >> ---------------------------------------------------
> >> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> >> To subscribe, unsubscribe, or to change your mail settings:
> >> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> >
> >
> > ---------------------------------------------------
> > PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> > To subscribe, unsubscribe, or to change your mail settings:
> > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
>
>
> --
> :-)~MIKE~(-:
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>



-- 
(503) 754-4452 Android
(623) 239-3392 Skype
(623) 688-3392 Google Voice
**
it-clowns.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20120321/eca001b1/attachment.html>


More information about the PLUG-discuss mailing list