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_ID="7" VERSION="7 (wheezy)" ID=raspbian ID_LIKE=debian ANSI_COLOR="1;31" HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" 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. /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages /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 /security.html#snimissingwarning. SNIMissingWarning /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages /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 https://urllib3.readthedocs.io/en/latest /security.html#insecureplatformwarning. InsecurePlatformWarning
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
pipwill 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
Wheezyif 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
- 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
aptyou risk breaking the dependencies.
- Avoid using pip to upgrade or install system wide packages, use apt instead
- As a standard course I would try to update pip itself.
- Create a virtualenv
virtualenv ~/myvenv && source ~/myvenv/bin/activate
pip install --upgrade pip
- Install scipy from scratch
pip install scipy
- Create a virtualenv
- 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
pip3to install packaged (in a python3 virtualenv, sometimes
- Install pip3 so it is available in virtualenv’s
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
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