Notifications
Clear all

Prusa Link throws "bad magic number" error  

  RSS
bux024
(@bux024)
Active Member
Prusa Link throws "bad magic number" error

Hello folks,

as my printer is sitting right next to my homelab machine, I'm trying to set up Prusa connect to connect my homelab to the printer via USB.

 

However, I'm currently stuck at installing Prusa connect.

 

Things I've done so far:

 

1. Set up a fresh Ubuntu 22.04.3 instance + sudo apt update/upgrade
2. Installed neccessary stuff as advised on the Prusa Link GitHub page

sudo apt install git python3-pip libcap-dev libmagic1 libturbojpeg libatlas-base-dev python3-numpy

3. Installed Prusa Link with pip as advised on the Prusa Link GitHub page

pip install PrusaLink

 

While installing, pip threw the following warnings:

 WARNING: The script unidecode is installed in '/home/username/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts pip, pip3, pip3.10 and pip3.11 are installed in '/home/username/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script docutils is installed in '/home/username/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script normalizer is installed in '/home/username/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts prusalink and prusalink-manager are installed in '/home/username/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

 

Therefore, the command "prusalink" does not work (command not found).

 

After some googleing, I found this thread on stackoverflow stating the identical issue with another application.

As I'm not very familiar with python, is just copy/pasted the following code from stackoverflow:

echo "export PATH=\"`python3 -m site --user-base`/bin:\$PATH\"" >> ~/.bashrc
source ~/.bashrc

 

After that, the "prusalink" command throws the following error:

username@prusalink:~$ prusalink
Traceback (most recent call last):
  File "/home/username/.local/bin/prusalink", line 5, in 
    from prusa.link.__main__ import main
ImportError: bad magic number in 'prusa.link': b'a\r\r\n'

 

And thats where I'm currently stuck as I do not know how to proceed to get this problem solved.

 

Any help is much appreciated!

 

Many thanks in advance.

Best Answer by Tojik:

Please install straight from github instead - the lower section. For some from my perspective dumb inexplicable reason, the pypi version is a binary distribution and not a source distribution meaning you'll need the same python version to the one it was built with to run it. I will attempt to make the person who made the pypi package consider doing that. Thanks for the report

This topic was modified 1 year ago 2 times by bux024
Posted : 16/10/2023 3:55 pm
Tojik
(@tojik)
Member Moderator
RE: Prusa Link throws "bad magic number" error

Please install straight from github instead - the lower section. For some from my perspective dumb inexplicable reason, the pypi version is a binary distribution and not a source distribution meaning you'll need the same python version to the one it was built with to run it. I will attempt to make the person who made the pypi package consider doing that. Thanks for the report

Posted : 16/10/2023 4:21 pm
bux024
(@bux024)
Active Member
Topic starter answered:
RE:

Thanks for the hint.

Installing directly from github works like a charm.

 

echo "export PATH=\"`python3 -m site --user-base`/bin:\$PATH\"" >> ~/.bashrc
source ~/.bashrc

is still required when using Ubuntu.

Maybe add a note to the install section regarding the pypi topic.

Many thanks and have a nice evening.

This post was modified 1 year ago by bux024
Posted : 16/10/2023 5:12 pm
Tojik
(@tojik)
Member Moderator
RE: Prusa Link throws "bad magic number" error

Didn't install on ubuntu, didn't know

Posted : 16/10/2023 5:16 pm
Tojik
(@tojik)
Member Moderator
RE: Prusa Link throws "bad magic number" error

What, that was a malformed message. So anyway. It should be fixed now. We didn't have the binaries for every python version in use. We do now, so it should start working normally. Thanks and sorry for the clearly unfinished message i've sent

Posted : 30/10/2023 6:05 pm
bux024
(@bux024)
Active Member
Topic starter answered:
RE: Prusa Link throws "bad magic number" error

No worries! Thank you very much for looking into this issue. I really appreciate the work you’ve put into this. 

Posted : 30/10/2023 11:11 pm
Tojik liked
Share: