Jetson Nano Setup Bad Magic Number Error

Hi so I couldn’t find any real support for the Jetson Nano with the Hologram Nano, I was wondering if you guys could add some in the future! Anyway I’m using my Nano and I imported both the hologram CLI version and update sudos on three different versions of python, 2.7, 3.8.6, and 3.7.7. I get this same error every time I try to run a hologram command. I upgraded to 3.7.7 after realizing the magic number error is this usually but it still doesn’t work. I’m using virtual env’s for all of these.

File “/usr/local/bin/hologram”, line 19, in
from scripts.hologram_send import parse_hologram_send_args
File “/usr/local/lib/python3.6/dist-packages/scripts/hologram_send.py”, line 14, in
from Hologram.HologramCloud import HologramCloud
File “/usr/local/lib/python3.6/dist-packages/Hologram/HologramCloud.py”, line 15, in
from HologramAuth import TOTPAuthentication, SIMOTPAuthentication
ImportError: bad magic number in ‘HologramAuth’: b’B\r\r\n’

It should be supported since its also an arm processor that is generally compatible with what the pi’s use. I admit I am not very familiar with the Jetson Nano, what OS is it running? The problem is the auth package we have is precompiled for security reasons and as far as I am aware it is impossible to create a distribution of precompiled python code for multiple architectures and python versions…

We are working on a way internally to not even have to use precompiled code anymore for our auth scheme but the current work around is to just not even use it, see my discussion here: Bad Magic Number with Python 3.8 - #7 by Dom

You will have to use a device key to authenticate instead since the OTP is no longer included but it will allow you to use the hologram sdk.

Thanks for the quick reply. I used the:

pip install -e git+https://github.com/hologram-io/hologram-python.git@refactor/removeauth#egg=hologram-python

and then I tried to input my key and I get the following error:

usage: hologram [-h]
{send,receive,spacebridge,heartbeat,modem,network,version,activate}

hologram: error: unrecognized arguments: [-h] [-v] [–apikey [xxx]

I also tried to use my device key:
sudo hologram --cloud [-h] --devicekey [xxx]
and I get a bash not found error. I’m kind of new at this so please excuse my lack of expertise… thanks.

Sorry those docs are a little confusing.
Try sudo hologram send --devicekey <whatever your device key is> "hello world"

Hey this is what I get now…

(py37holo) pyimagesearch@pyimagesearch-nano:~$ sudo hologram send --devicekey xxx “hello world”
[2] 26905
bash: xxx command not found

I still get ImportError: bad magic number in ‘HologramAuth’: b’B\r\r\n’

error even when I just use: sudo hologram --help

I would rebuild your virtual environment since it sounds like things are lingering there. Instead of using the install script just do the sudo pip install part. It can be confusing as sudo pip install and pip install put things in different locations.

im surprised its not parsing the device key, you can try putting it in quotes but yeah try rebuilding the virtual environment as the auth package should not even be installed on using that branch.

so I rebuilt it with python 3.7.7 and put in the bash install/update commands and I still get the same magic number thing. Sorry I’m a bit confused which sudo pip install’s you’re talking about

can you post your install process?

Basically the steps you should be doing is this:

  1. create new virtual environment
  2. activate the virtual environment
  3. install the hologram sdk using sudo pip install -e git+https://github.com/hologram-io/hologram-python.git@refactor/removeauth#egg=hologram-python

Great news, I was just missing “sudo” in front of “pip install -e” at the front… I used “hologram --help” and that worked! I also used the device and API setup and I didn’t get bad magic numbers which means that’s hopefully fixed but I did get some different errors that are hopefully just me being a noob. Yeah sure:

$ mkvirtualenv py37holo -p python3.7
$ workon py37holo
$ curl -L hologram.io/python-install | bash
$ curl -L hologram.io/python-update | bash
$ sudo pip install -e git+https://github.com/hologram-io/hologram-python.git@refactor/removeauth#egg=hologram-python
$ sudo hologram send --devicekey “hello world”

I get the following error when I put in my device key:

$ (py37holo2) pyimagesearch@pyimagesearch-nano:~$ sudo hologram send --devicekey [DeviceKey] “hello world”
[3] 25551
bash: [.SVW]: command not found
$ (py37holo2) pyimagesearch@pyimagesearch-nano:~$ Traceback (most recent call last):
File “/usr/local/bin/hologram”, line 7, in
exec(compile(f.read(), file, ‘exec’))
File “/home/pyimagesearch/src/hologram-python/scripts/hologram”, line 181, in
if name == ‘main’: main()
File “/home/pyimagesearch/src/hologram-python/scripts/hologram”, line 160, in main
args = parse_operations()
File “/home/pyimagesearch/src/hologram-python/scripts/hologram”, line 92, in parse_operations
required=True)
File “/usr/lib/python3.6/argparse.py”, line 1716, in add_subparsers
action = parsers_class(option_strings=[], **kwargs)
TypeError: init() got an unexpected keyword argument ‘required’

[3] Exit 1 sudo hologram send --devicekey [Devicekey]

so this is related to the sudo install and something I feared would happen. Even though your virtualenv is using 3.7 when you run it with sudo its pointing to the system level python installed which in your case is 3.6.

This isn’t a huge issue but it will break the cli. For whatever reason only python 3.7+ has the required keyword when parsing arguments… so that is the error you are running into. The rest of the sdk will work as expected.

we require sudo because bringing up a ppp connection requires it but we can probably take a more nuanced approach to this instead of flat our requiring it.

I figured it was calling python 3.6 but I didn’t know why… So with this in mind will I just not be able to use the cli? And is it working properly without using the cli? I guess what are some ways around this to get to the ppp connection without using sudo? I just want to know the limitations of hologram on the jetson in this particular case now that we know this.

I haven’t experimented with trying to get around the sudo requirement for ppp but I imagine it would be quite difficult since its altering the interfaces of the system. Would be like allowing a normal user to add or remove the ethernet port interface in the OS. Everything should work properly as far as the SDK itself is concerned.

The cli is just a series of python scripts hologram-python/scripts at develop · hologram-io/hologram-python · GitHub

the arg parsing issue you are running into is only in the scripts as we don’t parse args in the SDK itself since its meant to be integrated with your own python scripts rather than a separate process that you call and control.

Ah I see well thanks for all the help Dom, you guys have created a great forum/community

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.