internet-pi
internet-pi copied to clipboard
Install Docker Compose using Pip not working
it gets stuck on this and then
=============================DEBUG ASSISTANCE=============================\n If you are seeing a compilation error please try the following steps to\n successfully install cryptography:\n 1) Upgrade to the latest pip and try again. This will fix errors for most\n users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip\n 2) Read https://cryptography.io/en/latest/installation/ for specific\n instructions for your platform.\n 3) Check our frequently asked questions for more information:\n https://cryptography.io/en/latest/faq/\n 4) Ensure you have a recent Rust toolchain installed:\n https://cryptography.io/en/latest/installation/#rust\n \n Python: 3.10.0\n platform: Linux-5.10.63-v7l+-armv7l-with-glibc2.28\n pip: n/a\n setuptools: 60.0.3\n setuptools_rust: 1.1.2\n =============================DEBUG ASSISTANCE=============================\n \n error: can't find Rust compiler\n \n If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.\n \n To update pip, run:\n \n pip install --upgrade pip\n \n and then retry package installation.\n \n If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.\n \n This package requires Rust >=1.41.0.\n ----------------------------------------\n ERROR: Failed building wheel for cryptography\nERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly\nWARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.\nYou should consider upgrading via the '/usr/local/bin/python3.10 -m pip install --upgrade pip' command.\n"}
PLAY RECAP **************************************************************************************** 192.168.1.133 : ok=6 changed=0 unreachable=0 failed=1 skipped=4 rescued=0 ignored=0
i have been trying to work on DEBUG and when i put
pip install --upgrade pip Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Requirement already satisfied: pip in ./.local/lib/python3.10/site-packages (21.3.1)
and python version
python --version Python 3.7.3
python3 --version Python 3.10.0
can somone help please and thanks in advance
Your error message indicates that the rust compiler is missing.
Install it with:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
and try again?
okay i will give that try now thanks
Your error message indicates that the rust compiler is missing.
Install it with:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shand try again?
it installed what and i run it agein and got this
=============================DEBUG ASSISTANCE=============================\n If you are seeing a compilation error please try the following steps to\n successfully install cryptography:\n 1) Upgrade to the latest pip and try again. This will fix errors for most\n users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip\n 2) Read https://cryptography.io/en/latest/installation/ for specific\n instructions for your platform.\n 3) Check our frequently asked questions for more information:\n https://cryptography.io/en/latest/faq/\n 4) Ensure you have a recent Rust toolchain installed:\n https://cryptography.io/en/latest/installation/#rust\n \n Python: 3.10.0\n platform: Linux-5.10.63-v7l+-armv7l-with-glibc2.28\n pip: n/a\n setuptools: 60.9.3\n setuptools_rust: 1.1.2\n =============================DEBUG ASSISTANCE=============================\n \n error: can't find Rust compiler\n \n If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.\n \n To update pip, run:\n \n pip install --upgrade pip\n \n and then retry package installation.\n \n If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.\n \n This package requires Rust >=1.41.0.\n ----------------------------------------\n ERROR: Failed building wheel for cryptography\nERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly\nWARNING: You are using pip version 21.2.3; however, version 22.0.3 is available.\nYou should consider upgrading via the '/usr/local/bin/python3.10 -m pip install --upgrade pip' command.\n"}
PLAY RECAP ********************************************************************************** 192.168.1.133 : ok=6 changed=0 unreachable=0 failed=1 skipped=4 rescued=0 ignored=0
if neeed more let me know
You might need to restart your shell though. Have you logged out and in?
Or you might just need to add it to your PATH variable. The rust compiler should be in ~/.cargo/bin
If that doesn't help, then maybe try to install docker-compose this way: https://dev.to/elalemanyo/how-to-install-docker-and-docker-compose-on-raspberry-pi-1mo
You need to have some development libraries installed. As described in the link above.
i get to 'sudo pip3 install docker-compose' and i get this
=============================DEBUG ASSISTANCE=============================
error: can't find Rust compiler
If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
To update pip, run:
pip install --upgrade pip
and then retry package installation.
If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
This package requires Rust >=1.41.0.
ERROR: Failed building wheel for cryptography Failed to build cryptography ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly WARNING: You are using pip version 21.2.3; however, version 22.0.3 is available. You should consider upgrading via the '/usr/local/bin/python3.10 -m pip install --upgrade pip' command.
and i run ''pip install --upgrade pip''
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in ./.local/lib/python3.10/site-packages (22.0.3)
so i don't what wrong
Right, in that case you need the rust compiler for all users. I think you might have installed it only for the user.
Best to deinstall the rust compiler for your user with: rustup self uninstall
And then install it with: sudo apt install rustc
That way it should be available when you do: sudo pip3 install docker-compose
Hang on, I think you can also just install docker-compose via apt: sudo apt install docker-compose
Maybe just try that.
well at the moment im at Building wheel for cryptography (PEP 517) ... /
okay this is what i get now i think we getting close and thank for your help so far
TASK [Ensure internet-monitoring environment is running.] **********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/init.py)
fatal: [192.168.1.133]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker above 5.0.0 (Python >= 3.6) or docker before 5.0.0 (Python 2.7) or docker-py (Python 2.6)) on raspberrypi-server's Python /usr/local/bin/python3.10. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via pip install docker (Python >= 3.6) or pip install docker==4.4.4 (Python 2.7) or pip install docker-py (Python 2.6). The error was: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/init.py)"}
RUNNING HANDLER [Restart internet-monitoring] **********************************************
PLAY RECAP ********************************************************************************* 192.168.1.133 : ok=15 changed=6 unreachable=0 failed=1 skipped=4 rescued=0 ignored=0
Great, looks like you breezed past your initial problem.
Now you only seem to need additional packages, like the docker sdk.
However, I haven't had these many problems when following the install instructions. Which Python version are you using? python3 --version
python3 --version Python 3.10.0
python --version Python 3.7.3
and what do you mean by docker sdk
If you're using Python 3.10 then your current problem is something else. You are too cutting edge with your version. They changed the collections API from collections.Mapping to be collections.abc.Mapping. Starting with Python 3.10. Hence you get the error: The error was: cannot import name 'Mapping' from 'collections'
I think the easiest for you is to just do the install steps within a virtual python environment, for example within the internet-pi folder: python3 -m virtualenv --python=[path to your python 3.7.3 bin] ansible and then activate that virtual environment with source ./ansible/bin/activate
Start with the pip3 install ansible step and work your way through.
okay i will give it a try
Or try to upgrade your python 3.10 to a more recent version. Some people report that this problem doesn't exist with 3.10.2.
okay i will give that a try becouse i just run python3 -m virtualenv --python=[/usr/lib/python3.7] ansible /usr/local/bin/python3: No module named virtualenv
but it was a pain to get python 3.10 on and working
Tbh, it's usually not worth the pain to be on the latest version. I think 3.8 or 3.9 should be absolutely fine for most use cases.
And in case you want to go down the line of the virtualenv in the future, you would need to remove the brackets around the python: python3 -m virtualenv --python=/usr/lib/python3.7 ansible Also, I would think it should be in /usr/bin and not in /usr/lib.
Good luck and have fun!
i got python -V Python 3.8.12 installed but still get the same error as before and then i try virtualenv i get
python -m virtualenv --python=/usr/bin/python3.8 ansible /usr/local/bin/python3.8: No module named virtualenv
Pip3 install virtualenv
but before you go down that route make sure you understand what virtualenv is: https://docs.python-guide.org/dev/virtualenvs/
okay but i just tryed agen and got this error and it looks difrent
TASK [Ensure internet-monitoring environment is running.] ****************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/init.py)
fatal: [192.168.1.133]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker above 5.0.0 (Python >= 3.6) or docker before 5.0.0 (Python 2.7) or docker-py (Python 2.6)) on raspberrypi-server's Python /usr/local/bin/python3.10. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via pip install docker (Python >= 3.6) or pip install docker==4.4.4 (Python 2.7) or pip install docker-py (Python 2.6). The error was: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/init.py)"}
PLAY RECAP *************************************************************************************** 192.168.1.133 : ok=12 changed=1 unreachable=0 failed=1 skipped=7 rescued=0 ignored=0
and i just try to install virtualenv Pip3 install virtualenv bash: Pip3: command not found
Right, think my advice with virtualenv is not correct. Ansible will connect to your local host / host and probably use the system installed Python anyway.
And your problem is still your Python 3.10 install with it’s breaking change in the collections package. (See the collections.abc comment above) Probably best to use stackoverflow from here and search for a solution or you just need to wait until this has been addressed by Python updates. Your problem is with your system environment and not an issue with internet-pi.
The only two options I see as feasible for your level of Python knowledge is:
- Upgrade to 3.10.2 and see if that fixes it; or
- Downgrade your system wide Python install to 3.9
Or just follow what the error message tells you: install docker with pip install docker on your host 192.168.1.133 manually and see if that helped.
well i already have docker install and running this second and im looking to change my Python3 becouse when i try sudo update-alternatives --config python3 update-alternatives: error: no alternatives for python3
bur for
sudo update-alternatives --config python There are 4 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
0 /usr/local/bin/python3.10 2 auto mode
- 1 /usr/bin/python3 1 manual mode 2 /usr/bin/python3.10 1 manual mode 3 /usr/bin/python3.8 1 manual mode 4 /usr/local/bin/python3.10 2 manual mode
Press
You mentioned above that you have installed python 3.8 already. I assume that you’re talking about your host 192.168.1.133?
As a work around you could just link your Python3 in /usr/bin to 3.8.
sudo rm /usr/bin/python3
and then
sudo ln -s /usr/local/bin/python3.8 /usr/bin/python3
Try the internet-pi install then.
After successful doing this, change it back to 3.10, so you don’t break any other installs?
i only put 3.10 for this and this is the new error after doing both commands
TASK [Ensure apt cache is up to date.] ********************************************************** [WARNING]: Updating cache and auto-installing missing dependency: python3-apt fatal: [192.168.1.133]: FAILED! => {"changed": false, "msg": "python3-apt must be installed and visible from /usr/local/bin/python3.10."}
PLAY RECAP ************************************************************************************** 192.168.1.133 : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Well, I recommended the work around so you would use Python 3.8 instead of 3.10.
Just relink /use/bin/python3 to /usr/bin/python3.10 and google your error message.
Take it from there. Because at the moment your problem is using a Python version that is too new and therefore introducing some additional problems. It’s always the risk of being too fast on recent Python versions, because you will have some packages breaking due to hard API changes at major releases. You most likely would be all good with Python 3.8 or 3.9.
Very weird, I tested the install on a Debian 10 virtual machine with only Python 3.10.0 and I had absolutely no problem.
However, there might be another more simple way to help you out. In your inventory.ini, put the following behind your host declaration for 192.168.1.133: ansible_python_interpreter=/usr/bin/python3.7 For example, this line would look now like: 192.168.1.133 ansible_user=pi ansible_python_interpreter=/usr/bin/python3.7
Or if you replaced your Python 3.7 with 3.8 now, then this should be ansible_python_interpreter=/usr/bin/python3.8
I think that theoretically should avoid that ansible is using python3.10 on the host machine.
i just try to relink 3.10 but sudo ln -s /usr/local/bin/python3.10 /usr/bin/python3 ln: failed to create symbolic link '/usr/bin/python3': File exists
and then i try to run that command sudo ln -s /usr/local/bin/python3.8 /usr/bin/python3 ln: failed to create symbolic link '/usr/bin/python3': File exists
and i run ansible_python_interpreter=/usr/bin/python3.8 or ansible_user=pi ansible_python_interpreter=/usr/bin/python3.7 or ansible_python_interpreter=/usr/bin/python3.7
ansible-playbook main.yml
TASK [Ensure apt cache is up to date.] ********************************************************** [WARNING]: Updating cache and auto-installing missing dependency: python3-apt fatal: [192.168.1.133]: FAILED! => {"changed": false, "msg": "python3-apt must be installed and visible from /usr/local/bin/python3.10."}
PLAY RECAP ************************************************************************************** 192.168.1.133 : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0