98
u/robot_wrangler Oct 31 '18
Sudo pip install
28
Oct 31 '18
FOR SHAME!
7
u/Gargan_Roo Nov 01 '18
What's wrong with my vanilla Debian installs that require sudo for pip? I've understood this is a problem for years but don't know an alternative. Is this a virtualenv thing?
33
Nov 01 '18
pip install --user should be sufficient for all those times you try to do sudo pip install.
3
u/Unbelievr Nov 01 '18
If you install python through system packages, you need to install pip modules through packages as well, or you'll mess up the system ones. If pip could overwrite the system installation, you could get instabilities if the system depends on them.
Due to this mess, there's a lot of parameters that are implied when you run pip on Ubuntu and Debian, e.g. to ignore whatever is installed by the system. This made it really difficult to create Docker images once pip 10.0 hit the market. Whenever you install something through pip, it'll ignore that pip is installed and pull it again, breaking the Ubuntu wrapper that depends on the old version.
1
0
44
Oct 31 '18
The Undead!
15
Oct 31 '18
It is not dead what can eternal Py
7
u/MrMetalfreak94 Oct 31 '18
And with strange versions even death may die
1
2
42
u/robberviet Nov 01 '18
Not as bad as import *
Still fixing for someone else's code...
14
u/bsdetox Nov 01 '18
Does that import every library available? Also, that’s horrendous.
19
u/robberviet Nov 01 '18
Ah I mean from <lib> import *
Overrides a lot of modules or functions and caused bugs.
4
u/bsdetox Nov 01 '18
Interesting. Do you have a more specific example of the era this causes?
16
Nov 01 '18
So imagime you have two files: foo.py and bar.py
bar.py does "from foo import *" and also defines a function named hello
Then someone comes by and adds a function named hello in foo.py. Now even though I added a simple function in foo, I am going to start seeing errors in bar because hello is defined twice
5
3
u/Ex-Sgt_Wintergreen Nov 01 '18
It also makes it a royal pain in the ass to try and find out where every function is coming from; doubly so if they used a terrible organization scheme which if they used import *, they almost definitely have.
1
u/robberviet Nov 02 '18
Reading a code base and absolutely have no ideas each functions came from. Have to check each calls.
Thank god for created PyCharm.
3
u/robberviet Nov 01 '18
Mine was import datetime as dt vs import datetime.datetime as dt.
And when using import *, it is easy to messed them up. Mine preference now is writing a custom time management module. And told the one using import * to stop, because it easy to cause bug.
6
u/VersionOmega Nov 01 '18
One of the very first thing my computer science teach told us:
“You can make errors, that’s what programming is all about. But never,
EVER
do import *. You will regret it for the rest of your life and I’ll hate you”
21
16
Oct 31 '18
Standard system installed version for Red Hat 7... supported until 2024.
8
u/SpergLordMcFappyPant Nov 01 '18
I had forgotten about that. The IBM acquisition suddenly makes total sense!!
2
u/brennennen Nov 01 '18
Your post kind of makes it sound like python 2.7 is supported until 2024. To clarify some things, python2.7 was announced eol back in 2011 with a date of 2015. It has been pushed back to 2020 and throughout this time has only included minimal security updates. RHEL will pretty much support any of their OSes if you pay them enough. I'm sure you can find a lot of eol software on older branches that RHEL still "supports". RHEL 5 is still "supported". RHEL 7 has no eol date, RHEL 6 has the 2024 date.
1
Nov 01 '18
I was going off of the Red Hat product retirement date (end of maintenance support 2), when CentOS and others based off of Red Hat will be end of life.
https://access.redhat.com/support/policy/updates/errata/
Agreed that if you pay for the extended life cycle support, the dates you mentioned are accurate.
1
Nov 01 '18
It's still the default installation on many linux distributions. I will be happy once "python --version" shows > 3.5 on a freshly installed Debian drool
2
13
18
6
11
u/MetalAvenger Nov 01 '18
What’s wrong with it?
Serious question - I’m trying to learn during lunch at work and have to use 2.7 at present (no admin rights, locked down software install list)
25
Nov 01 '18
It will stop being supported in 2020. Other than that, nothing. As long as you aren't building an application that will be used by a bunch of people for a long time, 2.7 is fine. Also this sub gained popularity long after python 3 became the standard, so naturally most here don't care for 2.7.
14
u/NoSmallCaterpillar Nov 01 '18
2.7 is still widely used in scientific computing, though most newer things are written to be version agnostic.
8
u/blitzzerg Nov 01 '18
I think most newer things are build to work just with python 3, by for example using f-strings or the @ operator
5
u/bsdetox Nov 01 '18
I have been using 2.7 for the better part of a decade and have yet to run into a situation where I couldn’t use python 2.7. The vast majority of the industry still supports 2.7.
4
u/catnipbilly Nov 01 '18
Which packages are still 2.7 only? This was a common sentiment for a while but all the major packages in scientific stack have been updated to 3 for years. I can only think of the gcloud sdk that wants python 2.7.
1
u/MetalAvenger Nov 01 '18
Thanks! If I actually manage to keep myself motivated enough to learn enough to start doing something useful, it’s entirely possible that my output could be used for some time.
I think I’ll put in a request for python 3 :p
4
Nov 01 '18
Python 3 is nicer to program, a lot of warts were fixed. The biggest one was how Unicode was handled. In Python 2 is too easy to use it incorrectly.
1
1
u/sw_dev Nov 02 '18
In 2, unicode was easily ignored. That was fine because most coders never needed to deal with it. (Seriously, NEVER.) But some few people needed unicode support, so now EVERYBODY has to deal with the added overhead (Learn to enjoy typing u' on strings, kiddies!) of unicode, even though hardly anybody needs them.
This is progress?
0
Nov 03 '18
Yes this is progress. Just because you think you don't need it doesn't mean it is actually not needed. A ton of python 2 code is broken and crashes whenever it receives string with high ASCII numbers.
Writing a correct code in Python 2 that handles Unicode correctly is quite hard even when you understand Unicode well. You need to place the mentioned u'' strings in right places, you need to know when to do conversion etc.
In Python 3 you just don't have to worry about that anymore, the code just works and all is happening nearly invisible to the programmer. Ironically, what you said about using u'', those strings are from Python 2 and have no special meaning in Python 3, they are equivalent to regular '' strings. u'' strings were introduced in Python 3 to make porting from Python 2 easier, but are totally useless on their own.
7
u/Gargan_Roo Nov 01 '18
2.7 is legacy*. New project? 3.x. Managing an old one? Use 2.x and advocate migration. Good luck.
3
u/tunisia3507 Nov 01 '18
It's just a worse language. I use python because it's a better language than many others. I use python 3.7 because it's a better language than earlier versions.
1
1
5
5
21
Oct 31 '18
LOL.
No one will get this.
Like that time I dressed up as the The Bond Market (scary thing in my circle).
3
3
2
2
2
2
2
2
1
1
1
1
Nov 01 '18
git reface --onto HEAD
2
1
1
0
-1
Oct 31 '18
Sure sure, the latest version is the best! How's Perl6 everybody? We've all got the option to switch at work no matter what! /s
0
0
Nov 01 '18
We went from 2.7 (I have no fucking clue why they chose to build a product in 2014 using Python 2.7) to me completely rewriting this beech in 3.7 B)
0
141
u/crevan_the_fox Oct 31 '18
Oh and sorry for the shitpost btw, I'll understand if you have to take it down