2

I have installed version 3.8.2 on my RPI because i previously had versions 2.7 and 3.5.3 installed. When I try to install stuff like ipython i get this: ERROR: Package 'ipython' requires a different Python: 3.5.3 not in '>=3.6'.

Tried various stuff and nothing works. Modified paths, installed 3.8.2 multiple times, tried to remove 3.5.3. Nothing works. It appareas the base version is 3.5 but I need it to be 3.8.2 and no idea how to do that.

Also when i try to run a python file I get the error that it cannot find numpy, and I have numpy installed in all versions.

Struggled for over a day to fix it and nothing. Can anybody help?

versions of python on RPI

emilpop20
  • 23
  • 7
  • Please check you environment variable e.g. `which python`. You have to adjust the path to the python version you want to use. Alternatively it is recommended to use an environment like miniconda and in there you can handle different versions of python more easily. – InLaw Mar 08 '20 at 17:16

1 Answers1

1

Python is a requirement of Debian, hence uninstalling the version present by default is not recommended (it basically breaks the system).

If you need to run python 3.8 you should install it manually and call it with

python3.8 what_you_need.py

Also for pip:

python3.8 -m pip install what_you_need

I also suggest you to have a look to virtual environments:

https://docs.python.org/3/library/venv.html https://github.com/pypa/pipenv

ionpoint
  • 861
  • 6
  • 10
  • Yes tried to run with python3.8, however i get the same two issues with numpy and ipython – emilpop20 Mar 08 '20 at 17:15
  • Did you install the libraries for python3.8? (`python3.8 -m pip install what_you_need`) – ionpoint Mar 08 '20 at 17:21
  • It worked to install numpy, however when i try to install opencv i get this: import cv2 ModuleNotFoundError: No module named 'cv2'. Tried installing it with sudo pip3 install opencv-python and says install is successful. Still not working – emilpop20 Mar 08 '20 at 17:51
  • Did you try with `python3.8 -m pip install opencv-python`? – ionpoint Mar 08 '20 at 18:00
  • Yes, this is what i get: python3.8 -m pip install opencv-python Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none) ERROR: No matching distribution found for opencv-python – emilpop20 Mar 08 '20 at 18:07
  • Please check https://www.google.com/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/45293933/could-not-find-a-version-that-satisfies-the-requirement-opencv-python&ved=2ahUKEwij3tTEvIvoAhVxoFwKHRZRBtsQjjgwAHoECAUQAQ&usg=AOvVaw0P7ODk6Y2qEt2lwDQ3S0O4 – ionpoint Mar 08 '20 at 18:09
  • A possible workaround is, if you can upgrade your RPI distro and your code is suitable for python3.7, to run a dist-upgrade. It will automatically install python3.7 and delete the legacy one. – ionpoint Mar 08 '20 at 18:10
  • ran a dist-upgrade and everything is up to date – emilpop20 Mar 08 '20 at 18:16
  • Your system is not updated. I'm using RPI and it comes with python3.7. For full upgrade see: https://www.raspberrypi.org/documentation/raspbian/updating.md – ionpoint Mar 08 '20 at 18:22
  • Looked at the documentation, tried to update but everything is up to date. When i do sudo apt -y dist-upgrade i get: File "/usr/share/python/debpython/version.py", line 24, in from ConfigParser import SafeConfigParser ModuleNotFoundError: No module named 'ConfigParser' dpkg: error processing package python-opencv (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: python-opencv E: Sub-process /usr/bin/dpkg returned an error code (1) – emilpop20 Mar 08 '20 at 18:28
  • As I said in my answer, changing the version of Python breaks the system. I think you better format your RPI and restart with a fresh system. – ionpoint Mar 08 '20 at 18:32