Steffen-W / Import-LIB-KiCad-Plugin

Helps to import KiCad component libraries imported from ultralibrarian and snapeda zipfiles.
GNU General Public License v3.0
78 stars 8 forks source link

Error: No module named 'pydantic' #23

Open Alviunta opened 3 months ago

Alviunta commented 3 months ago

I have an error using the import functions of "LCSC Part#". When I try to run it with a part number, I get an error message "Error: No module named 'pydantic'". I tried to install pydantic using: "pip install pydantic" and "pip3 install pydantic". However, after installing it I get the error message:

"Error: cannot import name 'Self' from 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
Python version 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]"

When I run "pyp list" I get:

$ pip3 list | grep typing
typing 3.7.4.3
typing_extensions 4.12.2

I completed the installation process indicated in the README, all the other functions work fine except this one. Could you tell me if there is something I am missing or any kind of help you can give me? If you need more information I can send it to you. Thanks

Steffen-W commented 3 months ago

I had the problem myself and it is more or less due to the fact that a necessary feature only comes with python 3.12. But it also works with python 3.10. But it also works with python 3.10. Are you on Linux?

Try the following: sudo apt update sudo apt install python3-typing-extensions

and otherwise pip3 install --upgrade typing_extensions

Alviunta commented 3 months ago

Yes, I'm using Ubuntu 22.04.4 LTS. I tried both and neither of them work, should I try to upgrade python to 3.12?

I also looked at https://github.com/uPesy/easyeda2kicad.py/blob/master/requirements.txt and it says that I should use at least pydantic 2.0.0.

So I tried to force this version ( pip install pydantic==2.0.0 ), however now the error changes to:

Error: cannot import name 'Required' from 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
Python version 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]
sbalula commented 2 months ago

Got this error (No module named 'pydantic') in MacOS 14.6.1, with KiCad 9.0 installed using brew. Note that KiCad in MacOS uses its own python. For me that's at /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/.

So running /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/pip3.9 --install pydantic solved the issue.

Thanks @Steffen-W for this very helpful tool!

Steffen-W commented 2 months ago

Hi @sbalula, I'm very pleased that you were able to solve the error. Did you use kicad 8.0.4? Unfortunately, I am currently too busy to solve the problem in general. Do you have any idea how I could solve the problem within the plugin? Unfortunately, the Python package has also been running on a few of my test devices. Does the plugin now work completely as you would expect?

JoHo94 commented 2 months ago

Got this error (No module named 'pydantic') in MacOS 14.6.1, with KiCad 9.0 installed using brew. Note that KiCad in MacOS uses its own python. For me that's at /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/.

So running /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/pip3.9 --install pydantic solved the issue.

Thanks @Steffen-W for this very helpful tool!

Thanks for this tip, this did work for me on windows too.

MKoroschetz commented 2 months ago

A few days ago I installed KiCad 8.05 on Windows 11 Pro, 24H2, build. 26120.1542 As I am migrating from EasyEDA PRO I am in need to import Symbols and Footprints. to KiCad. Following the Readme without errors, on first use I got the same error this issue is about. I found python 3.11 installed by KiCad 8.05 in the "C:\Program Files\KiCad\8.0\bin\Scripts" folder and following the solution suggested by JoHo94 i was able to solve the problem and make the plugin work as expected.

Thank you @Steffen-W for this very convenient and useful tool, and to JoHo94 for sharing his finding.

Steffen-W commented 2 months ago

I speculate that a changeover to Python 3.12 will take place at some point, then the problem will no longer exist. Do any of you have an idea how I could solve the problem within the plugin?

BenRoe commented 1 month ago

Got this error (No module named 'pydantic') in MacOS 14.6.1, with KiCad 9.0 installed using brew. Note that KiCad in MacOS uses its own python. For me that's at /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/.

So running /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/pip3.9 --install pydantic solved the issue.

Thanks @Steffen-W for this very helpful tool!

I am on Mac OSX 15 with M2, Kicad 8.05 and had to change the command to /Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/pip3.9 install pydantic

Many thanks for the hint.