adafruit / Adafruit_CircuitPython_MCP2515

A CircuitPython library for working with the MCP2515 CAN bus controller
MIT License
21 stars 14 forks source link

Import Error #6

Closed guilherme-daros closed 3 years ago

guilherme-daros commented 3 years ago

Every time I try importing this module into my python code the interpreter raises this ModuleNotFoundError exception. I checked and the package is in the .env/lib/python3.7/site-packages folder.

My hardware is a Raspberry Pi Zero W

Any sugestions?

Python 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import adafruit_mcp2515
Traceback (most recent call last):
  File "<stdin>", line 1 in <module>
ModuleNotFoundError: No module named 'adafruit_mcp2515'
>>>
evaherrada commented 3 years ago

Pretty sure I've found the issue. Gonna release and then test it

evaherrada commented 3 years ago

@ladyada So it sees it now that I changed it to packages instead of py_modules, but it gets hung up on line 31 of init when it tries to import .canio. I think that if I add adafruit_mcp2515.canio to packages that might fix it, but I wanted to see if you knew if that is the right thing to do first.

Edit: Or should I do something like this? https://github.com/adafruit/Adafruit_CircuitPython_BLE/blob/master/setup.py#L52

ladyada commented 3 years ago

ahh i have no idea - i think try the BLE thingy? let me know if that works :D

evaherrada commented 3 years ago

Ok. I'll give it a go

evaherrada commented 3 years ago

@ladyada So that didn't work. It's technically less broken than it was before but it still doesn't import right. I'll try one other thing but after that, I'm pretty out of ideas.

evaherrada commented 3 years ago

@guilherme-daros Hey could you try reinstalling it (with either -U or --force-reinstall) and let me know if you can import it. I got it working and tested on a Pi 4 but the issue had to do with setup.py so it should hopefully work on your Zero W. Thanks!

guilherme-daros commented 3 years ago

it works!! thank you so much

evaherrada commented 3 years ago

No problem. Glad it works!