pylibftdi not working python3, works fine on python2.7 - python-3.4

Hello there #codedstructure,
I'm able to import the pylibftdi module and list my FTDI devices using python (2.7) and have installed pylibftdi using pip3, but running the list_devices example outputs nothing:
pi#raspberrypi:~ $ python -m pylibftdi.examples.list_devices
FTDI:FT230X Basic UART:DA00TWHT
FTDI:FT230X Basic UART:DA00TWHN
FTDI:FT230X Basic UART:DA00TN7R
pi#raspberrypi:~ $ python3 -m pylibftdi.examples.list_devices
pi#raspberrypi:~ $
Running python 3.4, I can show libftdi is installed:
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pylibftdi import Driver; print(Driver().libftdi_version())
libftdi_version(major=1, minor=0, micro=0, version_str=b'1.0', snapshot_str=b'v1.0')
Is there something else I can check?

Solution found:
Needed to modify the driver.py file in my python 3 dist-packages folder to recognize the FTDI devices (from Atlas Scientific).
Specifically, pylibftdi needed some tweaking to see USB PID (0x6015)
sudo nano /usr/local/lib/python3.4/dist-packages/pylibftdi/driver.py
Move down to the line 70 and add 0x6015 at the end of line.
Modified line:
USB_PID_LIST = [0x6001, 0x6010, 0x6011, 0x6014, 0x6015]
This was done for the install of pylibftdi on python 2.7, but overlooked when installing pylibftdi for python 3.x.
Problem solved!!

Related

'MSIAuthentication' object has no attribute 'get_token'

On Azure ML Workspace Notebook, I'm trying to get my workspace instance, as seen at
https://learn.microsoft.com/en-us/azure/machine-learning/tutorial-auto-train-models#configure-workspace.
I have a config file and I am running the notebook in an Azure compute instance.
I tried to execute Workspace.from_config().
As a result, I'm getting the 'MSIAuthentication' object has no attribute 'get_token' error.
I tried to submit both MsiAuthentication and InteractiveLoginAuthentication, as suggested in
https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/manage-azureml-service/authentication-in-azureml/authentication-in-azureml.ipynb.
There are 2 solutions I've found:
1.- Use the kernel "Python 3.6 - AzureML"
2.- pip install azureml-core --upgrade
This will upgrade
azureml-core to 1.32.0
But will downgrade:
azure-mgmt-resource to 13.0.0 (was 18.0.0)
azure-mgmt-storage down to 11.2.0 (was 18.0.0)
urllib3 to 1.26.5 (was 1.26.6)
This upgrade / downgrade allows the same package versions as in the python 3.6 anaconda install

Bokeh server is not recognized

Trying to run simple app from Kevin Jolly's Hands-On Data Visualization with Bokeh Packt.
#Import the required packages
from bokeh.layouts import widgetbox
from bokeh.models import Slider
from bokeh.io import curdoc
#Create a slider widget
slider_widget = Slider( start = 0, end = 100, step = 10, title = 'Single Slider')
#Create a layout for the widget
slider_layout = widgetbox( slider_widget)
#Add the slider widget to the application
curdoc(). add_root( slider_layout)
Then tried to start bokeh server:
...\Python_Scripts\Sublime> bokeh serve --show bokeh.py
bokeh : The term 'bokeh' is not recognized as the name of a cmdlet, function, script file, or operable program.
bokeh info
Python version : 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
IPython version : 7.8.0
Tornado version : 6.0.3
Bokeh version : 1.3.4
BokehJS static path : C:\Users\k S\Anaconda3\lib\site-packages\bokeh\server\static
node.js version : (not installed)
npm version : (not installed)
Previous post with same problem did not provide working solution, please help.
First I would strongly suggest renaming your file to something other than bokeh.py. Due to the way Python itself works, this can sometimes result in Python trying to load the wrong module.
It's exceedingly strange that bokeh info could work but bokeh serve would not, since they are subcommands of literally the same program file. If renaming the script does not help, then you can always invoke the server using the Python -m command line option:
python -m bokeh serve --show app.py
If this does not work it can mean one thing only: the python executable you are running is a different Python environment than the one that you installed Bokeh into.

Darkflow without GPU on Jupyter-Notebook - Simple Code Required

I am unable to setup & run a simple darkflow program. Infact can't even configure darkflow library:
from darkflow.net.build import TFNet
==> ModuleNotFoundError: No module named 'darkflow'
My Target is to run the following program:
from darkflow.net.build import TFNet
import cv2
options = {"model": "cfg/yolo.cfg", "load": "bin/yolo.weights", "threshold": 0.1}
tfnet = TFNet(options)
imgcv = cv2.imread("./test/dog.jpg")
result = tfnet.return_predict(imgcv)
print(result
Please suggest steps so that I could configure darkflow on Jupyter Notebook (with no GPU) and run the above code
Fixed by creating the file in ipynb file in darkflow directory (downloaded from github) and executing the following from the notebook:
!python3 setup.py build_ext --inplace
!pip install -e .
!pip install .

install graphite +statsd ....getting error unknown carbon-cache

I am following these instructions(https://www.digitalocean.com/community/tutorials/how-to-install-and-use-graphite-on-an-ubuntu-14-04-server)
to install statsd and graphite, but am running into below stated problem. Seems like this is not a graphite issue but python issue. Does anybody know how to resolve this?
~/build > sudo service carbon-cache start
* Starting Graphite backend daemon carbon-cache
Traceback (most recent call last):
File "/usr/bin/carbon-cache", line 32, in <module>
run_twistd_plugin(__file__)
File "/usr/lib/python2.7/dist-packages/carbon/util.py", line 90, in run_twistd_plugin
config.parseOptions(twistd_options)
File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 604, in parseOptions
usage.Options.parseOptions(self, options)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/usage.py", line 269, in parseOptions
raise UsageError("Unknown command: %s" % sub)
twisted.python.usage.UsageError: Unknown command: carbon-cache
I was following the same instructions and encountered the same problem.
Moving or removing the /usr/local/lib/python2.7/dist-packages/twisted directory also resolved the issue for me.
You can use for example the following command to change the name of the problematic directory:
mv /usr/local/lib/python2.7/dist-packages/twisted /usr/local/lib/python2.7/dist-packages/twisted2
Then use sudo service carbon-cache start again
Background
I had the same issue on my Ubuntu 14.04 machine. Some investigation indicates that there are two virtually identical areas for twisted plugins on my machine.
/usr/local/lib/python2.7/dist-packages/twisted
and
/usr/lib/python2.7/dist-packages/twisted
I am not sure where these two areas originate from. Perhaps one comes with the distro and the other is created through a manual pip install twisted that I may have done at one time. I suspect that the /usr/local/lib/python2.7/dist-packages/ area gets populated with content when I install packages using pip. So this problem my eventually be attributed to users (e.g. me) installing twisted via pip and via the apt package system.
In any case, a diff through these areas showed that the carbon related files were installed into the /usr/lib/python2.7/dist-packages/ area. dpkg -L graphite-carbon also indicates that the package files go into the /usr/lib/python2.7/dist-packages/ area.
However, when the carbon start script is run is appears that /usr/local/lib/python2.7/dist-packages/twisted/plugins area is used leading to the plugin not being found.
I assume that this issue is related to the modules search path. As can be seen below the /usr/local/lib/python2.7/dist-packages/ comes before the /usr/lib/python2.7/dist-packages/ in my default path.
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PILcompat',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
>>>
for some reason twisted was messing up something with graphite.
read on the internet that manually removng twisted solves the problem.
Tried it and it works now
just did
sudo rm -rf /usr/local/lib/python2.7/dist-packages/twiste*

Cannot find symbol getWidth and getHeight in GLAutoDrawable in JOGL

I just checked out the newest JOGL from git://jogamp.org/srv/scm/jogl.git and installed it.
The installation seems ok. I did run "ant junit.run" and saw 3d graphics.
However, when I tried to compile some example code, I kept getting errors about GLAutoDrawable. It says:
symbol: method getHeight()
location: variable glautodrawable of type GLAutoDrawable
I'm running RHDL 6.5:
$ lsb_release
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
$ uname -a
Linux oc5088881832.ibm.com 2.6.32-431.21.1.el6.x86_64 #1 SMP Tue Jun 3 19:11:40 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
This is my java version:java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
And this is my classpath:
# For JOGL
export CLASSPATH=/usr/local/JOGL/gluegen/build/gluegen-rt.jar:$CLASSPATH
export CLASSPATH=/usr/local/JOGL/jogl/build/jar/jogl-all.jar:$CLASSPATH
export LD_LIBRARY_PATH=/usr/local/JOGL/jogl/build/lib:$LD_LIBRARY_PATH
For your reference, I am compiling this example:
http://jogamp.org/wiki/index.php/Using_JOGL_in_Java_Web_Start
It seems like either I missed something in my classpath or this version of JOGL didn't implement getWidth in GLAutoDrawable...
Please can someone let me know what I did wrong?
GLDrawable.getWidth() and GLDrawable.getHeight() have been renamed GLDrawable.getSurfaceWidth() and GLDrawable.getSurfaceHeight() when adding the support of HiDPI: GLDrawable.java
GLAutoDrawable extends GLDrawable. Please rather post your questions about JOGL on our official forum. Best regards.

Resources