AntsuS
Posts: 2
Joined: Mon Jan 07, 2019 8:41 am

rpi2 jessie python-can

Mon Jan 07, 2019 10:00 am

Hello,

Trying to use python-can with raspi2 / jessie.
I installed/tried to install python-can via pip3 can package. Instaal looks to be ok, but python does not find module.
Tried to google around to get answer, but did not find any help....

CAN interface with IXXAT usb to CAN v2 seems to be working find after compiling kernel module. (can-utils work and socket is up)

Code: Select all

pi@raspberrypi:~/Desktop $ sudo pip3 install can
Requirement already satisfied (use --upgrade to upgrade): can in /usr/local/lib/python3.4/dist-packages
Cleaning up...
pi@raspberrypi:~/Desktop $ 

Code: Select all

pi@raspberrypi:/usr/local/lib/python3.4/dist-packages $ ls
can-2.0.egg-info  libcan
pi@raspberrypi:/usr/local/lib/python3.4/dist-packages $ 

Code: Select all

pi@raspberrypi:~/Desktop $ python3.4 j1939CANlogger.py 
Traceback (most recent call last):
  File "j1939CANlogger.py", line 2, in <module>
    import can
ImportError: No module named 'can'
pi@raspberrypi:~/Desktop $ 
System Info:

Code: Select all

pi@raspberrypi:/usr/local/lib/python3.4/dist-packages $ uname -a
Linux raspberrypi 4.9.80-v7+ #1 SMP Thu Jan 3 21:30:06 EET 2019 armv7l GNU/Linux
pi@raspberrypi:/usr/local/lib/python3.4/dist-packages $ 

pi@raspberrypi:/usr/local/lib/python3.4/dist-packages $ python3 --version
Python 3.4.2
pi@raspberrypi:/usr/local/lib/python3.4/dist-packages $ 

User avatar
paddyg
Posts: 2555
Joined: Sat Jan 28, 2012 11:57 am
Location: UK

Re: rpi2 jessie python-can

Mon Jan 07, 2019 9:40 pm

No idea what `can` is but often the python modules are prefixed by `python-` or `python3-` when being installed - but change their name when accessed with import. So often the debian install package can be installed something along the lines of

Code: Select all

$ sudo apt-get install python3-can
(but I say I don't know if that's the package you want) Or using pip something like

Code: Select all

sudo pip3 install python-can
Again don't know if that's the right module but there is something called that i.e. https://github.com/hardbyte/python-can/ ... tup.py#L47
also https://groups.google.com/forum/?hl=en-GB&fromgroups=#!forum/pi3d

User avatar
DougieLawson
Posts: 39301
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: rpi2 jessie python-can

Mon Jan 07, 2019 9:55 pm

Why are you using Raspbian Jessie? Stretch is ready to be replaced with Raspbian Buster this year. Raspbian Jessie was replaced by Raspbian Stretch two years ago.

The time to upgrade to Raspbian Stretch is NOW!
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

AntsuS
Posts: 2
Joined: Mon Jan 07, 2019 8:41 am

Re: rpi2 jessie python-can

Tue Jan 08, 2019 8:06 am

Using Jessie since I had old rpi2 for prototyping. I have ordered new rpi3 and will use that one for actual project.
Originally I had wrong package name as Paddyg indicated. Thanks! python-can is right one.

Problem at the moment is that pip3 tries to install module to python3 folder instead python3.4.
Maybe I have installed python3 in some point and that causes problems.

I tried yesterday:
py -3.4 -m pip install python-can

Still it goes to python3 folder instead of python3.4

Edit:
I reinstalled python 3.4 and upgraded pip3:
Problem Solved! Thanks for support!

Return to “Python”