I am trying to use the Python SDK for the IoT Hub by running the example code: "SimulatedDevice.py" but the code breaks on the same exception on 3 different raspbian devices as well as my PyCharm environment.
In trying to run the SimulatedDevice.py example on my Raspberry Pi, the code always breaks with an:
"ImportError: libboost_python-py27.so.1.62.0: cannot open shared object file: No such file or directory"
initial error: "import iothub_client"
I have pip installed the azure-iothub-device-client as well as confirmed the version is python2.7 even trying to reinstall python. This is curious as when I run the exact same file on my Windows CMD the SimulatedDevice.py example code functions fine, it's only in the Python terminal and on the Raspberry Pi do I get this error.
As said in this great post
1st solution
are you running raspbian stretch or jessie? You probably want stretch now. it's the latest stable and that's the one we're testing against
is the libboost-python1.62.0 package installed? if not you can install it with: apt-get install libboost-python1.62.0
2nd solution
A user [ko5win] in that link with your same problem confirmed that a fresh raspberry pi with stretch and the proper version of libboost solved the pip version issue
Another user [sergiomfsilva] gives an alternative procedure:
Environment
OS and version used
Linux raspberrypi 4.14.30-v7+ #1102 SMP Mon Mar 26 16:45:49 BST 2018 armv7l GNU/Linux
Python runtime used: Python 3.5.3
SDK version used: 1.3.1
Workaround steps used
Get images and prepare to do the work:
get last Raspbian Lite Image
flash microSD card for Raspberry Pi3
boot with raspberry pi
login with pi user
make the command
sudo su
go to root folder
cd /root
Update the system and make some time checks
Do the next commands:
apt-get update && apt-get upgrade
apt-get install ntp
Check the RPI date with the command
date
After date ok all its ready
Note: Configure ntp.conf file if date issues found
Install required packages and review the error reported
Install required packages
apt-get install -y git cmake build-essential curl libcurl4-openssl-dev libssl-dev uuid-dev python3-pip
SDK cloning
git clone --recursive https://github.com/Azure/azure-iot-sdk-python.git
Install device client package using pip3
pip3 install azure-iothub-device-client
Go to samples folder
cd azure-iot-sdk-python/device/samples/
Run the sample code
python3 iothub_client_sample.py
The error must be the same:
Traceback (most recent call last): File
"iothub_client_sample.py", line 10, in import
iothub_client File
"/usr/local/lib/python3.5/dist-packages/iothub_client/init.py",
line 1, in from .iothub_client import *
ImportError: libboost_python-py34.so.1.55.0: cannot open shared object
file: No such file or directory
Build new libraries and apply it
Go to building folder for linux
cd /root/azure-iot-sdk-python/build_all/linux
Run Setup
./setup.sh --python-version 3.5
Replace openssl dev with gnutls dev already reported like solution for a curl out of memory issue
apt remove libcurl4-openssl-dev
apt install libcurl4-gnutls-dev
build libraries
./build.sh --build-python 3.5
Go to root folder
cd /root
Move created library to python iothub_client path
mv azure-iot-sdk-python/device/samples/iothub_client.so /usr/local/lib/python3.5/dist-packages/iothub_client/iothub_client.so
Go to samples folder
cd azure-iot-sdk-python/device/samples/
Run the sample code
python3 iothub_client_sample.py
This solves the issue found and works in the raspberry. This did not solve this issue because it is related with the pip package. To solve a new pip package with library and python version updated
Related
I'm trying to run an FFT on a few high frequency bins of a continuous audio stream from a USB microphone input using a Raspberry Pi Zero W. The Windows PC prototype runs but when deploying to the Pi there are issues with "pyaudio" which does not have a Python3.7 wheel(?) for ARM, only Python3.6. The RPi OS install includes 3.7 and I think all I want to do is downgrade to 3.6. This is a fixed purpose device so virtualenv is not needed (and I had issues trying it) and can't burden the Pi Zero with Anaconda. I haven't ever built on *nix.
I installed Python3.6 and changed the python3 symlink to point to it. Running "pip3 install pyaudio" yields:
...
File "/usr/lib/python3/dist-packages/pip/_internal/locations.py", line 10, in
from distutils import sysconfig as distutils_sysconfig
ImportError: cannot import name 'sysconfig'
Multiple angles of attack seem to run into distutils sysconfig (like when I tried virtualenv). I've tried so many things (like update-alternatives) I'm probably a bit confused as to current state.
I think my question is "how to downgrade an RPi Zero W from Python 3.7 to 3.6 without breaking the environment (eg, pip)", but perhaps it's really "how do I get pyaudio in 3.7", or "is there an alternative to pyaudio".
Additional info:
python3 --version --> "Python 3.6.8"
python3 -c "import sysconfig" --> runs without complaint
sudo apt install python3-distutils --> "python3-distutils is already the
newest version (3.7.3-1)" Can I get 3.6?
pip3 install setuptools --> "ImportError: cannot import name 'sysconfig'"
This is my first stackoverflow post, apologies for breaches of etiquette.
Python 3.7 that is installed is system-wide. Is there any reason that you couldn't install Python as a unique version and run that specific installation? Typically when people want a different version they are doing an upgrade so you could search for persons who have documented that process.
Generally, you would download the project and compile it on your machine. Make a folder in your home folder, switch into it and then.
$ wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
$ tar xf Python-3.6.5.tar.xz
$ cd Python-3.6.5
$ ./configure
$ make
$ sudo make altinstall
$ which python3.6
returns
/usr/local/bin/python3.6
$ which python3
returns
/usr/bin/python3
as usual
New to MQTT and Linux world.
I am following this link to set up my Mqtt broker on Raspberry Pi 4.
after running this command
# import PackageCloud signing key
wget -O - "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" | sudo apt-key add -
and followed its instruction, I ran this:
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.python.sh | bash
All my pip install are failing.
for example:
$ pip3 install PyMail
Looking in indexes: https://pypi.org/simple, https://packagecloud.io/rabbitmq/rabbitmq-server/pypi/simple
Collecting PyMail
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://packagecloud.io/rabbitmq/rabbitmq-server/pypi/simple/pymail/
How can I fix it?
follow this link, complete and working commands for rmq setup:
And you can use pika for connecting ur rmq via python
https://computingforgeeks.com/how-to-install-latest-erlang-on-ubuntu-18-04-lts/
https://computingforgeeks.com/how-to-install-latest-rabbitmq-server-on-ubuntu-18-04-lts/
I have tried to remove my pip3 and re-install it.
Surprisingly, even after removal and re-installation, the error is still there~!!!
This is how I solved this problem:
I opened the pip configuration file which is located:(depending on different OS, the file could locate at different place. Mine is Raspbian Buster 10)
$HOME/.pip/pip.conf
In its content I saw this:
[global]
extra-index-url=https://packagecloud.io/rabbitmq/rabbitmq-server/pypi/simple
then I removed the packagecloud url and restarted my terminal.
problem solved.
I think some scripts in this file:
https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.python.sh
modified the pip config
I am trying to install a python project on a server where I don't have root access. I've managed to install virtualenv and pip locally, but the pip install is now failing when trying to install uwsgi (specifically trying to build wheel) with several error: Python.h: No such file or directory errors.
From what I've gathered I need to install python-dev, but as I don't have sudo access I've had to download and extract the python-dev package.
Where I'm stuck now is how to link python-dev to the python I've installed in my virtualenv.
Server details:
$ uname -a
4.9.0-12-amd64 #1 SMP Debian 4.9.210-1 (2020-01-20) x86_64 GNU/Linux
$ python --version
Python 3.5.3
First, could you ask your admin for help?
OK, let's summarize: python.h: No such file or directory looks like the C compiler could not find the necessary header files. Those files are contained in the python-dev package, but you are not permitted to install it. You have downloaded the package and extracted its files somewhere.
Now you should set the xx_PATH environment variables that gcc uses to find additional library and header files locations, see the docs and the example here for details and try the installation again.
Anyway this fixes only the first compilation error.
I've tried various attempts using config_site.h during build, and had little to no improvement... Still stuck at 8 accounts. Code is:
import pjsua
lib = pjsua.Lib()
lib.init()
lib.start()
transport = lib.create_transport(pjsua.TransportType.UDP)
for x in range(10):
lib.create_account_for_transport(transport)
And:
Assertion failed: (pjsua_var.acc_cnt < (sizeof(pjsua_var.acc)/sizeof(pjsua_var.acc[0]))), function pjsua_acc_add, file ../src/pjsua-lib/pjsua_acc.c, line 401.
This issue seems not only to be a PJSUA/PJSIP issue, but a platform specific issue (Mac OS X) as the (nearly) identical steps were performed on Ubuntu 15.10 and it was able to create additional accounts with no issue.
Steps completed on working Ubuntu 15.10 install:
sudo ./configure CFLAGS=-fPIC CXXFLAGS=-fPIC
sudo make dep && make
sudo make
cd pjsip-apps/src/python
sudo make
sudo python setup.py install
Note: Issues during make dep (pjsip) and sudo make (python lib) required running sudo make and sudo python setup.py install again to properly complete install.
These same steps, completed on a Mac OS X 10.11 platform, does not allow for additional transports nor additional accounts to be created. Will attempt a second question specifically addressing transports.
I should do for my master thesisi some tutorials for administrators how to set, manage and use openstack.
On my workstation 9 I set ubuntu server x64 12.04 lts, then I try to do quick istall by devstack http://devstack.org/. I am usinh NAT.
So I typed terminal:
git clone https://github.com/openstack-dev/devstack.git
cd devstack && ./stack.sh
After runing stack.sh dscript in shows me error:
Could not open requirements file: [Errno2] No such file or directory: '*-info/requires.txt'
Storing complete log in /home/robetr/.pip/pip.log
+sudo HTTP_PROXY=HTTPS_PROXY=python setup.py develop
paython: can't open file setup.py': [Errno 2] No such file or directory
++ failed
+local r=2
+set +o xtrace
After that I tried with:
sudo
make update
make upadete & apgrade here where installing more then 250mb of new updates and so on
then I make
sudo apt-get install python-setuptools
then
sudo easy_install
sudo easy_install BeautifulSoup
sudo aptitude install python-beautifulsoup
then I actualy find setup.py in opt/stack/python-openstackclient/setup.py
Then some thing instaled, upgrade and so on. But one again ewhen I tried to run in devstack/stack.sh script in broke down.
I waste 2 days to play with this and didn't come far. Have any ideas?
Regards, Robert