-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python can't find KiCad python libs. #119
Comments
Can I get some help on this please? Thank you. |
Would really love some help |
Can you import pcbnewTransition from the python REPL inside pcbnew? |
I tried starting a shell in pcbnew using Tools > Scripting Console.
pcbnew was started from the KiCad main shell, which was started from my desktop's start menu. I don't know how to get the python interpreter I start in the venv outside of KiCad to know about KiCad's libraries, and I don't know how to get the python interpreter I start from pcbnew to know about the pcbdraw libraries. |
I am actually not sure if that's possible to have venv and KiCAD at the same time (I am not saying it is possible, I just don't know). |
Ahh I see. Your one line message gave me the clue I needed to find other places on the internet that have talked about this problem. The solution is to create the venv with the
Then python started in the venv will look at the packages in the system location, which is where KiCad puts its python code. Hope this helps someone else! |
Thanks for sharing the solution. |
Thank you so much for PcbDraw and JlcParts!
I'm running KiCad 6.0.7 in Fedora Linux 36. I have created a virtual env with
python -m venv venv
, activated the venv, and runpip install PcbDraw
. When I runpcbdraw --help
, I get the messageModuleNotFoundError: No module named 'pcbnew'
. I'm guessing this is because my invocation of python can't find KiCad's Python libraries.If I start Python in this venv, this is the value of
sys.path
:If I start Python via KiCad (ie, the KiPython shell), I get this value for
sys.path
:I don't know if this is what should be picked up, but there's a
pcbnew
in/usr/lib/python3.10/site-packages/
.Here's the list of files in this version of Fedora's KiCad:
https://rpmfind.net/linux/RPM/fedora/updates/36/x86_64/Packages/k/kicad-6.0.7-1.fc36.x86_64.html
KiPython correctly picks up
/usr/lib/python3.10/site-packages
.How can I run
pcbdraw
sopcbnewTransition/transition.py
findspcbnew
?The text was updated successfully, but these errors were encountered: