Install aip on Mac High Sierra

Hello, i tried to install aip on Mac following https://wiki.seeedstudio.com/ArduPy/#install-aip-with-macos 1) homebrew 2) python3 3) pip3 install ardupy-aip
I had to manually create dir .config, then install went smooth, but if i tried to run aip i got this error :

File “/usr/local/bin/aip”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.9/site-packages/aip/main.py”, line 52, in main
from aip.command import commands_dict, parse_command
File “/usr/local/lib/python3.9/site-packages/aip/command.py”, line 46, in
from aip.build import buildCommand
File “/usr/local/lib/python3.9/site-packages/aip/build.py”, line 34, in
from pip._internal.operations.prepare import (
ImportError: cannot import name ‘_download_http_url’ from ‘pip._internal.operations.prepare’ (/usr/local/lib/python3.9/site-packages/pip/_internal/operations/prepare.py)

Many thanks for any help.

seems like your pip3 path is not in your $PATH? you may try echo $PATH and see

Hi, many thanks, looks like, it really isnt there. But it didnt help,
my echo $PATH looks like:
/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin/python3:/Applications/VMware Fusion.app/Contents/Public

Error message :
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.9/bin/aip”, line 8, in
sys.exit(main())
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aip/main.py”, line 52, in main
from aip.command import commands_dict, parse_command
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aip/command.py”, line 47, in
from aip.install import installCommand
File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/aip/install.py”, line 34, in
import requests
ModuleNotFoundError: No module named ‘requests’

Do you have a complicated python env? Seems like the script not wokring properly. Can you run pip3 install request request

Output :
ERROR: Could not find a version that satisfies the requirement request (from versions: none)

ERROR: No matching distribution found for request

WARNING: You are using pip version 20.2.3; however, version 20.3 is available.

You should consider upgrading via the ‘/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip’ command.

Please could you try the installtion in a python virtual env such as this: https://docs.python.org/3/tutorial/venv.html

Hi, many thanks, now it works. But after all this effort i found that Python libraries exist only for few components, but not for EC sensor which i need.

1 Like

Anyone with a fix for the original error ( ‘_download_http_url’ from ‘pip._internal.operations.prepare’ ) under Catalina? Looking at the source code on GITHUB for ‘prepare’ the function is not present…

Tried both python.org and brew versions of Python and virtual environment.

I’m also under macOS Catalina and works fine, can you show us the full error msg?

The command I am issuing is the aip help from terminal as a normal user and I get back:

update local board json...
http://files.seeedstudio.com/ardupy/package_new_seeeduino_ardupy_index.json
done!
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/aip", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/aip/main.py", line 52, in main
    from aip.command import commands_dict, parse_command
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/aip/command.py", line 46, in <module>
    from aip.build import buildCommand
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/aip/build.py", line 34, in <module>
    from pip._internal.operations.prepare import (
ImportError: cannot import name '_download_http_url' from 'pip._internal.operations.prepare' (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip/_internal/operations/prepare.py)

This is with Python 3.8.6 installed from python.org and the local version installed with brew removed.
Pip3 reports version 20.3.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

seems like an error from pip version 20:

Can you check the solution here for virtual env:

Tried a couple of things based on that link but aip still references the base pip in the /Library/Frameworks rather than the virtual env.

Next is to try zapping Python and pip off the machine but get the feeling that a supplier of dev tools that is relying on old versions of packages (without forking the code) will be frowned on and that’s before we start development :frowning: :roll_eyes:

Well that did not work. Mac has:

  • Python 2.7.16
  • Python 3.8.6
  • Pip 18.1 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

BUT as part of the install I get:

ardupy-aip 0.8.1 requires pip>=20.1, but you’ll have pip 18.1 which is incompatible.

So upgrading pip to 20.1 with sudo -H python3 get-pip.py pip==20.1 gives a different error:

ModuleNotFoundError: No module named ‘requests’

but a quick sudo -H pip install requests gives me an aip command that does not error on the help!

So it looks like the process is:

  1. Install Python 3 on the Mac from python.org
  2. Download get-pip.py
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  3. Run that to install version 20.1
    sudo -H python3 get-pip.py pip==20.1
  4. Add the ‘requests’ module using pip sudo -H pip install requests

This MAY work in a virtual env but I’m not testing that til 2021.

FORGET IT - the next thing I try dies with

FileNotFoundError: [Errno 2] No such file or directory: '/Users/andrew/.config/aip/modules’

Going to ask for working instructions from the devs.