[SOLVED] Python 3.4 vs 2.7 and Ubidots API


#1

I’m working in Python 3.4 on a Mac (OSX 10.11.2). I just imported ubidots 1.6.4 using pip and it installed OK.

My import statement threw an error:

from ubidots import ApiClient

Error message:

Traceback (most recent call last):
  File "Ubidots_Demo.py", line 11, in <module>
    from ubidots import ApiClient
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/ubidots/__init__.py", line 26, in <module>
    from apiclient import ApiClient, Datasource, Variable, ServerBridge, Paginator
ImportError: No module named 'apiclient'

The error message suggests that the problem is in ubidots/init.py

The Ubidots documents (http://ubidots.com/docs/libraries/python.html) say that the API is for Python 2.7. Could this be the problem or am I missing something pretty basic here. Thanks for any help.


#2

Hi, you must to use the version 1.6.5, you must update the library.

pip install -U ubidots==1.6.5

The 1.6.5 version of the library supports python 3.4 but not the previous version(1.6.4)

Best
Gustavo


#3

Gustavo: That worked! Thanks so much for the help. David


#4

Hello. I installed the ubidots libraries using the instructions on the raspberry pi tutorial but get the following error when I try to run the script - using Python 3. THe libraries are ubidots 1.6.6. Any suggestions?

Traceback (most recent call last):
File “/home/pi/ubi_test.py”, line 1, in
from ubidots import ApiClient
ImportError: No module named ‘ubidots’


#5

Works in python 2.7 - but I would like to use python 3.4. I see that the libs are in the /usr/local/lib/python2.7/dist-packages folder … how do also install on python 3. I tried pip3 but did not work. Used this for some luma.core libs and it worked.