pip notes

Problems in upgrading pip packages

Ask QuestionAsked 2 years, 5 months agoActive 2 years, 5 months agoViewed 1k times31

I am having some troubles with pipon the Raspberry. These are the information about the OS:

piName@raspberry ~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
NAME="Raspbian GNU/Linux"
VERSION="7 (wheezy)"

piName@raspberry ~ $ uname -a                                                   
Linux piname 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux

My Python version associated with pip is 2.7.3, although I have also Python3 installed.

First when I list the outdated pip packages I get the following warning (sorry for the verbosity):

pip list --outdate
DEPRECATION: The default format will switch to columns in the future. 
You can use --format=(legacy|columns) (or define a format=(legacy|columns) 
in your pip.conf under the [list] section) to disable this warning.
/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been 
made, but the SNI (Subject Name Indication) extension to TLS is not 
available on this platform. This may cause the server to present an 
incorrect TLS certificate, which can cause validation failures. You can 
upgrade to a newer version of Python to solve this. For more information, 
see https://urllib3.readthedocs.io/en/latest
/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object 
is not available. This prevents urllib3 from configuring SSL appropriately 
and may cause certain SSL connections to fail. You can upgrade to a newer 
version of Python to solve this. For more information, see 

Some packages can be upgraded, some others cannot. For example pip install --upgrade scipy gives errors and one of this is the following

    Failed building wheel for scipy
  Running setup.py clean for scipy
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-pmGCTQ/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:

  `setup.py clean` is not supported, use one of the following instead:

    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)

  Add `--force` to your command to use it anyway if you must (unsupported)`enter code here`

Note that wheel is installed.

Also I have errors trying to upgrade numpy.

Does anyone know how to solve these issues?raspbian-wheezypipshareedit  follow  closeflagedited Feb 28 ’18 at 23:02Milliways43.3k1919 gold badges7272 silver badges145145 bronze badgesasked Feb 28 ’18 at 16:41Francesco Boi54322 gold badges55 silver badges1818 bronze badges

  • This is not an answer to your question, but if you use an obsolete, unsupported OS there will be no updates. Recently Python wheels have been added for most common packages including scipy – if you use a current Raspbian pip will install these. – Milliways Feb 28 ’18 at 23:02
  • As specified in the question the packages scipy and others are already installed. Apart from this, are you suggesting I should install jessie instead of raspbian wheezy? – Francesco Boi Mar 1 ’18 at 11:01
  • No – I do not recommend Jessie which is only fully supported until June. Use the current stable release Stretch – Milliways Mar 1 ’18 at 22:52
  • Ok apart from the specific OS, you are suggesting to update my OS? Should I format my SD card to do that or there is a way an less invasive way? – Francesco Boi Mar 1 ’18 at 23:35
  • You are welcome to continue to use Wheezy if it works – but don’t expect any support. There is no official upgrade path from Wheezy to Jessie/Stretch, although there are those who claim to have upgraded. Buy a new card, they are cheap enough, and you will need at least 8GB, preferably 16. – Milliways Mar 2 ’18 at 3:44

add a commentstart a bounty

1 Answer


Three Suggestions

  1. Use Virtualenv for development and custom applications, System python is for installed programs
    • System python is better suited for system utilities which are built against the packaged python and expect the versions to match the dependencies specified in `apt.
    • By upgrading anything using pip outside of apt you risk breaking the dependencies.
    • Avoid using pip to upgrade or install system wide packages, use apt instead
  2. As a standard course I would try to update pip itself.
    • Create a virtualenv virtualenv ~/myvenv && source ~/myvenv/bin/activate
    • Execute pip install --upgrade pip
    • Install scipy from scratch pip install scipy
  3. If you require Python3, you must do so explicitly
    • Install pip3 so it is available in virtualenv’s apt-get install python3-pip
    • Create a virtualenv using python3 explicitly virtualenv -P python3 ~/myvenv3
    • Use pip3 to install packaged (in a python3 virtualenv, sometimes pip->pip3)

It is generally not recommended to use pip to manage system wide python packages, because the system bundled python is used to run installed utilities and sysadmin programs that are installed from apt which will depend and are built against the version of python bundled with the OS.

You may have issues when for example, you install a program from apt which depends on a library/package also bundled in apt , but you have gone and updated that outside of apt using pip, it may break an installed program or cause your system to fail to function.

The typical use is to install pip and then use virtualenv to create sand-boxed environments for development and custom applicationsshareedit  follow  flagedited Mar 1 ’18 at 23:06Francesco Boi54322 gold badges55 silver badges1818 bronze badgesanswered Feb 28 ’18 at 19:33crasic2,76511 gold badge55 silver badges2020 bronze badges

  • Do you think uninstalling the packages and then installing with virtualenv might work? – Francesco Boi Mar 1 ’18 at 11:03
  • Is it not a problem that my OS is wheezy (instead of Jessy) that might be outdated? – Francesco Boi Mar 1 ’18 at 11:37
  • There is no need to “uninstall” packages as virtualenv (by default) does not copy existing packages except pip. In fact, using a legacy OS, which may be required for other reasons, is a great use case for virtualenv. It allows you to use the updated libraries without needing to upgrade the whole OS – crasic Mar 1 ’18 at 23:27
  • Yeah maybe if I had used virtualenv from the start I would not have this problem now. But virtualenv cannot solve the conflicts (if my problem is related to package conflicts) that are already present. – Francesco Boi Mar 1 ’18 at 23:31
  • That doesn’t sound right, a clean virtualenv should have nothing in it. However, A while back, virtualenv did install system packages, it is possible that wheezy packaged virtualenv still has this behavior. Try to do virtualenv --no-site-packages ~/myvenv – crasic Mar 1 ’18 at 23:33
  • Wait maybe I was not clear in my comment or I am missing something. Until today i did not use virtualenv. Now if I create a virtualenv I can work cleanly and maybe this problem does not appear. However outside the virtualenv the problem persists and it seems a serious one. The system uses the environment outside the newly created virtualenv (I guess) so the system keeps having the problem. – Francesco Boi Mar 1 ’18 at 23:43
  • Yes, in this case it is prudent to reinstall any corrupted packages using apt – crasic Mar 1 ’18 at 23:44

add a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.