Python Forum
Problem with python installation on Linino
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with python installation on Linino
#1
I'm developing an application using a YUN shield V:2.4 (It uses an ARM processor running Linino OS which is a port of Linux via OpernWRT), its Python V:2.7 and an Arduino Mega 2560. This question is specifically about Python on the YUN shield.
I have successfully written an application using a collection of custom python modules residing in a local folder /mnt/sda1/cgi-bin. I had added PYTHONPATH=/mnt/sda1/cgi-bin to /etc/profile so that the Python system would find them. All was good until I installed the pyFirmata and pySerial packages for communication with the Mega2560 (more useful in my case than the Bridge library).

Now, Python cannot find the custom modules. Python does, indeed, still have the custom folder at the correct place in its search path as reported by a printout of sys.path.

Can anybody please suggest a fix for this problem.

Peter.
Reply
#2
When you install python, it includes all the core functionality and most used functions and methods.
You will still need to install packages for specific functionality, say PySerial: https://pypi.python.org/pypi/pyserial/3.4
and pyFirmata are two of those packages https://pypi.python.org/pypi/pyFirmata/1.0.3

To install these packages, you use pip, which doesn't come installed on your YUN.
Follow the instructions here to install pip first: http://samjbrenner.com/notes/using-pip-t...duino-yun/

once pip is installed, you can install the PySerial and pyFirmata with:
pip install pyserial
pip install pyFirmata
Reply
#3
I'm assuming that you have actually read my post, although from your reply it doesn't look like you have. Note that I have ALREADY installed those packages using the scripts (setup.py) that came with the packages. My problem is that that installation has somehow screwed with the ability of python to find my custom modules although it could find them OK before I installed those pyFirmata and pySerial.
The kindest interpretation I can put to your post is that you are saying (very clumsily) that if I reinstall the packages using PIP, it will fix the problem.
Is that the case?

Addendum to the last message.

Sam Brenner's links no longer work. YUN V:2.4 has both Python and SSL pre-installed but PIP is not part of the installation.

BTW this thread would be better named "Problem AFTER Python module installation on Arduino YUN"
Reply
#4
Quote:Now, Python cannot find the custom modules.
how did you determine that the modules cannot be found?
They should be seen in python../Lib/site-packages directory
Are they there?
Reply
#5
As Larz60+ points out, "pip" is the preferred method for installing .whl packages. It will install the requested package in the "site-package" directory of the proper Python, which might be something like:
"#:/usr/local/lib/python2.7/site-packages/".  If you do not have "pip", there a several ways of getting it. The way I use, is from the command prompt, type (note: you may need to precede the command with 'sudo'):
python -m ensurepip
then:
pip install --upgrade pip

You should be able to type:
pip -V and have the version 9.0.0.1 returned.

Then you simply invoke pip and the package you want
pip install pyserial for example.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#6
(Aug-23-2017, 12:03 AM)Larz60+ Wrote:
Quote:Now, Python cannot find the custom modules.
how did you determine that the modules cannot be found?
They should be seen in python../Lib/site-packages directory
Are they there?

My custom modules have ALWAYS been in /mnt/sda1/cgi-bin. Python could always find these modules BEFORE I installed pyFirmata and pySerial because I had put the extra path information "export PYTHONPATH=/mnt/sda1/cgi-bin" in /etc/profile which is a script the OS runs during its boot process.
As to how I know that python can no longer find my custom modules, it tells me so when my application tries to import the first custom module but finds the standard modules OK.
If I now copy one of my custom modules to /usr/lib/python2.7 (which is python's installed directory) it finds that OK. This leads me to conclude that I have a search path problem.
When I issue python with the instruction 'print sys.path' the resulting printout has my custom path near the start of the printed list, as the python reference says it should be.
Clearly, something to do with python's configuration has been corrupted, I'd like someone to tell me where that info. would be located so I can repair it.

(Aug-23-2017, 12:06 AM)sparkz_alot Wrote: As Larz60+ points out, "pip" is the preferred method for installing .whl packages. It will install the requested package in the "site-package" directory of the proper Python, which might be something like:
"#:/usr/local/lib/python2.7/site-packages/".  If you do not have "pip", there a several ways of getting it. The way I use, is from the command prompt, type (note: you may need to precede the command with 'sudo'):
python -m ensurepip
then:
pip install --upgrade pip

You should be able to type:
pip -V and have the version 9.0.0.1 returned.

Then you simply invoke pip and the package you want
pip install pyserial for example.

That would be great BUT. Linino OS is tiny (a binary to re-flash the EEPROM in which it is installed is 15.5Mb compressed including all installed utilities - including python) and it's python installation is certainly not complete as it has neither 'ensurepip', 'install' nor 'pip' packages.

Thanks anyway.
Peter.

As far as I know, pyFirmata and pySerial are not available for Linino OS as '.whl' packages. I downloaded '.zip' files, extracted them to a folder on a USB stick on a Windows machine, copied that folder into the 'site-packages' directory on the YUN then ran 'python setup.py install' from inside the folder.
Reply
#7
About pip, see post # 2 above.
Quote:Follow the instructions here to install pip first: http://samjbrenner.com/notes/using-pip-t...duino-yun/
Reply
#8
(Aug-22-2017, 11:23 PM)OldBikerPete Wrote: Addendum to the last message.

Sam Brenner's links no longer work. YUN V:2.4 has both Python and SSL pre-installed but PIP is not part of the installation.
You don't read do you!
Reply
#9
hmm, link works for me.

If you still can't get it, try the original post
http://playground.arduino.cc/Hardware/Yu...hon_module

The links(s) show how to install "pip" using "easy-install"
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#10
I can't try the links again just now, my YUN is busy upgrading itself.
I found an updated binary for the YUN ROM and am in the process of installing that now (After making a TAR archive of the entire ROM). Presumably that will overwrite everything on the YUN ROM including the Python installation and fix my problem.
I won't repeat my installation of the pyFirmata and pySerial modules - I'll persevere with the Bridge package.
Thanks for your time.
Peter.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python installation for old MacOS Yonix 1 496 Sep-21-2023, 03:32 PM
Last Post: menator01
  Installation of packages to newest Python version from previous one Andrzej_Andrzej 3 845 Jul-15-2023, 11:32 AM
Last Post: snippsat
  How to see the date of installation of python modules. newbieAuggie2019 4 1,635 Mar-31-2023, 12:40 PM
Last Post: newbieAuggie2019
  Getting "SSL client not supported by this Python installation" error prabirsarkar 0 965 Mar-13-2023, 05:01 PM
Last Post: prabirsarkar
  python installation/running inside singularity container erdemath 2 1,806 Sep-21-2022, 08:13 AM
Last Post: erdemath
Question Python V3.11 Installation Help Danno 2 1,108 Aug-11-2022, 02:30 AM
Last Post: Danno
  Portable installation of Python possible? pstein 2 3,099 Nov-15-2020, 12:14 PM
Last Post: snippsat
  python and openCV installation dejhost 16 10,843 Aug-04-2020, 02:23 AM
Last Post: snippsat
  No Scripts File present after python installation ag2207 5 4,925 Jul-30-2020, 11:11 AM
Last Post: buran
  Cannot find Python installation folder when I install Anaconda bsbsbsbs 1 2,225 Jul-14-2020, 03:14 PM
Last Post: dgrunwal

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020