Closed kgcubed closed 8 years ago
(sudo) pip install greg
Thanks that looks as though it worked. Now though how do I run it? Eg I would like to do greg info but that gives me "command not found". By going to the directory where it installed greg.py i can do python greg.py info but this generates errors.
$ python greg.py info
File "greg.py", line 190
file=sys.stderr, flush=True)
^ SyntaxError: invalid syntax
What is the output of which pip
and what debian are you on?
If you get "command not found" that means it didn't install correctly.
Also perhaps try running sudo pip install greg
Apologies, thought it was debian, turns out to be ubuntu (server) - Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-47-generic x86_64) which pip returns /usr/bin/pip Output of sudo pip install greg Requirement already satisfied (use --upgrade to upgrade): greg in ./.local/lib/python2.7/site-packages Requirement already satisfied (use --upgrade to upgrade): feedparser in ./.local/lib/python2.7/site-packages (from greg) Cleaning up...
There are files in ~/.local/lib/python2.7/site-packages which I think the installation process must have put there (as I originally downloaded the package to another folder and ran the installation from there)
Hi, Lee,
First, note that greg is python 3.x only. It will not work with python 2.7
(which apparently you are using). If you don't mind installing pip for python
3, sudo apt-get install python3-pip
followed by sudo pip3 install greg
should get you greg.
I don't use ubuntu; do let me know if I'm wrong about this.
Manolo
Manolo, that should be correct.
@kgcubed when you did pip install greg
it installed it locally for python2.7.
Do pip uninstall greg
to remove it, and then install python3-pip
like Manolo described.
You can use sudo pip3 install greg
to install greg globally or pip3 install --user greg
to install locally. Non-sudo installation is generally preferable.
or
pip3 install --user greg
to install locally. Non-sudo installation is generally preferable.
Yes, what Nick said!
OK gents, thanks, I think I'm getting closer now but not quite there.
Here's what I did:
pip uninstall greg
sudo apt-get install python3-pip
pip3 install --user greg
Everything looked good, the last install step reported
"Successfully installed greg feedparser"
So now, how to run it?
Doing greg info
returns "greg: command not found"
Changing directories into ~/.local/lib/python3.4/site-packages/greg
I find files have been installed, then tried python greg.py info
which fails due to the accute accent in Manolo's name:
File "greg.py", line 1
SyntaxError: Non-ASCII character '\xc3' in file greg.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
Then I changed the í to i and that gets me back to this error"
File "greg.py", line 190
file=sys.stderr, flush=True)
^
SyntaxError: invalid syntax
Is this maybe still running under python 2? Then I tried python3 greg info
which does not return an error, or indeed anything at all, but maybe this is the correct desired behaviour as I have not yet added any feeds?
Testing the theory that explicitly running with python3:
python3 greg.py add analysis http://www.bbc.co.uk/programmes/b006r4vz/episodes/downloads.rss
Does not return any error or anything at all, maybe it works.
python3 greg.py check -f analysis
also does not return any error or anything at all (I would expect a list of episodes).
So I'm kind of still thinking that it isn't working for me quite yet. Any ideas?
Many thanks!
Lee
What do you have in ~/.local/bin
? And what does echo $PATH
say?
ls -l
of ~/.local/bin
:
total 4
-rwxrwxr-x 1 lee lee 217 Jan 25 12:50 greg
echo $PATH
says
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
There you go: you need to add ~/.local/bin
to your path: add the line
PATH=$PATH:~/.local/bin
to your ~/.profile
OK, contents of file ~/.profile is now:
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
PATH=$PATH:~/.local/bin
but echo $PATH
still only returns
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
and python3 greg.py check -f analysis
still returns nothing (no errors, no nothing)
Do I need to somehow execute the newly changed ~/.profile file?
Do I need to somehow execute the newly changed ~/.profile file?
Yep, you need to source it. M
OK Manolo, how's that done? (sorry, I don't even know the basics of this, my home turf is php/javascript, when it comes to python and shell execution I'm pretty lost...)
It's done with source ;)
source ~/.profile
(sorry ...)
Don't apologize; I need to add an installation section to the README.
sorry! that worked (successfully updated $PATH)
And hurrah! It is now working,
greg add analysis http://www.bbc.co.uk/programmes/b006r4vz/episodes/downloads.rss
does its stuff and
greg check -f analysis
gives me the list of episodes
Many thanks for sticking with me through this.
(Yes an installation guide would be useful in the readme...)
Good! :)
Oh sorry I forgot you needed to add it to the path. Thanks @manolomartinez
BTW, you can add this to your profile to only add .local/bin
to PATH if it is a directory. This is the preferable method. It's best not to add .local/bin
to the path if it doesn't exist or is not a directory.
# set PATH so it includes user's .local/bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
Thanks Nick, I've changed it to the version you suggested and it's still working fine.
Thanks to all for the help!
Nick, thanks a lot for all of your help. I have accepted your changes to the README, and used your other suggestions more loosely.
I was thinking I'll add a section of contributors to the README. How would you like to be listed there (if at all)?
The addition of the installation instructions to the README is perfect! The one suggestion I have is to add also to that section:
You can retrieve the path to the configuration file (greg.conf) by doing greg retrieveglobalconf
(it took me a while to find that in the usage section, and it's sort of relevant to the installation portion which goes into the question of what is where)
Thanks again to both of you!
Lee
@manolomartinez sure that's fine if you want to add me to the contributors. Thanks
@kgcubed I added a configuration section based on your suggestion in commit 71c3ea5f97e6486dc46044730a7b4824a89fa0dc - here's what it looks like.
If Manolo approves of the changes, then it's ready to merge.
Hi Manolo
sorry to make an "issue" out of this, but could you provide a basic how-to install greg?
I'm hoping to install on a debian server, just need a few pointers...
thanks!
Lee