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

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

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 $

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 $

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

System Info:

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 $

Based on first answer:

pi@raspberrypi:~ $ sudo pip3 install python-can Downloading/unpacking python-can Downloading python_can-3.0.0-py2.py3-none-any.whl (123kB): 123kB downloaded Cleaning up... Exception: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2595, in _dep_map return self.dep_map File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2457, in __getattr raise AttributeError(attr) AttributeError: _DistInfoDistribution__dep_map..... lot more errors....

So I was able to download python-can package, but not able install. :-( I assume that I have somekind of dependency issue.


You did

sudo pip3 install can

which apperantly installs a filesystem backup utility.

You should do

sudo pip3 install python-can

to install python-can. Then you should be able to find the module.

For your python-can installation issue, try upgrading pip first:

sudo -H pip3 install --upgrade pip
| improve this answer | |
  • Thanks! I tried to install python-can first, but install did not work. Then I got confused in the names.... :-( – AntsuS Jan 7 '19 at 16:11
  • @Antero Salojärvi I have suggested a possible solution in my updated answer. – oh.dae.su Jan 7 '19 at 18:42
  • Thanks! I try that after I get rpi to boot up again. I noticed that I had python3 and python3.4 installed. Removing those caused my rpi fail to boot. I will upgrade to fresh installation of strech. Maybe my problems is solved with that. – AntsuS Jan 8 '19 at 8:12
  • I managed to make Jessie to boot up again, installed python3.4 again and upgraded pip3. --> Problem solved! Thank you for support! – AntsuS Jan 8 '19 at 8:46
  • Sure, you are welcome! :-) – oh.dae.su Jan 8 '19 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.