I am new to Linux and Raspberry Pi, so sorry if this is some trivial question or if I did not mention some important information.

To my problem:

I have a fresh install of Raspbian Stretch on a Raspberry Pi 3B+ and want to install OpenCV on it. For this, I am following this tutorial: https://www.pyimagesearch.com/2017/09/04/raspbian-stretch-install-opencv-3-python-on-your-raspberry-pi/

Within this tutorial, it is also recommended to use virtual environments for programming in python. Therefore, the packages 'virtualenv' and 'virtualenvwrapper' are installed. However, once I enter the command 'sudo pip install virtualenv virtualenvwrapper', I get the following error message:

ERROR: Package 'stevedore' requires a different Python: 3.5.3 not in '>=3.6'

The first thing I tried to solve the problem was to upgrade Python to a higher version. So now the command 'python3 --version' returns '3.6.9'. However, this did not help and the error persisted. I also tried using pip3 within the command but then I get the following message 'pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.' which then let to a different error. I also tried downloading the package directly from https://www.piwheels.org/ but without success.

Does anyone have an idea how to solve this issue? Thanks in advance.

  • Your question is unclear. Stretch includes 3.5, I don't know how you got 3.6. The current Raspberry Pi OS (Buster) includes 3.7. Regardless pip will install in 2.7. You should use pip3
    – Milliways
    Jul 5 '20 at 9:48
  • Ok, thanks for your answer. This is my bad as I did not explain correctly. I had the fresh installation but then upgraded Python to version 3.6.9. So when I query the version with 'python --version' it shows me '3.6.9'. I did this after I got the error the first time because I thought it could resolve the issue which it did not. Using pip3 leads to the following issue: 'pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. ' I hope this helps.
    – Florian
    Jul 5 '20 at 9:51
  • 1
    DO NOT include details in Comments - edit your question. If python -V returns anything other than 2.7 you have broken something.
    – Milliways
    Jul 5 '20 at 9:54
  • I am sorry for that, it is the first time I use this website and ask a question. I now edited the question. And I meant querying 'python3 --version'. But I changed it correctly in the question.
    – Florian
    Jul 5 '20 at 10:03

I did this :

pi@ai-pi:~ $ sudo su

root@ai-pi:/home/pi# cd /usr/src

root@ai-pi:/usr/src# wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

root@ai-pi:/usr/src# tar -xf Python-3.7.0.tgz

root@ai-pi:/usr/src# apt-get update

root@ai-pi:/usr/src# apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

root@ai-pi:/usr/src# cd Python-3.7.0

root@ai-pi:/usr/src/Python-3.7.0#./configure --enable-optimizations

root@ai-pi:/usr/src/Python-3.7.0# make altinstall

root@ai-pi:/usr/src/Python-3.7.0# ln -s /usr/local/bin/python3.7 /usr/local/bin/python3

$ wget https://bootstrap.pypa.io/get-pip.py

$ sudo python3 get-pip.py

$ sudo pip install virtualenv virtualenvwrapper

And it worked for me!


You need to reference an older version of stevedore

1.29 is the version of stevedore from around the time the article was written.

sudo pip install stevedore==1.29.0
sudo pip install virtualenv virtualenvwrapper

worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.