I have a Linux system (Mint 17.3 based in Ubuntu 14.04) on which I wish to do 
some Python development. The system has Python 2.7.6 installed already (there 
is a Python 3 installation too but I won't be needing to use that to start 
with). I need to install various Python modules for the work I'm going to do 
and I'm trying to work out how best to do this in a way that does not risk 
corrupting the system's Python installation.

I've learned that there are (at least) two mechanisms for installing Python 
packages in a way that does not impact the system installation, virtualenv and 
user scheme installations.

I have several questions/issues.


1. I am unsure which of these technologies is most suitable for my needs. 
Virtualenv sounds like what I need, but two things give me pause for thought. 
First I came across this github issue 

https://github.com/pypa/virtualenv/pull/697

...which highlights what seem like severe issues in the vitualenv 
implementation and proposes to rewrite the whole library. This raises two 
questions.

   i) Is this rewrite complete?
   ii) Is 'legacy' virtualenv or virtualenv-rewrite now the recommended 
library? 

The second thing that gives me pause for thought is the remark in this article

http://python-packaging-user-guide.readthedocs.io/en/latest/install_requirements_linux/#installing-pip-setuptools-wheel-with-linux-package-managers

...where it says

'Recent Debian/Ubuntu versions have modified pip to use the “User Scheme” by 
default, which is a significant behavior change that can be surprising to some 
users.'

These concerns caused me to try and research more in the area of user installs 
and package installation, which leads me to my next two issues.


2. User install site.py behaviour confusing.

The first thing I wanted to work out was whether 'user install' was indeed 
enabled by default on my system as described in the article above. Here is the 
documentation for site.py

https://docs.python.org/2/library/site.html

This is the documenation for 2.7.11 while I only have 2.7.6. I don't see a link 
to documentation for 2.7.6 and I dont know whether this version disparity is 
significant or not.

However, the documentation starts by saying that this module is loaded by 
default. That being so I would expect sys.prefix to be /usr/local.

If I fire up Python import sys and dump sys.prefix it outputs /usr.
If I dump site.USER_BASE I get 'name 'site' is not defined'.
If I import site and dump site.USER_BASE I get '/home/<user_name>/.local'.

This confuses the hell out of me. Two documentary sources suggest this 
behaviour should be enabled by default, yet it doesn't seem to be, I don't know 
why, and I don't know how to enable it, or even whether I should.

Can anyone either explain why I'm seeing what I'm seeing here, or point the in 
the direction to some documentation that can.


3. Installers

My system Python installation doesn't appear to have either easy_install nor 
pip nor virtualenv installed. This leaves me with what seems like a circular 
problem.

I'm pretty sure I need pip, but there are (at least) two ways to get it. 
   i) apt-get pip
   ii) or download and run get-pip.py.

I've come across various credible warnings of the dangers of using apt-get and 
pip to manage the same packages, but once pip is installed I was under the 
impression you need to use pip to update itself before it will install any 
packages as pip must be up to date in order to access PyPI. 

This page

http://python-packaging-user-guide.readthedocs.io/en/latest/install_requirements_linux/#installing-pip-setuptools-wheel-with-linux-package-managers

...suggests I should use apt-get to install pip, but that gives rise to the 
following sequence of operations

apt-get pip
pip install -U pip

..and isn't that exactly what I should be trying to avoid, installing a package 
using apt-get and then managing that package using pip?

I'd have though that using get-pip.py would be safer, but even then that might 
only be with the provision that I execute get-pip.py in a Python environment 
separate from the system core Python installation, otherwise I'm in the same 
boat of using get-pip.py to upgrade my apt-get managed system Python 
installation. What to do?


4. Python version.

In addition to all this I'm wondering whether I wouldn't be a good idea to have 
the Python installation I use for development up to 2.7.11 before I start as my 
system installation of 2.7.6 is 3 years out of date.

----


In short I'm hopelessly confused and could really use some guidance.
P.S. What happened to 'batteries included'?

Thanks.
Neut.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to