Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

23/01/2020

Installing external python modules for Blender

Blender comes with its own Python, and it's not necessarily your system's, so just symlinking system packages like matplotlib is risky and cumbersome.
Some Googling Stackoverflow provided me with the following approach:
  • create a (temporary) virtual environment (VE) linking against Blender's python executable
  • within that VE, pip install the packages you need, but into a folder in Blender's Python path (e.g. the one in ~/.config)
  • I'd keep the VE, but Blender doesn't need it to be active to run.

In code (I keep Blender in ~/.local/bin, adapt to your setup), for matplotlib (You might have to run blender once at first to create the file structure in .config):
virtualenv --python=~/.local/bin/blender-2.81a/2.81/python/bin/python3.7m ve-blender
source ve-blender/bin/activate
mkdir -p ~/.config/blender/2.81/scripts/modules/
pip install --upgrade -t ~/.config/blender/2.81/scripts/modules/ matplotlib
deactivate


Run Blender.

Update: When I tried to do this with pickle5,  gcc failed via "Python.h: No such file or directory".

Fix: within the active VE, determine the Blender Python version (python -V).
Download the respective sources (e.g. 3.7.7) from www.python.org. and unpack.
Copy the contents of the Include directory to ~/.local/bin/blender-2.81/2.81/python/include/python3.7m/ (adapt versions and paths).

Next update:

Broken pip after initializing the virtual environment. Fixable via pip's bootstrap installer:
curl -sS https://bootstrap.pypa.io/get-pip.py | python3

Sources:
https://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv
https://blender.stackexchange.com/questions/132278/how-to-make-use-of-custom-external-python-modules-in-blender-or-an-add-on-on-lin

https://blender.stackexchange.com/questions/81740/python-h-missing-in-blender-python 

https://stackoverflow.com/questions/49478573/pip3-install-not-working-no-module-named-pip-vendor-pkg-resources

30/11/2015

apt-get update gets stuck

Just a quick note: apt-get update froze regularly updating my software sources, with the shell output stuck at 100% [Connecting to security.ubuntu.com] or similar.
Apparently, this was caused due to IPv6 being enabled on my system. See this askubuntu discussion.
Fixes (as copied from the link above):
  • edit /etc/gai.conf and uncomment the last line to change the order of precedence to IPv4 first:
    #
    # For sites which prefer IPv4 connections change the last line to
    #
    precedence ::ffff:0:0/96 100
  • Alternative: disable IPv6. Not sure whether that is a good idea, so first try option 1. Anyway, you can reverse this action by deleting the lines added to /etc/sysctl.conf (everything below #disable ipv6).
    echo "#disable ipv6" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.all.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.default.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    echo "net.ipv6.conf.lo.disable_ipv6 = 1" | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
  • Check whether IPv6 is enabled with cat /proc/sys/net/ipv6/conf/all/disable_ipv6, output is 0/1 for enabled/disabled.
  • "Have you tried switching it off and on again?"

20/12/2012

Quick 'n dirty wxPython plot digitiser


There are a number of digitisers out there, but I wasn't happy with any of them - they either gave me weird results or didn't work on Linux. Also I hadn't played with wxPython in a long while.
Dependencies: wxpython, PIL, numpy, scipy.
What it does:
  - manual or automatic (scatter or line) detection of plot points by colour. 
  - axis calibrated ascii (x,y) data export.
  

14/05/2012

Scheduled backups to an external hard drive

After a narrowly averted data loss, I decided to schedule daily backups to an external hard drive. The scheduler of choice for this would be anacron, which runs tasks after a specified delay at startup, but only if it it hasn't run before in a specified time period (daily, weekly etc.) This is arguably better than a startup job running at every boot or a cron job running every day at a certain time regardless whether the computer is switched off.
I used unison as the backup synchronisation manager, it has both a GUI interface and an intervention-free console batch mode. Copying exceptions and permissions rules can be easily defined in profile scripts. You can't run this script in pure batch mode, as you have to tell the user to connect the external drive before starting the backup, so I used the Kdialog (zenity on Gnome/Unity) app for pop-up messages.

10/05/2012

Resuscitating Nanoengineer on Kubuntu

Nanoengineer has been unsupported for at least five years, and it shows. The 1.1.12 source zip file apparently contains corrupted files, and the code relies heavily on the deprecated python-Numeric.

20/02/2012

Upgrading to VLC 2.0 on Ubuntu 11.04 with checkinstall

There doesn't seem to be an official Debian package yet (at least I couldn't find a natty ppa), so I installed from source with checkinstall.
Checkinstall (instead of make install) creates a local .deb package, which can be uninstalled via dpkg -s vlc when the official repositories catch up.
The configure script kept popping up with missing packages, so I posted a list here. It's probably not complete (depending on what I had installed already) and might include a few unnecessary dev packages. Anyway, missing packages can usually be resolved by  aptitude search <keyword>.
Checkinstall failed at first being unable to create /usr/local/include/vlc and not finding vlc-cache-gen  (source). Afterwards, vlc crashed at startup missing some libraries, which had ended up in /usr/local/lib instead of /usr/lib, so I had to create a few symbolic links (source).

11/07/2009

Change "Open containing folder" in Firefox

In the Firefox downloads dialog, the containing folder is opened in Nautilus, which is a nuisance as well as an eyesore on my nice KDE4 desktop.
Two solutions are proposed on the web.
The first (from Rubylution), more elegant, is to fiddle with the about:config in Firefox by defining 3 new preferences: network.protocol-handler.expose.file = true (Boolean), network.protocol-handler.external.file = true (Boolean) and network.protocol-handler.app.file = konqueror (String). See the link for detailed instructions. Sadly, this had no effect, I still got Nautilus.
By the way, there is no way to delete erroneous preferences from about:config in Firefox, you have to edit ~/.mozilla/firefox/<yourprofile>/prefs.js by hand and restart Firefox.
The second (from hombrepac.com.ar) method stealthily substitutes Nautilus with Konqueror in the KDE mimetype handling. This basically makes Nautilus unusable, which might be a problem if you are an occasional Gnome user.
Well, I'm not - and this time, it worked.
Update: Newer Firefox versions (confirmed with FF 3.6.6) apparently detect KDE's default file manager - anyway, the downloads folder is opened in Konqueror without me having to do anything about it.

04/06/2009

Fres -- co -- bal -- di!

Frescobaldi has a nifty tool for setting hyphens automatically in Lilypond lyrics. For this purpose it uses hyphenation dictionaries included in myspell, OpenOffice etc. As the locations for these resources vary between distributions, frescobaldi is likely to not find the dictionaries automatically: you have to set the paths by hand in Tools->Configure Frescobaldi…->Paths and, if you don't know the location, look for the hyphenation dics in the file list in YaST-> software. I had no luck with myspell (frescobaldi didn't list any languages), but after installing OpenOffice_org-hyphen I found appropriate files in /usr/share/ooo/hyphen and automatic hyphenation worked reasonably well (didn't hyphenate "buia" and couldn't do vowel slurs/elisions, of course).
Did I mention that I like Frescobaldi?

11/05/2009

Unison fails to set permissions

Unison persistently refused to synchronise new files not present on one of the machines claiming:
"Failed to set permissions of file …" (different user names and IDs, by the way).
The solution (found here) is to disable owner and permission setting in the corresponding ~/.unison/<theproject>.prf file. Add the lines
owner=false
perms=0
and you should be fine.
Update (12/2014): I ran into a permissions problem again after installing a fresh 14.10 Kubuntu while keeping my old home partition (at least I think that's what changed between Unison runs ;) ).
This time it was "Error in setting permissions". This bug discussion recommended adding a
dontchmod=true
line to the .prf file (in addition to the options listed above), which solved  my issue.

18/04/2009

Getting PDF two-page views righted

This has bugged me both in Okular and Adobe Reader: They are capable of displaying facing pages next to each other, but both display the first page on the left by default and all the following as they come, so individual pages are on the wrong side in standard books, where page 1 is on the right.
Annoying if you want to check layouts.
  • Adobe Reader solution: View->Page Display->Show Cover Page During Two-Up
  • Okular solution: Settings->Configure Okular…->General->Centre first page
I think all of this could be a little more intuitive.

16/03/2009

Frescobaldi on SuSE 10.3/KDE 4.2

I love the music typesetting language lilypond, but I was missing a powerful editor for it - never got the hang of denemo (might be because I can't play midi keyboards). Last week I found out about frescobaldi, which blew me away completely.

04/03/2009

Installing cb2Bib on openSuSE

Today I discovered cb2Bib, a very useful tool for extracting BibTeX data from clipboard contents or PDF papers. It doesn't work perfectly (get real, how could it), but might save a lot of tedious copy and paste if combined with JabRef.
Only hitch during installation: Only src RPM available, rpmbuild complained about not finding qmake/qt4, which is understandable, as I hadn't installed libqt4-devel, which provides it. Afterwards everything worked flawlessly.
# rpmbuild --rebuild cb2bib-1.2.0-1.src.rpm
# rpm -Uhv /usr/src/packages/RPMS/x86_64/cb2bib-1.2.0-1.x86_64.rpm
The resulting GUI is mainly self-explanatory point-and-click.

18/01/2009

It had to be just the right kind of Java…

More fun with JabRef and the AWT toolkit. Starting JabRef by java -jar JabRef-2.4.2.jar got me a string of errors and no GUI:
ERROR while starting or running JabRef:
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
The reason for this appears to be that openSuSE uses the non-proprietary OpenJDK Java runtime by default, while you need Sun's JRE for JabRef to work (available in the non-oss repo).
Check with java -version - if it says "OpenJDK" instead of "Java(TM)", you need to switch the packages in YaST or zypper.

16/12/2008

Console CD burning

This was originally part of the last post, but I got stuck in an increasingly off-topic quagmire. I'm not a console zealot, but if some quick one-liner in a shell means I don't have to fire up a big GUI, I'm all for it. CD copying and ISO burning are prime candidates. You need wodim/cdrtools and cdrdao for this, which are probably installed by default as K3b depends on them. cdrtools users, replace wodim with cdrecord (see below).

16/11/2008

Improve low-res text images in GIMP


My inner nerd loves pasting stuff to doors and walls, including an image I stole from BoingBoing. 500x500 px looks OK on-screen, but printed on A4 crappy as hell. Here is a one-minute GIMP howto for cleaning up simple b/w text or vector-like images.
1.Convert to greyscale (Image->Mode->Greyscale) and scale up (Image->Scale Image... scaling by 4 did OK for me). This takes care of discolourations, the scaling operation also smoothes the image. If you are not happy yet, include another Gaussian blur.
2. Adjust the colour curves to overexpose the whitish areas and underexpose the grey-to-black ones. I displayed the curves in log style to show better the rather small dark pixel peak. Pull most of the dark peak down to zero and most of the light peak to full white. This will also take care of compression artifacts in the "white" areas.

That's it. Good enough to stick to an office door at least.

05/11/2008

They call it Fast Fourier Transform

Memory Leaks in the python-numeric FFT module
At present, I'm doing 2d-FFTs on extracted movies 4000-6000 frames in length. Sadly, Python cancels the job after about 2000 frames citing segfaults or memory errors, as it's running out of 2GB each of RAM and swapspace...

KSysGuard serves as a primitive debugging tool here. Note that you actually have to kill Python to ultimately free your memory. The culprit was the fft2d function from the FFT module (comes with python-numeric). I didn't find any related issues online, so maybe it's just me. However, using fft2 from scipy.fftpack (Documentation here) resolves the issue. Computing times are more or less equal for both packages.

22/10/2008

SuSE KDE 4 rant

Dragging myself kicking and screaming into the 21st century, I resolved not to ignore KDE 4 completely any more - i.e. using it for serious work and longer than 3 minutes.
First impressions: more or less useable. Compiz works OK. Plasma crashes every time I change something in the panel (restarts again immediately, though). I still have to find out how to make my widget settings permanent.
Being in a rather daring and experimental mood, I checked out Amarok 2 beta 2 (I can't wait for the final release). You will find the RPM on KDE4:UNSTABLE; however, you can't install that on openSuSE standard KDE4, as it requires KDE >= 4.1.2 and openSuSE is still banking on 4.0.4.
Hello??
KDE 4.1 has been out since July and SuSE is still shipping it from Factory only? Installing stuff from factory is just something I don't like doing, even in such tiny and insignificant cases as my desktop environment. Ironically, 4.1.x is supposed to be a major improvement to the notoriously buggy 4.0.4 (which would be the default desktop in a plain SuSE installation, btw). Well, apparently they keep 4.1.x up their sleeve till the openSuSE 11.1 release sometime in December.
Why oh why can't they do it a bit more modularly? For one, keeping people waiting half a year for an important bugfix release is not a very nice thing to do, and even when 11.1 is out, I don't want to do a complete OS update just to brush up my desktop and update my favourite audio player. (To be fair, I wouldn't put it past them to parallelly release 4.1.x for 11.0 - but still: December?)
Enough italics for today. Still disappointed.
Update: The opensuse download page displays an one-click installer for 4.1.3 stable by now. Didn't try it because all my systems run on factory for reasons mentioned above - though daWuzz had some trouble with strange dependency conflicts.

06/10/2008

Packages to add to a standard installation

These are the packages I would always install from the main repo (more a reminder for myself, but I guess it is useful for many people out there as well). This list is by far not complete and will be updated.

  • ntfsconfig (gui helper for setting read/write ability for ntfs drives)
  • quanta (web site development suite)
  • lynx (text browser for console - old, but can be very useful if you're left with a shell only)
  • texlive (LaTeX System)
  • kile (LaTeX Editor)
  • miktex-tools (if you use LaTeX and want to have a convenient package manager
Additionally, there are some packages which are not really usable or functional in the standard installation and should be replaced by packman versions (see post by avocadohead)

03/10/2008

Keep track of your YaST updates

Right on top of my YaST Installer wishlist would be a "sort by install date" option in order to easily revert what yesterday's uncautious update screwed up. At least I found out where the installer log is: /var/log/YaST2/y2logRPM.
sudo tail -n 100 /var/log/YaST2/y2logRPM (100 last lines) ought to give you a hint about the most recent changes.

Note: Doesn't work for SuSE 11.1. Try
# sudo tail -n 100 /var/log/zypp/history
If you want to compare when you installed which version of a certain package:
# sudo cat /var/log/zypp/history | grep -i <packagename>

25/09/2008

Firefox 3.0.2

According to the German Heise Security page Mozilla has patched some important security issues in Firefox 3.0.2. As of this morning, that version is not yet available in the main update repo, but you can get it from the Mozilla Build Service Repo.
Update: 3.0.2 had another bug, passwords containing non-ASCII characters can't be accessed. 3.0.3 is already out and fixed (same repo).