Page 1 of 1

rpi2 jessie python-can

Posted: Mon Jan 07, 2019 10:00 am
by AntsuS
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 $ 

Re: rpi2 jessie python-can

Posted: Mon Jan 07, 2019 9:40 pm
by paddyg
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

Re: rpi2 jessie python-can

Posted: Mon Jan 07, 2019 9:55 pm
by DougieLawson
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!

Re: rpi2 jessie python-can

Posted: Tue Jan 08, 2019 8:06 am
by AntsuS
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!