Programming B2 from Ubuntu 16.04 [solved]


#1

Struggling with programming the B2 from Ubuntu 16.04. I have installed tinyfpgab but that’s not working out for me.

$ tinyfpgab -p TinyFPGA_B.bin
Traceback (most recent call last):
File “/usr/local/bin/tinyfpgab”, line 7, in
from tinyfpgab.main import main
File “/usr/local/lib/python3.5/dist-packages/tinyfpgab/init.py”, line 246
print "Your lucky number: " + str(self.spinner)
^
SyntaxError: invalid syntax

That looks like it’s a problem with use of Python 3 instead of Python 2. My system has both versions of Python installed but the default is Python 2. To execute python 3 you have to specifically call python3…

I think I got that from a pip install which is python2 as well, rather then pip3 install.

$ pip search tinyfpga
tinyfpgab (1.0.4) - Programmer for the TinyFPGA B-Series boards (http://tinyfpga.com)
INSTALLED: 1.0.4 (latest)

The alternative to that would be the git repo https://github.com/tinyfpga/TinyFPGA-Programmer-Application.git but that’s not working out for me either:

TinyFPGA-Programmer-Application$ python tinyfpga-programmer-gui.py
Traceback (most recent call last):
File “tinyfpga-programmer-gui.py”, line 23, in
from tinyfpgab import TinyFPGAB
ImportError: No module named tinyfpgab

That error looks like tinyfpgab ain’t installed but I think that it is. The instructions at http://tinyfpga.com/b-series-guide.html are great, but I’m just missing something :frowning: The pip install tinyfpgab command came form the README.md file in the https://github.com/tinyfpga/TinyFPGA-B-Series.git repo.

Sorry about having to ask. I’ve probably missed the most obvious thing, in either README.md or on the User Guide web page. Either way if anybody could point me in the right direction I’d be very grateful.


#2

Your pip is probably installing it in the wrong place. Do a pip show tinyfpgab and see where it is installed to:

$ pip show tinyfpgab
Name: tinyfpgab
Version: 1.0.4
Summary: Programmer for the TinyFPGA B-Series boards (http://tinyfpga.com)
Home-page: https://github.com/tinyfpga/TinyFPGA-B-Series/tree/master/programmer
Author: Luke Valenty
Author-email: lvalenty@gmail.com
License: UNKNOWN
Location: /usr/local/lib/python2.7/site-packages
Requires: pyserial

Note that mine is installed in my python2.7/site-packages directory, so it is findable from python2 when I try to import it. My guess is yours has probably been installed into a python3.X/site-packages directory, because your pip executable, by default is using python3. You may be able to install it with pip2 or something, depending on how your python is setup on your computer.


#3

Thank you!

Messed up python system in Ubuntu where the default version of Python is Python2. So just executing ‘python’ is python version 2 but the default pip is version 3.

OMG that seems to have worked. Have to get some LEDS in a bread board!

Thanks again for your help