import serial - Linux Mint 17, 64-bit, python3.5 - import

I am going to be asking a question that seems to have been asked numerous times. However, all of the solutions posted in the others, seems to not be working. This leads me to believe that my problem may be system related, but I'm not an expert.
I am a newbie to Python, but not to Linux, and not a newbie to software by any means.
I am running Linux Mint, 17.3 (Rosa), 64-bit, and have recently installed Python3.5 per https://www.reddit.com/r/linuxquestions/comments/3nbfdx/how_to_upgrade_from_python_27_to_35_linux_mint/ and that seems to have worked.
Python 3.5.0 (default, Nov 19 2016, 10:27:39)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
When running:
pip list | grep pyserial
I get the following:
pyserial (2.6)
My problem is simply this: I can't run the following pyPractice.py file:
import serial
...with the following cli prompt:
me#machine /home/me/Desktop/practice $ python3.5 pyPractice.py
I have tried many solutions, such as those posted in the following locations, but all seem to have failed for one reason or another:
1) pyserial, ImportError: No module named serial
RESULT-> pyserial is already installed, as you can see above. When I tried to install 'serial', no dice, not recognized
me#machine /home/me/Desktop/practice $ sudo pip install serial
[sudo] password for me:
Downloading/unpacking serial
Could not find any downloads that satisfy the requirements serial
Cleaning up...
No distributions at all found for serial
Storing debug log for failure in /home/me/.pip/pip.log
2) Python ImportError: No module named serial
RESULT-> nearly the same as above. Near the end, the proposed fix is to type:
sudo apt-get install python3-serial
However, I get the following:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-serial is already the newest version.
The following package was automatically installed and is no longer required:
php5
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 379 not upgraded.
3) Serial import python
RESULT-> No sure...I started to look at this option, but wouldn't you know it, there isn't a serial in my python3.5 packages. So, even if I did have a path correct, I wouldn't know where to start.
I am pretty new to Python, so feel free to take me back to basics. I am not adverse to reading, so links to sites which explain your thoughts are acceptable. I am pretty handy with Linux.
[somewhat useless side note: I am trying to start out slow, but am trying to work through running a simple cube drawing script, which was found here ]

In your first method there are two errors: for Python 3 you should use the command pip3, and the module is called pyserial.
As for the second method, maybe the package has been installed improperly. Try to remove it and install again, maybe with the option --reinstall. Also maybe the command sudo dpkg-reconfigure python3-serial would help.

Related

dpkg: why does instdir need admindir parameter on Mint 21

We create a Debian package of our application using CPack which can be installed on Linux Mint 19 like this:
$ sudo dpkg -i --instdir=/opt myapp.deb
With Linux Mint 21 the (installed) dependencies are not resolved:
dpkg: dependency problems prevent configuration of myapp:
myapp depends on libsqlite3-0 however:
Package libsqlite3-0 is not installed.
...
After reading the dpkg man page I set the admindir parameter and the installation succeeds:
$ sudo dpkg -i --instdir=/opt --admindir=/var/lib/dpkg/ myapp.deb
If I do not set admindir to /var/lib/dpkg/ then the right environment is not found. Why is that? And why did it work without admindir on Mint 19? Using parameter root does not help because it expects the administrative directory to be a subdirectory of the instdir.
This is a bug, which seems I introduced in dpkg 1.21.0. I'll be preparing a fix and regression tests for dpkg 1.21.10 which should hit Debian unstable in few days I guess. For Mint, which seems to be based on Ubuntu, you'd need to request the Ubuntu people to consider including that fix once it's in Debian unstable, and then the Mint people to do the same. Otherwise you can specify both options as a workaround for now. :/
Please feel free to report this kind of problems upstream in the bug tracking system next time, I just happened to see this by accident today. :)

Error: No module named 'PyQt5.sip' - When installing eric6-19.03

I have noticed a number of similar questions on stackoverflow, but none that really helped me with my current challenge. I have been attempting to install eric6 on my Raspberry Pi setup. And then I encountered the following messages:
Checking dependencies
Python Version: 3.6.8
PyQt5 could not be detected.
Error: No module named 'PyQt5.sip'
Shall 'PyQt5' be installed using pip? (Y/n) Y
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: PyQt5 in /usr/local/lib/python3.6/site-packages (5.12)
Sorry, please install PyQt5.
Error: No module named 'PyQt5.sip'
And when I attempt to use the pip list to look at what has been installed (as I previously already managed to make and install the PyQt5 from source code):
Package Version
---------- -------
pip 19.0.3
PyQt5 5.12
setuptools 40.6.2
sip 4.19.14
So, how do I overcome the issue that I am currently facing? By the way, I am using the following command when attempting to install eric6:
python3 install.py
Thought you might need to know that if it helps.
Python 3.6 isn't available in any Raspbian distribution, so I assume you installed this yourself. You can't install an out-of-distribution Python version and expect distribution Python packages to work. You have PyQt5 installed, yes, but it's the version of PyQt built for Python 3.5 (I'm assuming you're on Raspbian Stretch).
Sometimes you can install Python libraries with pip, and in theory that could work to install the correct version of PyQt for your version of Python, but PyQt only provides wheels for x86 on PyPI, not for Arm, so PyQt is not pip installable on the Pi. The only way to get PyQt on Raspberry Pi is via apt, where your choices are Jessie (old stable - with Python 3.4), Stretch (current stable - with Python 3.5), and Buster (unstable/testing - with Python 3.7). If there's a need for Python >3.5, your best bet is to try upgrading to Buster, but bear in mind it's not ready for release yet.

Error with installing pygame with pip

The following is the EXACT output when running the command sudo python -m pip install pygame on raspberry pi:
Collecting pygame
Using cached pygame-1.9.3.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "config.py"
Using UNIX configuration...
Hunting dependencies...
SDL : found 1.2.15
FONT : found
IMAGE : found
MIXER : found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: not found
PORTTIME: not found
FREETYPE: found 2.5.2
Missing dependencies
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-nOupZN/pygame/
I have tried installing pygame in ways without using pip but all of them fail in other ways and I think this problem may be the easiest to fix. I don't mind the missing dependencies. I know error code 1 is "operation not permitted" error, but i did use sudo, so I don't know why this comes up. I apologize for having so much code, but I wanted to provide as much information as possible. I have no idea what the problem is, but if anyone can help it would be a lifesaver.
Notes:
The last line of the output appears in red text in the shell
nOupZN is probably just random; I've tried installing multiple times and that part changes each time
I am using python 2.7.9 and do not wish to switch
I have recently upgraded pip
The error still occurs even when using the --user flag
The error still occurs even when running sudo su beforehand
sudo apt-get install python3-pygame
I've been struggling to learn the right way to install stuff on my Pi too. I've just started this past year, and pretty much new to linux. I've converged on this technique working most of the time.

yum command : python version mismatch

I have Red Hat Linux (Red Hat Enterprise Linux Server release 6.5 (Santiago) ) and yum in not working with message
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.8 (default, Nov 7 2014, 11:45:08)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
Current version of python is 2.7.8
Any help is appreciated.
CentOS 6 ships with python 2.6. Someone installed an incompatible version of python system-wide and that has broken things. That should not have been done.
You need to find out how the 2.7 version of python was installed and fix that (by removing the incorrect package or by removing the source-installed python or by fixing the $PATH or whatever else is appropriate).
To help figure out what the problem is exactly we need the output from the following commands (as a start).
What does rpm -qa python\* say?
What does which -a python say?

Why can't I install DBD::mysql so I can use it with Maatkit?

I'm trying to install Maatkit following the maatkit instructions. I can't get past having to install DBD::mysql. "Warning: prerequisite DBD::mysql 1 not found."
When I try to install DBD::mysql from cpan, I get very helpful "make had returned bad status, install seems impossible".
Perl is "v5.8.8 built for darwin-thread-multi-2level", the one that came with OS X. I also tried building from source with same result.
We need more of the error message. Most likely, you are missing the MySQL client development files. I don't know how to install these on OSX. Also see this older post on OSX 10.5.2 , in which some other failures with the mysql client libraries are found.
Possibly post this question with more parts of your error message at perlmonks.org, if stackoverflow doesn't allow for convenient pasting of your make session or rather the last 20 or 10 lines of it.
Some more Googling with site:perlmonks.org also finds this post which has some more details on things to watch out for when installing DBD::MySQL. Depending on how comfortable you feel with the installation, you might want to manually run the tests, supplying a test database and test user or even skip testing the module.
After a bit more googling, this worked for me:
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
sudo ln -s /usr/local/mysql/include /usr/local/mysql/include/mysql
sudo perl -MCPAN -e 'install Bundle::DBD::mysql'
press enter a bunch of times, then in your maatkit folder:
perl Makefile.PL
sudo make install
and you'll find the mk-* programs in /usr/local/bin/
You will want to install MySQL first. I usually use the binary packages they provide for OS X. The packages do include the headers and MySQL client libraries which DBD::MySQL requires. Once the MySQL package is installed, DBD::MySQL should install without issue.
Here is my output:
$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite DBD::mysql 1 not found.
Writing Makefile for maatkit
$ mysql --version
mysql Ver 14.12 Distrib 5.0.51b, for apple-darwin9.0.0b5 (i686) using readline 5.0
I notice that there are in effect DBD::MySQL packages in the fink repositories. For example:
ayaz#ayazs-macbook$ fink list | grep -i 'dbd-mysql'
dbd-mysql-pm586 3.0008-10 Perl5 Database Interface to MySQL
dbd-mysql-pm588 3.0008-10 Perl5 Database Interface to MySQL
Perhaps installing through fink one of those packages may help alleviate your troubles.
Also, and I cannot be certain of this, you may want to install for MySQL-5.x (if you have that version installed) the mysql15-dev and mysql15-shlibs packages. I installed those through fink thus:
$ sudo fink --use-binary-dist install mysql15-dev