0

As some brief background information: I was origianlly trying to use Miniconda (with conda) to install dependencies that I need for my project on my Raspberry Pi. After trying to use Conda to install the SimpleAudio package, I got an error saying that it did not exist, therefore I proceeded to install this through Pip. Pip found the correct package although I get the following error message:

pi@raspberrypi:~ $ pip install simpleaudio

Traceback (most recent call last):
      File "/home/pi/miniconda3/bin/pip", line 7, in <module>
        from pip._internal.cli.main import main
      File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/main.py", line 10, in <module>
        from pip._internal.cli.autocompletion import autocomplete
      File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
        from pip._internal.cli.main_parser import create_main_parser
      File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
        from pip._internal.cli import cmdoptions
      File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/cli/cmdoptions.py", line 28, in <module>
        from pip._internal.models.target_python import TargetPython
      File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/models/target_python.py", line 4, in <module>
        from pip._internal.utils.misc import normalize_version_info
      File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_internal/utils/misc.py", line 20, in <module>
        from pip._vendor import pkg_resources
      File "/home/pi/miniconda3/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 92, in <module>
        raise RuntimeError("Python 3.5 or later is required")
    RuntimeError: Python 3.5 or later is required

It seems I need to update Python, although when I print the verion on Spyder IDE, it says I am already using 3.7.

Have I caused some sort of mismatch between what version my IDE is using and what the default process the terminal uses to look up the version? I noticed that it is looking for the Python version under Miniconda. If I can update If so is there a fix for this?

Please as me for more information if required (I am fairly new to stack overflow).

mcgirlja
  • 167
  • 3
  • 13

3 Answers3

0

UPDATE:

I have been able to install the updated version of Python to 3.6 using the following instructions:

https://stackoverflow.com/a/56852714/12361146

This generally solves the scope of this question in terms of how I update Python, but I am still confused as to why Spyder IDE uses a more up-to-date version of Python whereas the terminal shows otherwise.

mcgirlja
  • 167
  • 3
  • 13
0

To answer the question of why Spyder reports a more up-to-date version of Python, here's the reason. The default versions of Python that are installed with Raspbian are 2.7 and 3.5, located in the /usr/bin/ directory. When you install Spyder, however (either independently, or more commonly, using conda), it includes its own installation of Python, which it is configured to use in the IDE, and which is located in a different directory. Hence when you compare the versions, first by entering python3 --version on the command line, and then print(sys.executable) from the Spyder IDE, they're different.

Now the issue with using pip alongside conda for updating the Spyder installation of Python is that it has the potential to mess it up quite badly, so avoid that unless you really know what you're doing. From code you posted above, you have avoided that, though, since that will have impacted the default Raspbian installation of Python, not the Spyder one. Upgrading the latter version should be done using Conda, not pip.

Hopefully you're now all up and running.

0

You can install newer versions of python using the package manager apt or apt-get.

Start by getting up-to-date package definitions.

$ sudo apt-get update

Then you can show details about the python3 package.

$ apt-cache show python3

When I run that now I get "Version: 3.7.3-1".

To install the python3 package and all its dependencies.

$ sudo apt-get install python3

You will still need to type python3 and pip3 when you run the commands because you are not replacing the built-in python 2.7.

Try these commands to see what you get

$ python --version

$ python3 --version

If you want to change the default python to python3 then have a look at this answer How to change the default python version in Raspberry Pi

gray
  • 1
  • 1
  • 1