Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Docker Compose using Pip not working #299

Open
joeythecat4 opened this issue Dec 21, 2021 · 65 comments
Open

Install Docker Compose using Pip not working #299

joeythecat4 opened this issue Dec 21, 2021 · 65 comments
Labels
bug Something isn't working

Comments

@joeythecat4
Copy link

joeythecat4 commented Dec 21, 2021

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

@joeythecat4 joeythecat4 changed the title TASK [Install Docker Compose using Pip.] Install Docker Compose using Pip not working Dec 26, 2021
@martinbrose
Copy link
Contributor

martinbrose commented Mar 3, 2022

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?

@joeythecat4
Copy link
Author

okay i will give that try now
thanks

@joeythecat4
Copy link
Author

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?

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

@martinbrose
Copy link
Contributor

martinbrose commented Mar 3, 2022

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

@martinbrose
Copy link
Contributor

martinbrose commented Mar 3, 2022

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.

@joeythecat4
Copy link
Author

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

@martinbrose
Copy link
Contributor

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

@martinbrose
Copy link
Contributor

Hang on, I think you can also just install docker-compose via apt:
sudo apt install docker-compose

Maybe just try that.

@joeythecat4
Copy link
Author

well at the moment im at
Building wheel for cryptography (PEP 517) ... /

@joeythecat4
Copy link
Author

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

@martinbrose
Copy link
Contributor

martinbrose commented Mar 3, 2022

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

@joeythecat4
Copy link
Author

joeythecat4 commented Mar 3, 2022

python3 --version
Python 3.10.0

python --version
Python 3.7.3

@joeythecat4
Copy link
Author

and what do you mean by docker sdk

@martinbrose
Copy link
Contributor

martinbrose commented Mar 3, 2022

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.

@joeythecat4
Copy link
Author

okay i will give it a try

@martinbrose
Copy link
Contributor

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.

@joeythecat4
Copy link
Author

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

@martinbrose
Copy link
Contributor

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!

@joeythecat4
Copy link
Author

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

@martinbrose
Copy link
Contributor

Pip3 install virtualenv

but before you go down that route make sure you understand what virtualenv is:
https://docs.python-guide.org/dev/virtualenvs/

@joeythecat4
Copy link
Author

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

@joeythecat4
Copy link
Author

and i just try to install virtualenv
Pip3 install virtualenv
bash: Pip3: command not found

@martinbrose
Copy link
Contributor

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

@martinbrose
Copy link
Contributor

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.

@joeythecat4
Copy link
Author

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 to keep the current choice[*], or type selection number:

@martinbrose
Copy link
Contributor

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?

@joeythecat4
Copy link
Author

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

@martinbrose
Copy link
Contributor

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.

@martinbrose
Copy link
Contributor

martinbrose commented Mar 7, 2022

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.

@martinbrose
Copy link
Contributor

Right, so how did your inventory.ini look before you made the change?

@joeythecat4
Copy link
Author

what it was

0[internet_pi]
#10.0.100.52 ansible_user=pi

Comment out the previous line and uncomment this to run inside Raspberry Pi.

192.168.1.133 ansible_connection=local ansible_user=pi

what it is at the moment

0[internet_pi]
#10.0.100.52 ansible_user=pi

Comment out the previous line and uncomment this to run inside Raspberry Pi.

192.168.1.133 ansible_connection=local ansible_user=pi ansible_python_interpreter=/usr/bin/python3.8

@martinbrose
Copy link
Contributor

martinbrose commented Mar 7, 2022

I think you accidentally added a 0 in front of [internet_pi]. That's the reason your inventory.ini can't be parsed.

@joeythecat4
Copy link
Author

okay well i have trid with and without the 0 and it hass been here a while but not braking it like now so somthing we are going make that a problem/fixed but i now get that long error but i have ''ansible_python_interpreter=/usr/bin/python3.8'' in the inventory.ini

TASK [Install Docker Compose using Pip.] ***************************************************
fatal: [192.168.1.133]: FAILED! => {"changed": false, "cmd": ["/usr/local/bin/pip3", "install", "docker-compose"], "msg": "\n:stderr: ERROR: Exception:\nTraceback (most recent call last):\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 173, in _main\n status = self.run(options, args)\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 203, in wrapper\n return func(self, options, args)\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/commands/install.py", line 266, in run\n session = self.get_default_session(options)\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 74, in get_default_session\n self._session = self.enter_context(self._build_session(options))\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 88, in _build_session\n session = PipSession(\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 289, in init\n self.headers["User-Agent"] = user_agent()\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 132, in user_agent\n linux_distribution = distro.linux_distribution() # type: ignore\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution\n return _distro.linux_distribution(full_distribution_name)\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution\n self.version(),\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 741, in version\n self.lsb_release_attr('release'),\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr\n return self._lsb_release_info.get(attribute, '')\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 556, in get\n ret = obj.dict[self._fname] = self._f(obj)\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info\n stdout = subprocess.check_output(cmd, stderr=devnull)\n File "/usr/local/lib/python3.10/subprocess.py", line 420, in check_output\n return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n File "/usr/local/lib/python3.10/subprocess.py", line 524, in run\n raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.\nTraceback (most recent call last):\n File "/usr/local/bin/pip3", line 8, in \n sys.exit(main())\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/main.py", line 70, in main\n return command.main(cmd_args)\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 98, in main\n return self._main(args)\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/base_command.py", line 214, in _main\n self.handle_pip_version_check(options)\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 143, in handle_pip_version_check\n session = self._build_session(\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/cli/req_command.py", line 88, in _build_session\n session = PipSession(\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 289, in init\n self.headers["User-Agent"] = user_agent()\n File "/usr/local/lib/python3.10/site-packages/pip/_internal/network/session.py", line 132, in user_agent\n linux_distribution = distro.linux_distribution() # type: ignore\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution\n return _distro.linux_distribution(full_distribution_name)\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution\n self.version(),\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 741, in version\n self.lsb_release_attr('release'),\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr\n return self._lsb_release_info.get(attribute, '')\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 556, in get\n ret = obj.dict[self._fname] = self._f(obj)\n File "/usr/local/lib/python3.10/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info\n stdout = subprocess.check_output(cmd, stderr=devnull)\n File "/usr/local/lib/python3.10/subprocess.py", line 420, in check_output\n return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n File "/usr/local/lib/python3.10/subprocess.py", line 524, in run\n raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.\n"}

PLAY RECAP *********************************************************************************
192.168.1.133 : ok=6 changed=0 unreachable=0 failed=1 skipped=4 rescued=0 ignored=0

@martinbrose
Copy link
Contributor

It looks like your host still uses pip3 from Python 3.10.

What do you get when you enter pip3 --version?

@joeythecat4
Copy link
Author

pip3 --version
pip 22.0.3 from /home/pi/.local/lib/python3.10/site-packages/pip (python 3.10)

@martinbrose
Copy link
Contributor

martinbrose commented Mar 7, 2022

Could you do the following?
sudo update-alternatives --config python
Make sure you select Python 3.8.

sudo apt install --reinstall python3-pip
python3.8 -m pip install pip

Then again:
pip3 --version

@joeythecat4
Copy link
Author

yes python3.8 but then i run ''python3.8 -m pip install pip''

Defaulting to user installation because normal site-packages is not writeable
ERROR: Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 180, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 204, in wrapper
return func(self, options, args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 269, in run
session = self.get_default_session(options)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 77, in get_default_session
self._session = self.enter_context(self._build_session(options))
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 87, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/site-packages/pip/_internal/network/session.py", line 275, in init
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/site-packages/pip/_internal/network/session.py", line 132, in user_agent
linux_distribution = distro.linux_distribution() # type: ignore
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
self.version(),
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 741, in version
self.lsb_release_attr('release'),
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 556, in get
ret = obj.dict[self._fname] = self._f(obj)
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/local/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/site-packages/pip/main.py", line 31, in
sys.exit(_main())
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 71, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 104, in main
return self._main(args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 221, in _main
self.handle_pip_version_check(options)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 143, in handle_pip_version_check
session = self._build_session(
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 87, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/site-packages/pip/_internal/network/session.py", line 275, in init
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/site-packages/pip/_internal/network/session.py", line 132, in user_agent
linux_distribution = distro.linux_distribution() # type: ignore
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
self.version(),
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 741, in version
self.lsb_release_attr('release'),
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 556, in get
ret = obj.dict[self._fname] = self._f(obj)
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/usr/local/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/local/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

@martinbrose
Copy link
Contributor

martinbrose commented Mar 7, 2022

You might also just need to perform the following:
sudo apt-get install --reinstall lsb_release

@joeythecat4
Copy link
Author

joeythecat4 commented Mar 7, 2022

nope run ''sudo apt-get install --reinstall lsb_release'' then ''python3.8 -m pip install pip'' i get the same error

@martinbrose
Copy link
Contributor

What is the first line of:
less /usr/bin/lsb_release

@joeythecat4
Copy link
Author

joeythecat4 commented Mar 7, 2022

#!/usr/bin/python3 -Es
or
from optparse import OptionParser

(Depending on what you mean by first line ie first line of all or first line that's not crossed out)

@martinbrose
Copy link
Contributor

The problem might be too many different python installs now and we are jumping from one problem to another.

Do you have anything important on your Raspberry Pi?
Might be good to just do a fresh install, do the internet-pi install and then play around with Python 3.10 after that?

@joeythecat4
Copy link
Author

yes i do my minecraft server and my docker of home-assistant

@joeythecat4
Copy link
Author

joeythecat4 commented Mar 7, 2022

i do have a Speedtest. net integrations on home-assistant but the graf but only show the past 24h ( i wnat the Internet Pi is becuse my isp reports one thing but my pc and rp4 show difrent and i can see and feel on the internet my pc and rp4 are corret) and i don't need Python 3.10 at all. all i run is docker and java (minecraft server)

@martinbrose
Copy link
Contributor

Ok, I see.

Here are some pointers for your current problem:
https://stackoverflow.com/questions/46752279/lsb-release-not-working-after-install-python-3-6-3-from-source
https://stackoverflow.com/questions/44967202/pip-is-showing-error-lsb-release-a-returned-non-zero-exit-status-1
Make sure you make backup copies of any files you delete in the process, so you can roll-back changes.

If you want to solve this in an easier way and you're not reliant on either 3.10 or 3.8 , I would deinstall these for now (https://stackoverflow.com/questions/48899604/how-to-uninstall-python-in-ubuntu-completely-and-reinstalling-it).
And reinstall the Python3 packages from the Distribution
sudo apt-get reinstall python3 python3-pip

@joeythecat4
Copy link
Author

okay i will get to backing up my rp4 and work out what parts i need from

If you want to solve this in an easier way and you're not reliant on either 3.10 or 3.8 , I would deinstall these for now (https://stackoverflow.com/questions/48899604/how-to-uninstall-python-in-ubuntu-completely-and-reinstalling-it). And reinstall the Python3 packages from the Distribution sudo apt-get reinstall python3 python3-pip

@joeythecat4
Copy link
Author

i backed up my rp4 last night and now run for 3.7 3.8 3.10
sudo rm -rf /usr/bin/python3.10
sudo rm -rf /usr/lib/python3.10
sudo rm -rf /usr/local/lib/python3.10

but there are are still instaled but i tryed sudo apt-get reinstall python3 python3-pip and now i have new backgrond and some stuff looks difrent too

and i have tryed but all pythons there
sudo apt-get remove python3.10 --purge

@martinbrose
Copy link
Contributor

Not sure I understand what exactly you're asking.

As a rule of thumb, I would not touch the normal Python system install. For example for Raspbian, I'd leave it on the Python version that is installed with apt.

Every time I develop or test something, I use a virtual environment. And I personally prefer Anaconda.
It's pretty easy to use... a new virtual environment is for example created like this:
create create -n ansible python=3.8, using ansible as environment name and specifying you want Python 3.8.
And then you just activate it with conda activate ansible
To install packages use conda install [package name] (preferred) or pip install [package name] (with caveats if not available through conda).
If you mess things up, you just remove that virtual environment and start a new one.

Much better, then having several Python versions installed natively on your distro.
I think for Raspbian you would need to look for Miniconda instead of Anaconda.

@joeythecat4
Copy link
Author

okay i will try that andi was trying to remove Python versions

@stale
Copy link

stale bot commented Jun 18, 2022

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@stale stale bot added the stale label Jun 18, 2022
@stale
Copy link

stale bot commented Aug 13, 2022

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

@trentprynn
Copy link

trentprynn commented Sep 1, 2022

I did a fresh install of Raspberry Pi OS and followed the steps in the README. I encountered this same issue on the docker compose installation ansible step and was able to remedy it by doing the following. I'm thinking it's probably related to using Raspberry Pi OS instead of debian.

  • Install docker compose using apt-get instead of pip
    • sudo apt-get install docker-compose
  • Restart raspberry pi
  • re-run playbook

hope this helps if anyone else runs into this!

@stale
Copy link

stale bot commented Sep 1, 2022

This issue is no longer marked for closure.

@stale stale bot removed the stale label Sep 1, 2022
@geerlingguy geerlingguy added the bug Something isn't working label Sep 1, 2022
@geerlingguy
Copy link
Owner

Marking as a bug, sorry I haven't gotten around to looking into this with a fresh install yet.

@Morphexe
Copy link

I can confirm that manually installing the docker-compose does in-fact solve the issue. :)

@Hugeaux
Copy link

Hugeaux commented Aug 19, 2023

Confirming the same here: manually installing docker-compose solved this issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants