Re: [Tutor] Installing python

2018-11-03 Thread Adam Eyring
On Fri, Nov 2, 2018 at 8:10 PM Mark Lawrence  wrote:

> On 02/11/2018 22:49, Alan Gauld via Tutor wrote:
> > On 02/11/2018 21:13, Roger Lea Scherer wrote:
> >
> >> I have installed python 3.7 on my computer Windows10
> >> (C:\Users\Roger\AppData\Local\Programs\Python\Python37),
> >
> > Caveat: I'm no expert on modern Windoze.
> > But... That looks like the wrong path to me.
> >
> > My Windows install is usually either in
> >
> > C:\Python...
> > or
> > C:\Program files\Python...
> >
> > Depending on distro...
> >
>
> The C:\Users... path has been the standard for some time for a single
> user install.  C:\Python was binned some years back for security reasons
> whilst C:\Program Files\Python... was added for security reasons.
>
>
The c:\users... path is frustrating to find because the AppData folder by
default is hidden. I haven't bothered to make it visible, so I just create
a shortcut to the Pythonxx folder to access my code files.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Installing python

2018-11-03 Thread Avi Gross
Alan,

Many people have machines with a single login that is shared with nobody. 

I install lots of software on multiple machines that only I use and have
often wondered what the purpose for me was to install for everyone. On some
machines you then need to log in as whatever variant of superuser you have
to be if you want to be able to write in restricted directories or make
changes to the operating system or global configuration files.

There can be tradeoffs in how long it takes to find a program on your PATH
or PYTHONPATH or other such things. 

But, of course, if you have many users who might otherwise install their own
personal copies of software on the same machine, especially one where many
people may log in at once, then it may make more sense to share.


But I wonder about the many modern languages that can be extended by also
installing one of thousands of packages above and beyond the standard ones
routinely in place. Do you want people to replace earlier versions for
everyone or be able to install them in a global area at all? Among other
considerations, if they have write access they might be able to modify
something others use, like numpy, which is a serious security risk when you
can sneak in a call to pop open a shell that reformats the hard disk or
whatever.

Avi

-Original Message-
From: Tutor  On Behalf Of
Alan Gauld via Tutor
Sent: Friday, November 2, 2018 9:16 PM
To: tutor@python.org
Subject: Re: [Tutor] Installing python

On 02/11/2018 23:44, Mats Wichmann wrote:

> that's actually exactly the right path for a Python 3.5+ if you chose 
> a  "user install", which you usually should.

Ah, I always install for all users. That's why I've not seen that path
presumably?

But why *should* you install for a single user? I only ever do that for
programs that I'm still writing and don't want other users to accidentally
start. But I want everyone to be able to run my Python programs so I always
install for everyone.

> the "modern" answer for Windows is supposed to be the Python Launcher,

I keep forgetting that thing exists. I really must spend some time getting
to grips with it...


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Installing python

2018-11-03 Thread Roger B. Atkins
Okay, but what about the virtual environments? Once the Windows 10
path environment variable has a version of Python added to it, Windows
will find it (I am using Win 10), but will it be found from within any
given virtual environment (venv), regardless of which version created
the environment? And if 3rd party packages have been installed within
a venv, will they be found a) by Windows, and b) by the Python version
within the venv, even if it was not used to install the packages?

These questions confounded me until I finally deleted Anaconda, and
Python with it, because when running programs in Windows vice the
Spyder IDE, Windows could find Python, but not the 3rd party packages
such as pyperclip, bs4, and requests. I suspect it had something to do
with the Anaconda installation process establishing a venv, and the
package locations not existing (or not being visible) in Windows.
That's just a WAG based on not being able to find the specified
directories in Windows Explorer. So, I'm just wondering if my quagmire
was part of or related to Mr. Scherer's, and whether he might have
similar problems if he goes back and forth between different virtual
environments.
On Fri, Nov 2, 2018 at 6:18 PM Alan Gauld via Tutor  wrote:
>
> On 02/11/2018 23:44, Mats Wichmann wrote:
>
> > that's actually exactly the right path for a Python 3.5+ if you chose a
> >  "user install", which you usually should.
>
> Ah, I always install for all users. That's why I've not
> seen that path presumably?
>
> But why *should* you install for a single user? I only
> ever do that for programs that I'm still writing and
> don't want other users to accidentally start. But I
> want everyone to be able to run my Python programs
> so I always install for everyone.
>
> > the "modern" answer for Windows is supposed to be the Python Launcher,
>
> I keep forgetting that thing exists. I really must spend
> some time getting to grips with it...
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Installing python

2018-11-03 Thread Mats Wichmann
On 11/2/18 10:01 PM, Roger B. Atkins wrote:
> Okay, but what about the virtual environments? Once the Windows 10
> path environment variable has a version of Python added to it, Windows
> will find it (I am using Win 10), but will it be found from within any
> given virtual environment (venv), regardless of which version created
> the environment? And if 3rd party packages have been installed within
> a venv, will they be found a) by Windows, and b) by the Python version
> within the venv, even if it was not used to install the packages?

(a) when you activate a virtualenv, it will always find that python (the
one the env was created from), that's what the activation does - fiddle
paths so you see that envirnoment and not any other that may be sitting
around.

(b) when you pip install with a virtualenv active the installation will
be private to that virtualenv.

which leads to... Anaconda uses virtualenvs (afiak, _always_, rather
than "when you ask for one" like many IDEs do), so, packages installed
though Anaconda are in that sense "private".  They're not secret - you
can see them all in the physical location where the virtualenv is set
up, if you figure out where that is.

> These questions confounded me until I finally deleted Anaconda, and
> Python with it, because when running programs in Windows vice the
> Spyder IDE, Windows could find Python, but not the 3rd party packages
> such as pyperclip, bs4, and requests. I suspect it had something to do
> with the Anaconda installation process establishing a venv, and the
> package locations not existing (or not being visible) in Windows.
I don't think developers of projects like Anaconda expect that their
target users will try to run Python lots of different ways, so getting
things all under their control is helpful and presents a consistent
front, which is really the value the project brings - you want to do
some (for example) scientific work in Python, and some notes tell you
you need to install these 17 packages, and if you're on Windows, a
couple of them maybe don't work because you don't have a C compiler
installed - Anaconda puts that all in once place and makes it easier.
Doesn't mean it isn't still occasionally confusing. If you need to run
more versions, you can always install pkgs a second time, "outside" the
Anaconda world. It should even be quick to do, pip caches packages it
has downloaded so it probably won't even need to re-download.


p.s. Python can tell you which Python it is running:

  $ python
  Python 2.7.15 (default, Oct 15 2018, 15:24:06)
  [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> sys.executable
  '/usr/bin/python'
  >>>
  $ source ~/virtualenv/py2/bin/activate
  $ python
  Python 2.7.15 (default, Oct 15 2018, 15:24:06)
  [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sys
  >>> sys.executable
  '/home/mats/virtualenv/py2/bin/python'
  >>>

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor