Closed chrisb2 closed 7 years ago
To install dependencies for Python 3 on Raspberry Pi, this need to be executed:
sudo python3 -m pip install git+git://github.com/chrisb2/pi_ina219.git
this fixes the import error above.
Thank you so much!! I was really stumped before I found this.
I'm not sure if I am doing something wrong or what but this is not fixing the issue for me? Everything works great if i us Python 2.7, but everything goes to pot when I try it on Python 3.6. When I run pip list I get:
Adafruit-GPIO (1.0.3) Adafruit-PureIO (0.2.1) asn1crypto (0.22.0) certifi (2017.4.17) cffi (1.10.0) chardet (3.0.4) conda (4.3.29) cryptography (1.9) idna (2.5) mock (2.0.0) packaging (16.8) pbr (3.1.1) pi-ina219 (1.1.0) pip (9.0.1) pycosat (0.6.1) pycparser (2.17) pyOpenSSL (16.2.0) pyparsing (2.2.0) pytube (8.0.2) requests (2.18.1) RPi.GPIO (0.6.3) ruamel.yaml (0.11.7) setuptools (36.0.1) six (1.10.0) spidev (3.2) urllib3 (1.21.1) wheel (0.29.0)
If you ran
pip list
then this gives you the packages install for Python 2, to see what is install for Python 3, you need:
pip3 list
Similarly to install the library for Python 3.6 you would need to use pip3. See INSTALLING PYTHON PACKAGES
What error are you getting? Can you provide an example of the failing code?
regards, Chris
Similar to rhaejr above, this fix isn't working. I'm getting an error when I run that line:
Downloading/unpacking git+git://github.com/chrisb2/pi_ina219.git
Cloning git://github.com/chrisb2/pi_ina219.git to /tmp/pip-vplibbw8-build
fatal: unable to connect to github.com:
github.com[0: 192.30.253.113]: errno=No route to host
github.com[1: 192.30.253.112]: errno=No route to host
Complete output from command /usr/bin/git clone -q git://github.com/chrisb2/pi_ina219.git /tmp/pip-vplibbw8-build:
----------------------------------------
Cleaning up...
Command /usr/bin/git clone -q git://github.com/chrisb2/pi_ina219.git /tmp/pip-vplibbw8-build failed with error code 128 in None
Storing debug log for failure in /root/.pip/pip.log
I looked in the debug log that was mentioned, and here's the output:
------------------------------------------------------------
/usr/lib/python3/dist-packages/pip/__main__.py run on Sat Feb 24 22:28:30 2018
Downloading/unpacking git+git://github.com/chrisb2/pi_ina219.git
Cloning git://github.com/chrisb2/pi_ina219.git to /tmp/pip-1zn5nw2s-build
Found command 'git' at '/usr/bin/git'
Running command /usr/bin/git clone -q git://github.com/chrisb2/pi_ina219.git /tmp/pip-1zn5nw2s-build
Complete output from command /usr/bin/git clone -q git://github.com/chrisb2/pi_ina219.git /tmp/pip-1zn5nw2s-build:
----------------------------------------
Cleaning up...
Command /usr/bin/git clone -q git://github.com/chrisb2/pi_ina219.git /tmp/pip-1zn5nw2s-build failed with error code 128 in None
Exception information:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 290, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python3/dist-packages/pip/req.py", line 1198, in prepare_files
do_download,
File "/usr/lib/python3/dist-packages/pip/req.py", line 1361, in unpack_url
unpack_vcs_link(link, loc, only_download)
File "/usr/lib/python3/dist-packages/pip/download.py", line 344, in unpack_vcs_link
vcs_backend.unpack(location)
File "/usr/lib/python3/dist-packages/pip/vcs/__init__.py", line 240, in unpack
self.obtain(location)
File "/usr/lib/python3/dist-packages/pip/vcs/git.py", line 111, in obtain
call_subprocess([self.cmd, 'clone', '-q', url, dest])
File "/usr/lib/python3/dist-packages/pip/util.py", line 716, in call_subprocess
% (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command /usr/bin/git clone -q git://github.com/chrisb2/pi_ina219.git /tmp/pip-1zn5nw2s-build failed with error code 128 in None
Looks like I'm having issues cloning the repo. Any thoughts?
It looks like from the error:
fatal: unable to connect to github.com
that github.com in not contactable by your machine, what happens if you do:
ping github.com
If this does not work, you may need to check your network setup.
Chris
I think you're right, it seems to be a network issue. (I can connect to the internet via GUI apps or apt-get commands, but I can't ping or use git to clone)
In any case, I was able to install the package via sudo pip3 install pi-ina219
. Thanks for your help!
Hi
I had this problem before and managed to fix it with
sudo python3 -m pip install git+git://github.com/chrisb2/pi_ina219.git
Adafruit_GPIO was indeed not listed on pip3 list.
Unfortunatelly I got some system upgrades and now the following error occurs again:
File "/home/pi/Desktop/python-lis3dh-master/LIS3DH_bus1.py", line 2, in <module> from Adafruit_GPIO import I2C ImportError: No module named 'Adafruit_GPIO'
but now when I checked the lists Adafruit_GPIO was present on both and installing dependecies for python 3 doesn't seem to work :/
Please help
Try using pip3 to uninstall pi_ina219 and Adafruit_GPIO, check they are no longer listed by pip3 list, then re-install pi_ina219.
Chris
Thanks for response. I tried what you suggested but it didn't work. Still got the same error.
Please can you send me a simplied version of the LIS3DH_bus1.py which replicates this issue and I will give it a go myself. This will help to isolate if the issue is in the program or your system.
regards, Chris
On Sat, Mar 3, 2018 at 10:00 AM, GawiQ notifications@github.com wrote:
Thanks for response. I tried what you suggested but it didn't work. Still got the same error.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/chrisb2/pi_ina219/issues/2#issuecomment-370050898, or mute the thread https://github.com/notifications/unsubscribe-auth/AC8dV2UyZr7F8lgzXSsoyI0EzPLfObSDks5tabLdgaJpZM4L3C_7 .
One more idea, did you try unistalling Adafruit_GPIO and then following manual install instructions here:
https://github.com/adafruit/Adafruit_Python_GPIO
Chris
On Sat, Mar 3, 2018 at 12:13 PM, Chris Borrill chris.borrill@gmail.com wrote:
Please can you send me a simplied version of the LIS3DH_bus1.py which replicates this issue and I will give it a go myself. This will help to isolate if the issue is in the program or your system.
regards, Chris
On Sat, Mar 3, 2018 at 10:00 AM, GawiQ notifications@github.com wrote:
Thanks for response. I tried what you suggested but it didn't work. Still got the same error.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/chrisb2/pi_ina219/issues/2#issuecomment-370050898, or mute the thread https://github.com/notifications/unsubscribe-auth/AC8dV2UyZr7F8lgzXSsoyI0EzPLfObSDks5tabLdgaJpZM4L3C_7 .
LIS3DH_bus1.py.gz Manual installation didn't work. Do you think system reinstallation would work? Here is the file
On a new installation of Raspbian I did:
So from this is does look like your system is to blame. So reinstalling Rasbian will work.
Chris
On Sun, Mar 4, 2018 at 12:06 PM, GawiQ notifications@github.com wrote:
LIS3DH_bus1.py.gz https://github.com/chrisb2/pi_ina219/files/1777999/LIS3DH_bus1.py.gz Manual installation didn't work. Do you think system reinstallation would work? Here is the file
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/chrisb2/pi_ina219/issues/2#issuecomment-370187137, or mute the thread https://github.com/notifications/unsubscribe-auth/AC8dV1HgP2JZYnP2SJ9bT4rTo1uAPXJSks5tayH8gaJpZM4L3C_7 .
Did the same and now it works. Thanks man, really appreciate this. Awesome helping you did here :)
These errors occur:
and: