Notifications
Clear all

[Help Needed] Octoprint PrushMeshMap Plugin  

Page 4 / 9
  RSS
termlimit
(@termlimit)
Trusted Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin


Finally have a chance to get back to trying to set this up on my Raspberry Pi B+. I tried the pip route to get matplotlib and numpy installed but it was taking forever with TONS of compiler warnings and errors. I gave up and went the apt-get route instead:

sudo apt-get install python-numpy
sudo apt-get install python-matplotlib

But whatever version of matplotlib that installs either isn't the right one or doesn't get installed where Octoprint can see it as the plug-in install attempts to download matplotlib-2.2.2.tar.gz again.

I'd love to see the step by step list of commands someone's done to actually successfully install this plug-in on a Raspberry Pi B+ with the Octoprint image from https://octoprint.org/download/ , because all the suggestions in this thread still haven't resulted in a successful install on my end.

Look in the logs or do a $which matplotlib to figure out where it installed. Octoprint might have a bin directory that is separate from Raspbian. You should be able to symlink the dependency. Let me know if any of this needs further explaining. Not sure how familiar you are with *nix systems.

Posted : 04/04/2018 5:00 am
neil.e
(@neil-e)
Estimable Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin


Look in the logs or do a $which matplotlib to figure out where it installed. Octoprint might have a bin directory that is separate from Raspbian. You should be able to symlink the dependency. Let me know if any of this needs further explaining. Not sure how familiar you are with *nix systems.

$which matplotlib returns "matplotlib: command not found". Since this is a library not an executable I'm not surprised $which didn't find it. (Looks like it installs to /usr/lib/python2.7/dist-packages/matplotlib)

Posted : 04/04/2018 6:54 am
neil.e
(@neil-e)
Estimable Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin



Look in the logs or do a $which matplotlib to figure out where it installed. Octoprint might have a bin directory that is separate from Raspbian. You should be able to symlink the dependency. Let me know if any of this needs further explaining. Not sure how familiar you are with *nix systems.

$which matplotlib returns "matplotlib: command not found". Since this is a library not an executable I'm not surprised $which didn't find it. (Looks like it installs to /usr/lib/python2.7/dist-packages/matplotlib)

Ah! I bet this is my problem. There's also a ~/oprint/lib directory, which I bet is the python version that OctoPrint uses, rather than the one in /usr/lib. So how do I get it to install in the location that OctoPrint uses?

Posted : 04/04/2018 6:59 am
termlimit
(@termlimit)
Trusted Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin




Look in the logs or do a $which matplotlib to figure out where it installed. Octoprint might have a bin directory that is separate from Raspbian. You should be able to symlink the dependency. Let me know if any of this needs further explaining. Not sure how familiar you are with *nix systems.

$which matplotlib returns "matplotlib: command not found". Since this is a library not an executable I'm not surprised $which didn't find it. (Looks like it installs to /usr/lib/python2.7/dist-packages/matplotlib)

Ah! I bet this is my problem. There's also a ~/oprint/lib directory, which I bet is the python version that OctoPrint uses, rather than the one in /usr/lib. So how do I get it to install in the location that OctoPrint uses?

Ok, so the ln command is:
$ ln -s {source-filename} {symbolic-filename}

So for you I would try:
$ ln -s /usr/lib/python2.7/dist-packages/matplotlib /home/{username}/oprint/lib/matplotlib
Replace {username} with your username or do a $ pwd to verify in the ~/oprint/lib dir.

That should do it, reboot to ensure all services can see this.

Posted : 04/04/2018 7:16 am
aaron.p6
(@aaron-p6)
New Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin



Just wanted to say that I absolutely love this. The results are much easier to read than the normal output. Now if only this was available for my hypercube.... 😀

How do you like the Hypercube? I've been considering adding a Hypercube Evolution to the stable if I decide to go for a second printer.

I just have a regular hypercube and I love it. I have some modifications such as dual z carriages and 24v. I dont print all that fast on it like I was hoping initially but it is solid. After enough tweaking the prints are on par with my mk3. I print keyboard cases for customers so quality is the biggest concern. I use a .6 nozzle and make the large parts on this and use my mk3 for the detailed stuff.

Posted : 04/04/2018 3:11 pm
neil.e
(@neil-e)
Estimable Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin


So for you I would try:
$ ln -s /usr/lib/python2.7/dist-packages/matplotlib /home/{username}/oprint/lib/matplotlib
Replace {username} with your username or do a $ pwd to verify in the ~/oprint/lib dir.

That should do it, reboot to ensure all services can see this.

That would definitely get matplotlib to show up in the right spot. My concern is matplotlib dependencies. There were quite a few of them if I recall from watching the install, but none of those would get linked over, and I'd be playing whack a mole trying to figure them out.

I think I'll hang tight and wait for OP to have the time to play with their Pi B+ and come up with some official steps to get this working.

Posted : 04/04/2018 4:11 pm
termlimit
(@termlimit)
Trusted Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin



So for you I would try:
$ ln -s /usr/lib/python2.7/dist-packages/matplotlib /home/{username}/oprint/lib/matplotlib
Replace {username} with your username or do a $ pwd to verify in the ~/oprint/lib dir.

That should do it, reboot to ensure all services can see this.

That would definitely get matplotlib to show up in the right spot. My concern is matplotlib dependencies. There were quite a few of them if I recall from watching the install, but none of those would get linked over, and I'd be playing whack a mole trying to figure them out.

I think I'll hang tight and wait for OP to have the time to play with their Pi B+ and come up with some official steps to get this working.

Dependencies should link properly. Worst case if it doesn't work, you delete the symlink and reboot. But understand waiting. Good luck let me know if you need help.

Posted : 04/04/2018 4:20 pm
neil.e
(@neil-e)
Estimable Member
Re: [Help Needed] Octoprint PrushMeshMap Plugin


Dependencies should link properly. Worst case if it doesn't work, you delete the symlink and reboot. But understand waiting. Good luck let me know if you need help.

For funI tried symlinking both matplotlib (and numpy) as you outlined above, then installed the plugin again. Still can't find matplot lib and attempts to download and compile it.

I tried again but put the links inside the ~/oprint/lib/python2.7 folder. Same result, attempts to download and compile matplotlib.

Posted : 04/04/2018 8:14 pm
Brigandier
(@brigandier)
Reputable Member
Topic starter answered:
Re: [Help Needed] Octoprint PrushMeshMap Plugin

You guys ready to hear why this is so problematic on Raspberry Pi? Oh I'll feed you baby birds, I'll feed you.

The PyPi (Python package index) has a concept they call "wheels". Here's an excerpt from a good write up:

Python wheels are a standard for distributing pre-built versions of packages, saving users from having to build from source. However, when C code is compiled, it’s compiled for a particular architecture, so package maintainers usually publish wheels for 32-bit and 64-bit Windows, macOS, and Linux. Although Raspberry Pi runs Linux, its architecture is ARM, so Linux wheels are not compatible.

The rest of that article is here: https://www.raspberrypi.org/blog/piwheels/ - interesting read.

How that affects this plugin:

I set up Octopi (latest version) on a Raspberry Pi 3 and kicked off the install. Lo and behold, process "cc1" was using 100% of a single one of the Pi3's CPU cores. "cc1" is a compiling stage for gcc C compiler. Since matplotlib and numpy don't have ARM wheels, they are pulling down the source code to your Pi and compiling it for ARM. These are pretty hefty libraries, and since gcc isn't compiling them in a multithreaded way it takes forever.

So much so that Octoprint will eventually show that the plugin failed to install, stops serving up the Octoprint interface, and leaves you in a very inconsistent state. However...

The plugin is still installing in the background. In fact, besides the one off cbook error it throws (doesn't seem to affect anything), the plugin and all of its dependencies install correctly providing you give it time. Once it finished, Octoprint came back on its own. It didn't show the plugin to be installed, so I attempted the install again. It detected it was there and forced a reinstall, had all the dependencies it needed, and installed without issue within a few seconds.

This really sucks, because I bet a few of you were frustrated and yanked the power cable leaving this in an inconsistent state. I am going to open an issue with Octoprint project and see if they have a suggestion, because surely others are using modules like this that don't have an ARM wheel. The fact Octoprint packages up its own install of Python doesn't help either. In the meantime, you can do the following:

  • Accept that the first install is going to fail, and wait a looooooooooong time for the Pi to finish compiling and installing the dependencies. You can tell this by watching CPU usage with "top" command via SSH. Once it drops off, log back in to Octoprint and install the plugin again. It should go fine this time, and for all future upgrades providing I don't push a requirement for a newer version of matplotlib/numpy; or,

  • If you're not keen on going the crashing route, you can also do this by hand in SSH first. Run:
    /home/pi/oprint/bin/pip install matplotlib numpy
  • The above will install matplotlib and numpy in Octoprint's Python install directory. It will still take just as long, but is likely cleaner feeling than letting things error out per above.

  • Optional cleanup, in case you did yank the cord:
    /home/pi/oprint/bin/pip uninstall matplotlib numpy
  • Someone mentioned doing an apt install of these, but it's very distro dependent. On Raspbian Jessie, it looks like the matplotlib version is too old. Also, this would install it in the OS Python install directory, not OctoPrint's. If you do have an OS that has a supported version, you could likely copy it from one install to the other (it's under site-packages), but you're on your own with that one. 😉
  • There is a "piwheels" repository; unfortunately, they aren't offering Python 2.7 wheels yet. If Octoprint made the jump to Python 3.6 and configure pip to pull from piwheels, this problem would go away immediately.

    Pi Zero W users, you only have a single core for the whole system and limited memory. I am betting you could still make this work per above, but get ready for the wait. 🙂

    Where to go next with this plugin?

    I will keep a look out for ways to make this faster and will check with the Octoprint devs to see if they have any input. I will also look at the other graph libraries available, and see if there are any pure Python implementations that don't require compiling. Betting it won't look as pretty though. 🙂

    My MK3 Parts: [Bowden] [New Shoes] [TPU Micro Springs]

    Posted : 05/04/2018 2:14 am
    Kwaad2
    (@kwaad2)
    Honorable Member
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    EDIT: IT SOUNDS LIKE BRIGADIER'S INSTRUCTIONS ABOVE WORK. FOLLOW THEM, NOT THIS

    Ok guys, since this is still going on... Here's what I *THINK* I did to fix it. I know for a fact I botched the state. 🙂

    And get patient. This is slow.

    SSH into your Pi.

    sudo apt-get install screen
    screen
    sudo apt-get install python-pip
    sudo pip install matplotlib numpy


    This will take FOREVER, if your terminal disconnects or does something stupid, it can cause issues.

    Now that we are on screen press "CTRL-a" then press "d"
    This will "detach" the "screen".

    When you come back in a few hours... heh...

    Now, if this fails to work, we will do the OTHER thing that I did.


    screen
    cd ~
    ./oprint/bin/python pip install matplotlib numpy

    Do the "CTRL-a" and then "d" thing again once it starts downloading.

    If it fails to download anything, you may want to go and remove everything in the /tmp/ directory, reboot the system, and then try the above code again. If that STILL fails again, remove everything in the /tmp/ directory *again*, and then try to install the program from octopi.

    WARNING THIS CODE IF TYPED WRONG CAN WIPE OUT YOUR ENTIRE PI INSTALL

    rm -R /tmp/*

    WARNING THIS CODE IF TYPED WRONG CAN WIPE OUT YOUR ENTIRE PI INSTALL

    Yup, that summarizes what I did almost step by step. I have NO idea what made it work.

    Hi, I'm Sean. I used to work on CNC machines.
    I try to not make mistakes, but the decision is YOURS.
    Please feel free to donate to my filament/maintance fund.

    Posted : 05/04/2018 11:02 am
    neil.e
    (@neil-e)
    Estimable Member
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    Thanks for the detailed writeup Brigandier. I did indeed yank the cord, several times, so I ran the cleanup command, upgraded pip, and now have the compile running via ssh. We'll see how long it takes 😀

    Posted : 05/04/2018 5:23 pm
    Brigandier
    (@brigandier)
    Reputable Member
    Topic starter answered:
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    I talked to #octoprint guys last night on irc.freenode.net. Someone had the idea of cross compiling these libraries and just including them with the plugin, and while that may work, I don't feel comfortable doing it. If some critical vulnerability hit, you wouldn't have a method to update these.

    I also am seeing PyPi's new "Warehouse" codebase is going in April it appears, and it looks like they have added ARM wheel support. Here's hoping they'll add these libraries and this will go away on its own. 🙂

    My MK3 Parts: [Bowden] [New Shoes] [TPU Micro Springs]

    Posted : 05/04/2018 6:07 pm
    neil.e
    (@neil-e)
    Estimable Member
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    Well... crap. Tip to everyone: When pip says "a new version is available" via SSH, DO NOT UPGRADE IT. Octoprint does NOT like the newer version of pip and basically my whole octoprint install is messed up now.

    To fix this (for anyone else that did my screwup), run:

    /home/pi/oprint/bin/pip install --upgrade pip==9.0.1

    Posted : 05/04/2018 6:36 pm
    neil.e
    (@neil-e)
    Estimable Member
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    Ok, it works! Here's how I got it going on a Raspberry Pi B+:

  • ssh into the Pi B+

  • clean up any prior botched installs by running /home/pi/oprint/bin/pip uninstall matplotlib numpy

  • run /home/pi/oprint/bin/pip install matplotlib numpy

  • wait

  • wait some more

  • wait a while longer

  • wait, it's almost done

  • almost...

  • done!

  • go back to the Octoprint UI and use the plug-in manager to install the plugin

  • reboot
  • Done!

    Posted : 05/04/2018 6:50 pm
    neil.e
    (@neil-e)
    Estimable Member
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    And here's what my bed level looks like:

    Posted : 05/04/2018 6:50 pm
    Brigandier
    (@brigandier)
    Reputable Member
    Topic starter answered:
    Re: [Help Needed] Octoprint PrushMeshMap Plugin


    And here's what my bed level looks like:


    That's a pretty sweet initial bed. Mine was out 0.6mm. Adjust as much out as you can by loosening and tightening up the Y rod holders in different positions. Then if you want absolute accuracy, get some TPU or wave springs to put under the screw standoffs. 🙂

    https://shop.prusa3d.com/forum/original-prusa-i3-mk3-f30/-testers-needed-tpu-micro-springs--t15061.html

    My MK3 Parts: [Bowden] [New Shoes] [TPU Micro Springs]

    Posted : 05/04/2018 7:20 pm
    neil.e
    (@neil-e)
    Estimable Member
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    That's a pretty sweet initial bed. Mine was out 0.6mm. Adjust as much out as you can by loosening and tightening up the Y rod holders in different positions. Then if you want absolute accuracy, get some TPU or wave springs to put under the screw standoffs. 🙂

    https://shop.prusa3d.com/forum/original-prusa-i3-mk3-f30/-testers-needed-tpu-micro-springs--t15061.html

    I don't dare touch anything. If you think it's a pretty sweet initial bed I'm not screwing around with it!

    Edit: I might try adjusting the back right corner...

    Posted : 05/04/2018 7:30 pm
    Brigandier
    (@brigandier)
    Reputable Member
    Topic starter answered:
    Re: [Help Needed] Octoprint PrushMeshMap Plugin


    That's a pretty sweet initial bed. Mine was out 0.6mm. Adjust as much out as you can by loosening and tightening up the Y rod holders in different positions. Then if you want absolute accuracy, get some TPU or wave springs to put under the screw standoffs. 🙂

    https://shop.prusa3d.com/forum/original-prusa-i3-mk3-f30/-testers-needed-tpu-micro-springs--t15061.html

    I don't dare touch anything. If you think it's a pretty sweet initial bed I'm not screwing around with it!

    Haha, no it definitely needs touching! Just not nearly as bad as most. 🙂

    That's the beauty of this plugin though, it's very easy to experiment. I would loosen a single Y rod mount a little and move it up/down by hand and retighten it, then retest. Repeat until you get all four corners as close as you can. Profit. 😛

    My MK3 Parts: [Bowden] [New Shoes] [TPU Micro Springs]

    Posted : 05/04/2018 7:33 pm
    japato
    (@japato)
    Active Member
    Re: [Help Needed] Octoprint PrushMeshMap Plugin

    Ok, it works! Here's how I got it going on a Raspberry Pi B+:
    ssh into the Pi B+
    clean up any prior botched installs by running /home/pi/oprint/bin/pip uninstall matplotlib numpy
    run /home/pi/oprint/bin/pip install matplotlib numpy
    wait
    wait some more
    wait a while longer
    wait, it's almost done
    almost...
    done!
    go back to the Octoprint UI and use the plug-in manager to install the plugin
    reboot
    Done

    Very well!
    I can confirm, above steps are working on my RPi Zerro W with Octopi image from Prusa (second installation of original Octopi 0.14 too). Only necessary, I had to add --no-cache-dir at the end of pip install line and more than 5 hours relax. CPU was above 98% all the time.

    OMG a lot of work with Y rods is front of me! Maybe better don't know. 😀

    Posted : 06/04/2018 9:07 pm
    Brigandier
    (@brigandier)
    Reputable Member
    Topic starter answered:
    Re: [Help Needed] Octoprint PrushMeshMap Plugin


    OMG a lot of work with Y rods is front of me! Maybe better don't know. 😀

    Wow, that's a big one. Glad you were able to spot it with this though. I would do a Z calibration and check again, just to make sure that wasn't throwing things off. 🙂

    When you get it dialed in and see absolutely no Z stepper movement while doing big prints, the work will have been worth it. 😛

    My MK3 Parts: [Bowden] [New Shoes] [TPU Micro Springs]

    Posted : 06/04/2018 9:45 pm
    Page 4 / 9
    Share: