[SOLVED] External Plugins Directory Location for Ubuntu

I do not see .kicad in my home folder:
don@don-ThinkPad-X240:/home$ dir
don

I have a kicad folder here:
don@don-ThinkPad-X240:/usr/share/kicad$ dir
demos internat library modules plugins scripting template

.kicad is hidden (the convention on *nix: files starting with dot are hidden from basic file list views). Use “ls -a” command to see it. Your home directory is probably “/home/don/”, not “/home/”.

Don’t ever mess up with anything under /usr/ unless you know what you are doing.

1 Like

Thanks for help - but I cant seem to locate it and ls-a wasn’t found as a command.

don@don-ThinkPad-X240:~$ cd .kicad
bash: cd: .kicad: No such file or directory
don@don-ThinkPad-X240:~$ ls-a
ls-a: command not found

Thanks for your patience!

Run this:
cd "$HOME"
and then this
mkdir -p .kicad/scripting/plugins

It will create necessary directories if they are not already there.

1 Like

ls -a (with space), not ls-a. “-a” is an option to the ls command. (Dir is similar to ls, you can use it, too.)

2 Likes

Created the folder:
don@don-ThinkPad-X240:/home$ cd $HOME
don@don-ThinkPad-X240:~$ mkdir -p .kicad/scripting/plugins

And copied the script into it:

picknplace_assistant/plugin – kicad 5.1$ cp pnpassist_action.py /home/don/.kicad/scripting/plugins
Double checked it was properly copied to the right directory.
Then when I go to the Tools pulldown in pcbnew and mouse over to External Plugins, my only option is to ‘Refresh’ - I’ve restarted Kicad between each attempt.

Ah! I see! Thank you
And thanks for the heads up. Still learning!

Open pcbnew scripting console and run this:

import pcbnew
pcbnew.GetWizardsBackTrace()

Paste output here. Most likely you are missing some dependencies.

1 Like
import pcbnew
pcbnew.GetWizardsBackTrace()
Traceback (most recent call last):
  File "/usr/lib/python3.6/code.py", line 64, in runsource
    code = self.compile(source, filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 168, in __call__
    return _maybe_compile(self.compiler, source, filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 99, in _maybe_compile
    raise err1
  File "/usr/lib/python3.6/codeop.py", line 87, in _maybe_compile
    code1 = compiler(source + "\n", filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 133, in __call__
    codeob = compile(source, filename, symbol, self.flags, 1)
  File "<input>", line 1
    import pcbnew
                ^
SyntaxError: multiple statements found while compiling a single statement

Copy them one line at a time into the command prompt, not both together. Press enter after each one. Interpreter in built in shell is a bit of a dummy.

In my kubuntu 18.04 installation is
~/.config/kicad
and the plugins in
~/.config/kicad/scripting

That path varies for distributions, but ~/.kicad is always the same. See https://github.com/KiCad/kicad-source-mirror/blob/master/scripting/kicadplugins.i#L170

Actually that path shouldn’t vary between the (*nix systems or) distributions. According to the FAQ entry Where are the configuration files (settings, library tables)? .config is always used (unless the environment variable has been set). I don’t remember the details but I was careful and checked from the source code.

On the other hand this doesn’t matter much - kicad searches for plugins in several directories and if it’s found in one of them it’s OK. User’s home dir/.kicad should work on all systems, I guess.

Hei, @qu1ck, I’m not arguing about what is right or not.

As @dongero is using ubuntu 18.04 I just limited myself to tell which directories are in my kubuntu 18.04 installation, just in case it can be useful for him. I do not have a~/.kicad folder. That’s all.

Also in Ubuntu 16.04 use
~/.kicad_plugins
or
~/.config/kicad/scripting

import pcbnew
pcbnew.GetWizardsBackTrace()
‘Traceback (most recent call last):\n File “/usr/lib/python3/dist-packages/pcbnew.py”, line 3579, in LoadPluginModule\n mod = importlib.import_module( ModuleName )\n File “/usr/lib/python3.6/importlib/init.py”, line 126, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n File “”, line 994, in _gcd_import\n File “”, line 971, in _find_and_load\n File “”, line 955, in _find_and_load_unlocked\n File “”, line 665, in _load_unlocked\n File “”, line 678, in exec_module\n File “”, line 219, in _call_with_frames_removed\n File “/home/don/.kicad/scripting/plugins/pnpassist_action.py”, line 7, in \n import matplotlib.pyplot as plt\nModuleNotFoundError: No module named ‘matplotlib’\nTraceback (most recent call last):\n File “/usr/lib/python3/dist-packages/pcbnew.py”, line 3579, in LoadPluginModule\n mod = importlib.import_module( ModuleName )\n File “/usr/lib/python3.6/importlib/init.py”, line 126, in import_module\n return _bootstrap._gcd_import(name[level:], package, level)\n File “”, line 994, in _gcd_import\n File “”, line 971, in _find_and_load\n File “”, line 955, in _find_and_load_unlocked\n File “”, line 665, in _load_unlocked\n File “”, line 678, in exec_module\n File “”, line 219, in _call_with_frames_removed\n File “/home/don/.kicad/scripting/plugins/pnpassist_action_sysFW.py”, line 15, in \n import matplotlib.pyplot as plt\nModuleNotFoundError: No module named ‘matplotlib’\n’

I do have another kicad folder here:

don@don-ThinkPad-X240:~/.config/kicad$ ls -a
.   3d        fp-lib-table  kicad_common  PyShell_pcbnew_startup.py
..  eeschema  kicad         pcbnew        sym-lib-table

But none of these are directories. In OSX, there’s the ‘Show Package Contents’ option- which is how I recall getting to the the script folder I use on my OSX kicad.

@dongero you already put the plugin in the right directory, now you have missing dependencies as I predicted. So leave the plugin as is and install some packages, namely matplotlib (see last line of the output you just copied in your post). After that if plugin still doesn’t appear in menu repeat the process.

1 Like

Just be careful to install them for the same python installation/version which KiCad uses.

1 Like

Ah! Amazing! It’s working now - Python3 was missing matplotlib - I had it installed in Python2.7

This was helpful! I thought Kicad was still using Python2.7, but that’s only with IOS - thanks for the heads-up

Thank you all for the help! I learned a lot!

1 Like

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