This post is suggesting the opposite, that Python is more healthy than ever and growing incredibly fast.
This post is suggesting the opposite, that Python is more healthy than ever and growing incredibly fast.
We like it, but we are constantly screaming and bitching about the complications of 2<->3 ("Ahhh X and Y module only works on py2!", "Ahhh device developer only provides example code for Labview and Matlab!", "Ahhh python isn't even supported for this device/application!").
Package management ("Do I use conda? pip? easy_install? compile?") is annoying, I hope that something like hatch (https://github.com/ofek/hatch) maybe takes over everything -- because I think the mess that is package management is THE biggest deterrent for newcomers.
I think the one thing we are all learning from this experience is: JUST USE UBUNTU, doing python with Windows is a headache.
All of that said -- python is nice, it's amazing, it's the newer, funner Java. It is incredibly approachable, it can do pretty much EVERYTHING because of the expansive availability of libraries, it's finally a programming language that is great to get my 7 year old niece started on.
That said, I have been doing ruby since before Bundler, and I really have to take my hat off to what Yehuda and company accomplished with Bundler. It was both a technical and open source community triumph to get Bundler done, stable and covering the breadth of use cases it applies to.
Ideally, packages would have just one set of dependencies and the packages would be version locked, but that's just not the case in the Python community.
Why would you sort 2.6 in 2017?
Supporting 2.7 these days in a new package is already a bit of a wtf - Django for example drops support for it next year.
We're still maintaining stacks on py 2.6 which predate the reference platform specs
At least you're not trying to write Fortran compatible with the 77 and 90 specs....
And if your editor has a "Run script" function, it also needs to deal with "Activate the correct environment" for whichever flavor of virtual environment you've used.
Any what beginner would be confused by tutorials using all sorts of different setups (virtualenv, venv, pyenv, pipenv, virtualenvwrapper, pyenv-virtualenvwrapper)? Most of them, I think.
"venv" is the newest one - shipped in the python3 package except when it's not (Ubuntu, maybe others) and doesn't make copies of the python binaries for each environment. That always seemed wasteful to me, but I suppose it was the easy way around path problems with the ecosystem not having a solution built in.
I love python when I'm only using the standard libraries, but if I have dependencies it's messier to set up than I want it to be.
I'll stop using virutalenv when it actually becomes a hindrance. I know venv exists, but I have precisely zero incentive to use it when virtualenv works and allows me to get on with what I actually want to do.
This is kinda discouraging :)
Of course each project needs it's own virtualenv. In fact, each project should have it's own docker image. Why install an application library to the entire system? That is not a good idea in ANY language.
And of course scripts need to use the right virtualenv. Or better yet - why not put each app in it's own docker? That bundles up everything into a single "file" you can run on command.
All of these things you are listing as downsides seem like things that one normally moves away from, when they put a codebase in git and stop deploying to prod by copying a few files to a shared network drive and restarting the server?????
Those are all bleeding edge developer best practices that didn't exist five years ago. Folks coming from matlab (an example I read above,) probably aren't in the industry and many likely don't even know docker exists OR why they would want to use it.
And the GP was saying that the ruby package manager is more magical then the python package manager... when pip solved all of the complaints mentioned.
Odd.
The current standard way to do this is with a virtualenv and a requirements.txt file in which you specify the version of your dependencies, which you can then install with pip install -r requirements.txt.
Format is "packagename==0.1.0" (>=, < etc work too). VCS urls work too btw, e.g. "git+protocol://site/repo@tag_or_commit"
To get something similar (but inferior) to lockfiles you can use "pip freeze > filename"
Packaging/distribution is certainly a mess.
Zope and plone, the project(s) that came up with python eggs, used to have the concept of "known good sets"[1], which were massaged and used with zc.buildout :
http://www.buildout.org/en/latest/
I'm not sure I'd recommend it for greenfield projects - splitting things up in sane-sized chunks, and using the now in-standard-lib vevn (python3 -m venv) is probably a better idea.
But just for the record, there exists a canonical(ish) solution to some of these issues in python-land.
[1] http://grok.zope.org/doc/community/life_cycle/known_good_set...
The design was done by Phillip Eby, with funding from OSAF for the development of Chandler, not Zope.
Much shade has been thrown at eggs over the years, and people bemoan the warts, but eggs and setuptools were better than what we had at the time in Python.
Pretty simple, no? Most any python project I have seen in the last 5-6 years uses it.
We are using `pip-tools` to manage that: https://github.com/jazzband/pip-tools
If you have multiple sets of requirements (for dev vs testing vs production, eg), this becomes impractical real quick. You'll essentially have to tear down and rebuild your dependencies multiple times to update your reqs.
if you are using windows, using python without this website is nearly impossible: http://www.lfd.uci.edu/~gohlke/pythonlibs/
"pip install numpy" will actually work, among other things. But even for packages that don't have binary wheels and have to compile things, it's much easier now to install a compiler toolchain (it's actually a single download!), and have your Python installation just pick it up automatically.
For one of my main applications py3 proved to be too slow. For my application I use: numpy, pil, tkinter, and subprocess (and process/produce/draw on screen images (at a rate of 120/sec)). I don't know WHY but with python2 it runs acceptably fast, on python3 it's 20% slower. This has been something common for me actually.
I do tend to use py3 when doing any kind of data science though.
Python (1991) is older than Java (1995).
"we were able to hook Java runtime onto the free, open source Netscape browser. And it was a collision of two things that accelerated and launched each other together. It was fascinatingly lucky timing for both companies."
While it may have taken time to mature at that time it was an "overnight success".
Sun was considering dropping it and considered it an expense before that.
Most scientific stuff I've done works in python3. In fact, its now possible to run a tensorflow/opencv/scipy environment entirely from pip in a virtualenv, though it won't be the fastest. which is amazing. Doing that kind of thing in any other language would require docker.
In general, if you're sticking to python3, the answer will always be "use pip", everything should work with pip, and everything should install as a binary without needing to build source.
Edit:
There's exactly one context where I use python2, and its for a robotics project where some transitive dependencies are python2 only.
Of course in scientific Py you need compiled C attachments, which makes it more complex. But in normal Py usage you only need pip. Easy Install is only needed when you don't have pip installed. Pip is a drop in replacement with additional features.
And at least from what I heard for everything with C compiled stuff inside ("binary packages") you use conda.
So not that hard actually.
Just had such a situation yesterday at work. A guy from QA (not a dev) needs to setup an environment to install our tool for testing. He doesn't know python, so explaining to him what a virtualenv is would take way too much time. He probably also doesn't know how to use the OS's package manager to install pip. So, what to do? Give him the oneliner "$ sudo easy_install whatever". It works, he doesn't need to understand it, and actual system maintenance doesn't matter because it's just a VM that gets deleted after he's done anyways.
Without a package manager it is only a two-step process. 1) download get-pip.py from the source 2) run it with sudo
What kind of devices or libraries do you use from LabVIEW but there isn't Python support or examples?
If its an NI product, some are starting to get Python support
DAQmx https://github.com/ni/nidaqmx-python/blob/master/nidaqmx_exa...
XNET https://github.com/ni/nixnet-python/blob/master/nixnet_examp...
DMM https://github.com/ni/nimi-python/blob/master/src/nidmm/exam...
FPGA Interface https://nifpga-python.readthedocs.io/en/latest/examples/basi...
EDIT: All with Python3 support.
PI instruments: https://www.physikinstrumente.com/en/products/linear-stages-... Matlab, Labview, etc. yes. No python
Thorlabs equipment: https://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=81... Same story, no python.
In fact, it's always a _SURPRISE_ when I see Python being supported. I would say after having gone through about a hundred major lab devices, less than 2% I found to be supporting Python.
Importantly, example code should be made available (as it generally is for matlab, and labview) because creating things from scratch in a move-fast environment is a little too much.
It is the easiest way to use python3 because even fedora (one of the more bleeding edge) likely won't finish migrating 2 to 3 in current year.
Why do you not like venv? What could be done better?
pip install --user pkgname
Does that not work for you?Meh. I use python on Windows all the time - it's not a problem. Mostly pip just works.
Of course, I have over a decade of experience with Python - albeit only the last few years in Windows.
chris gohlke's website was a real lifesaver back then, although now pip seems much better. nowadays it can be a bit difficult replicating environments across different machines especially since conda is moving rapidly from python ver to ver while some obscure packages i rely on are still stuck on 3.4 or earlier... or if c++ 10.0 or 9.0 or 14.0 is not set up correctly. then it becomes an issue of crossing fingers and hoping "python setup.py install" doesn't fail.
It's easier for me to install the Python libraries I need in Windows than to install them on Linux where I don't have root privileges.
As a Python dev, I (and all the other Python devs I know) were just waiting for (and helping) libraries to start working with 3 before we can switch over. These days, all my new projects are in 3, 2 is pretty much for legacy code only.
Python seems to have overcome that (keyword: seems), thanks to a strong offering in data science, but 2->3 is still a headache. I never really used Python for application development, but rather for utility/scripts and I am still on 2, because I don't need more.
2 is available out of the box on all OSes and at work we also use 2 for building tools.
I have the feeling that Python is still losing people to Golang due to its weak performance and Golang's reputation in that area.
So instead of being arrogant about 2->3, I'd say Python devs should be thankful to data science for saving their butts. :)
Any source (other than Rob Pike) ?
The SO post is not the study we need, because it uses a proxy variable (SO tags).
They fucked up. That Python is resilient enough to absorb such a blow and that no other language is a viable alternative for that particular niche is what saved the day.
And even now there is still plenty to improve on, fortunately Anaconda at least makes package management more sane.
I haven't used python for a while though. Maybe they found a solution to the python 2/3 problem already.
</snark, mostly>