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.
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"
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?
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.
(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.
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.