I successfully built python 3.7 on my raspberry pi zero. now when I run my program using:
python3 DungeonCube.py
I get the following error:
import smbus
ModuleFoundError: No module named 'smbus'
I have searched for solutions and it seems no one has gotten this far with python 3.7 on a raspberry pi. other guides say to reinstall smbus or install smbus2 and that does not work.
dpkg-query -L python3-smbus shows:
/.
/usr
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/smbus.cpython-35m-arm-
linux-gnueabihf.so
/usr/share
/usr/share/doc
/usr/share/doc/python3-smbus
/usr/share/doc/python3-smbus/changelog.Debian.gz
/usr/share/doc/python3-smbus/changelog.gz
/usr/share/doc/python3-smbus/copyright
apt-cache show python3-smbus shows:
Package: python3-smbus
Version: 3.1.2-3
Architecture: armhf
Maintainer: Aurelien Jarno <aurel32#debian.org>
Installed-Size: 31
Depends: libc6 (>=2.4), python3 (<< 3.6), python3 (>=
3.5~), python3:any (>= 3.0~)
Recommends: i2c-tools
Provides: python3.5-smbus
.
.
.
Any ideas how to get this working?
Garry O.
The python3-smbus library which is installed on your system seems a little old. It works for Python 3.5 but not for Python 3.7.
You have two solutions:
downgrade your Python to use Python 3.5
choose another library: you can try smbus2 which is more uptodate.
I don't have a RPi to test this on, but when I was in HackerSpace I also built python on R-Pi. I ran into this exact same problem and found a fix that may work for you. You will need to open the config file: "sudo nano /boot/config.txt" and add the line "dtparam=i2c_arm=on" after you save it run "sudo raspi-config". Under advanced options you will find 7l2c select "Yes".
Related
I'm installing ROS Kinetic on MacOS Sierra 10.12.6 under a seperate environment under Python Anaconda distribution.
Here is my python version(my seperate python environment in Anaconda is called "ros-kinetic"):
(ros-kinetic) jizhe#jizhedeMacBook-Pro ~/ros_catkin_ws python --version
Python 3.6.4 :: Anaconda, Inc.
I followed the guide: http://wiki.ros.org/kinetic/Installation/OSX/Homebrew/Source.
When I execute the "rosdep install" command, I got the following error:
(ros-kinetic) jizhe#jizhedeMacBook-Pro ~/ros_catkin_ws rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
actionlib: No definition of [python-wxtools] for OS [osx]
catkin: No definition of [google-mock] for OS [osx]
roslisp: No definition of [google-mock] for OS [osx]
Obviously, there is something wrong with the package "python-wxtools" and "google-mock".
I've already install the wxpython via "brew install wxpython", and here is the wxpython info:
(ros-kinetic) jizhe#jizhedeMacBook-Pro ~/ros_catkin_ws brew info wxpython
wxpython: stable 3.0.2.0 (bottled)
Python bindings for wxWidgets
https://www.wxwidgets.org/
/usr/local/Cellar/wxpython/3.0.2.0_1 (1,108 files, 37.9MB) *
Poured from bottle on 2018-02-24 at 03:56:21
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wxpython.rb
==> Dependencies
Required: wxmac ✔
==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p /Users/jizhe/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/jizhe/Library/Python/2.7/lib/python/site-packages/homebrew.pth
And I've already run the command:
$ mkdir -p ~/Library/Python/2.7/lib/python/site-packages
$ echo "$(brew --prefix)/lib/python2.7/site-packages" >> ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
So, what's wrong with the package "google-mock" and "python-wxtools", how can I solve this problem?
Try installing with --skip-keys python-wxtools --skip-keys google-mock. It worked for me.
There is a ticket for this issue. Basically the workaround is to install googletest manually. Not sure what's wrong with python-wxtools.
edit: If you're using ros-install-osx, you can add the following lines to your rosdeps.yaml file:
google-mock:
osx:
homebrew:
packages: []
I found this question from a Google search, just for your information in 2021 installing ROS in conda also on macOS should be much straightforward, see the following links:
https://medium.com/robostack/cross-platform-conda-packages-for-ros-fa1974fd1de3
https://github.com/RoboStack/ros-noetic
please, don't mark it as duplicate, because solutions to similar questions don't work for me
My system is ubuntu 16.04, I'm using python 2.7.12
What I am trying to do, is to use pdftohtml to convert pdf files to html. It seems that I could do it with poppler.
I've installed python-poppler with sudo apt-get install and it seems installed:
dpkg -s python-poppler
Package: python-poppler
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 144
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Architecture: amd64
Version: 0.12.1-8.1
Provides: python2.7-poppler
Depends: libc6 (>= 2.4), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.8.0), libpoppler-glib8 (>= 0.18.0), python (>= 2.7), python (<< 2.8), python-gtk2 (>= 2.10.0), python-gobject (>= 2.10.1), python-cairo (>= 1.8.4)
Description: Poppler Python bindings
This package includes Python bindings for LibPoppler.
It is needed to run programs written in Python and using Poppler set.
LibPoppler is a PDF rendering library based on xpdf PDF viewer, and used by
kpdf and evince PDF viewers.
Original-Maintainer: Andrea Gasparini <gaspa#yattaweb.it>
Homepage: http://launchpad.net/poppler-python
however, on import poppler it throws an import error.
What am I missing here?
Ok, the problem was my virtual env wasn't created with any parameters - so --no-site-packages was used as a default value.
when I recreated it using mkvirtualenv --system-site-packages, everything is ok.
I am running a CentOS 7.2 system, and I recently used pyenv to install Python 2.7.5. I am rather new to Linux, and I was under the impression that I should use pyenv to install Python so as not to interfere with the "system Python." Before installing pyenv, yum worked perfectly.
Now, however, when I try to use yum I get the following error:
There was a problem importing one of the python modules required to run yum. The error leading to the problem was: No module named yum. Please install a package which provides this module, or verify that the module is installed correctly.
I tried following the advice from the first reply of this post. When I type find / -type f -executable -name 'python2*', I get the following output:
~/.pyenv/shims/python2
~/.pyenv/shims/python2.7
~/.pyenv/shims/python2.7-config
~/.pyenv/shims/python2-config
~/.pyenv/shims/versions/2.7.5/bin/python2.7
~/.pyenv/shims/versions/2.7.5/bin/python2.7-config
~/.pyenv/shims/versions/2.7.5/envs/spyderenv/bin/python2.7
/usr/bin/python2.7
/usr/bin/python2.7 should clearly be the system Python, but when I run it and type 'import yum', I get ImportError: No module named yum. (And just to cover my bases, the first line of the 'yum' file is #!/usr/bin/python, and /usr/bin/python is a link to python2, and python2 is a link to python2.7)
It seems that somehow pyenv is screwing things up, but I can't figure out how. Thanks in advance for the help.
I am a CS beginner taking udemy python course and trying to install pip in order to use matplotlib, pandas and so on in pylab.
I use IDLE 3.4.2 and latest version Pycharm
Tried
1. "pip installed pylab"(version not satisfies the requirement pylab,no matching distribution found for pylab);
2.same result with sudo before the first one;
3.sudo easy_install matplotlib(succeeded in terminal, but still no matplotlib module in shell) ;
4.brew install python 3(succeeded , but still no matplotlib module in shell, and every command looks like still for 2.7)
5.Anaconda Package based on preinstalling Macports (same result as 3)
6.On cloud9.io, still can't import matplotlib
Then tried to uninstall both 2 and 3 python then install
7.brew rm -rf/Library/Frameworks/Python.framework/Versions/2.7
(error:no keg argument)
Downloaded Xcode but "block compressed payload operation failed"
Result of "brew doctor":
Warning: "config" scripts exist outside your system or Homebrew directories.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
Warning: Python is installed at /Library/Frameworks/Python.framework
Warning: You have MacPorts or Fink installed:
/opt/local/bin/port
Warning: You have unlinked kegs in your Cellar
Warning: /usr/bin occurs before /usr/local/bin
Thanks for reading!
Answer in detailed direction will be appreciated as I am just a beginner having tons of stuff to learn from you.
Really frustrated by now.
I'm trying to get nmap for Raspberry Pi, and running into errors. I'm following the instructions here:
http://nmap.org/book/inst-linux.html#inst-debian
I have alien installed. Next command was
rpm -vhU https://nmap.org/dist/nmap-6.49BETA2-1.i386.rpm
But I get this error:
pi#raspberrypi ~ $ rpm -vhU https://nmap.org/dist/nmap-6.49BETA2-1.i386.rpm
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
Retrieving https://nmap.org/dist/nmap-6.49BETA2-1.i386.rpm
error: Failed dependencies:
python >= 2.4 is needed by nmap-2:6.49BETA2-1.i386
But my version of Python is:
pi#raspberrypi ~ $ python --version
Python 2.7.3
What's going on here?
Just to explain the problem:
You have been using the wrong download:
nmap-6.49BETA2-1.i386.rpm
^^^ package format for RedHat not for Debian
^^^^ wrong architecture, the Rasberry pi is arm6 or arm7l
The package wasn't the right one but there is also the problem of dependencies. The RPM installer does not read the list of debian's installed packages properly. It is possible to ignore the dependencies by command line arguments, but in general it is better to
use a debian package
or compile from source if you need a version where there is no package for.