User avatar
TC9000
Posts: 9
Joined: Wed Jan 31, 2018 3:53 pm

My Python is stuck

Thu Jan 24, 2019 4:51 pm

hi, hope someone can help.

I've been trying to find a solution to this, tried so many things my head is spinning.......

I have a RPI 2 running a load of python for a couple of years for a home automation system, I call this "Production", all was good. It had just python version 2.7.3.

I have a rpi3 I use as a "Development" machine. It has Python 2.7.9. (I know, not clever to have different hw/sw...we live and learn)

My latest enhancement is to add Alexa control, so on the dev machine I installed Flask-ask, wrote a load of new Python and it works great.

So I've installed all the code on the production machine and so need to install Flask-ask.

I started with a >> pip install flask-ask
This gives me lots of errors about ssl, permissions etc. So after a lot of reading I think this due to the prod machine using 2.7.3. I also get other errors...I tried all sorts of things with upgrading pip....no joy.

So, on the production machine, I downloaded python 2.7.9 like this:

wget https://www.python.org/ftp/python/2.7.9 ... -2.7.9.tgz
tar -xvf Python-2.7.9.tgz
cd Python-2.7.9

./configure
make
sudo make install


so it's all installed....but when I type python, it still runs 2.7.3 and I assume the pip command is using 2.7.3 too? I've tried lots of searches and tried a few things, but no luck

I am really surprised how hard this seems to be, I thought I might just be able to do a quick upgrade of python, install flask-ask and be done, but many hours later I'm just confused and frustrated. my current plan is to ditch the pi2, move dev to production and buy a new rpi3 for dev...but this seems drastic, wasteful and will take a while.

if anyone can help, i'll be very grateful

thanks

G

robbes
Posts: 144
Joined: Sun Jan 20, 2013 7:11 pm
Location: Canada - off the west coast

Re: My Python is stuck

Thu Jan 24, 2019 6:55 pm

As you have already recognized, the issue has nothing to do with your hardware. On your production machine, if you enter

Code: Select all

$ python --version
then I imagine you will see python 2.7.3.
Can you not just use

Code: Select all

$ python2.7.9
and

Code: Select all

$ python2.7.9 - m pip
instead?

hippy
Posts: 6079
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: My Python is stuck

Thu Jan 24, 2019 7:16 pm

This maybe ... ?

sudo update-alternatives --config python

User avatar
TC9000
Posts: 9
Joined: Wed Jan 31, 2018 3:53 pm

Re: My Python is stuck

Thu Jan 24, 2019 8:17 pm

hi, thanks for the suggestions,,,

I tried these, still no luck:
$ python --version
Python 2.7.3

$sudo update-alternatives --config python
There is only one alternative in link group python (providing /usr/bin/python): /usr/bin/python2.7
Nothing to configure.


I have this in usr/bin

$ ls py*
py3clean pydoc3 python python3.2mu
py3compile pydoc3.2 python2 python3.2mu-config
py3versions pygettext python2.6 python3-config
pyclean pygettext2.6 python2.7 python3mu
pycompile pygettext2.7 python2.7-config python3mu-config
pydoc pygettext3 python3 python-config
pydoc2.6 pygettext3.2 python3.2 pyversions
pydoc2.7 pypy python3.2-config


any more ideas?

cheers

User avatar
TC9000
Posts: 9
Joined: Wed Jan 31, 2018 3:53 pm

Re: My Python is stuck

Thu Jan 24, 2019 9:17 pm

just to confirm, it is there, i can do this:

$ /home/pi/Python-2.7.9/python
Python 2.7.9 (default, Jan 23 2019, 22:07:33)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "hello"
hello


i just cant figure out how to point all the normal stuff including pip at it so i can get flask-ask working.

:cry:

robbes
Posts: 144
Joined: Sun Jan 20, 2013 7:11 pm
Location: Canada - off the west coast

Re: My Python is stuck

Thu Jan 24, 2019 9:58 pm

I was not expecting the binary to be installed in that location (my ignorance!) but you don't have to "do" anything other than invoking python with

Code: Select all

$ /home/pi/Python-2.7.9/python
Assuming pip was installed with this package, you would install flask-ask with

Code: Select all

/home/pi/Python-2.7.9/python -m pip install flask-ask
For convenience you could create an alias for /home/pi/Python-2.7.9/python in your .bashrc file.

User avatar
TC9000
Posts: 9
Joined: Wed Jan 31, 2018 3:53 pm

Re: My Python is stuck

Thu Jan 24, 2019 10:48 pm

hi, I tried that, but when I try and use pip with 2.7.9 I get this error:

$ /home/pi/Python-2.7.9/python -m pip install flask-ask
/home/pi/Python-2.7.9/python: No module named pip

so there's no pip within 2.7.9 python.

I've got pip installed, but its within 2.7.3....

$sudo apt-get install python-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-pip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

i get the feeling when i downloaded and did a make on 2.7.9 it should have put stuff in the right place but I've missed something or something went wrong. i have a backup from a few days ago before i started fiddling...perhaps i'll revert and start over.

cheers

Return to “Python”