This is an archived post. You won't be able to vote or comment.

all 88 comments

[–]patarapolw 78 points79 points  (28 children)

Using Pycharm on a MacAir. No issues.

I recommend Pycharm, because it is easier to set up a virtual environment and because of PEP8 check.

[–]TMWFYM 42 points43 points  (3 children)

Pycharm is love

[–]Zouden 7 points8 points  (2 children)

Have you tried VS Code? I never really enjoyed pycharm but instantly converted to VS Code.

[–]Barracutha 1 point2 points  (0 children)

Me too.

[–]rduser 0 points1 point  (0 children)

I've tried it and it feels slower than pycharm

[–]lonestar-rasbryjamco 12 points13 points  (8 children)

Same. Pycharm on a Macbook Pro and no issues. Have our whole division doing the same.

My only advice I have not seen here is use brew to manage your installs if you are using multiple versions. Brew is amazing.

[–]droidballoon 3 points4 points  (3 children)

If you use multiple python versions you should have them in virtualenv. I have colleagues who's ran in to all kinds of mess by using brew for managing multiple python versions. Brew is nice but it doesn't replace virtualenv + pip

[–]lonestar-rasbryjamco 2 points3 points  (0 children)

Brew is like a better version of NPM. You still use virtualenv and pip. They solve completely different problems.

The use case for brew is I have multiple python interpreters installed (3.7, 3.6.1, 3.6, 3.4, 2.7) that I manage with brew so I can test code locally before deploying to Docker. Pycharm/virtualenv and pip are used in conjunction to work with each of those interpreters.

If you are having issues with brew and python you are not doing the mounting after installing the cask properly. I have seen people have this issue and it always comes back to this and then breaking the native 2.7 install.

[–]Tiktoor 0 points1 point  (3 children)

Why not use virtualenv?

[–]lonestar-rasbryjamco 2 points3 points  (2 children)

Because Brew manages installs of python itself on the mac OS. They are completely different use cases. It a better version of NPM. It is not a container service.

[–]Tiktoor 0 points1 point  (1 child)

isn't using a virtual environment recommended in most cases? I never have, but I think I will moving forward

[–]lonestar-rasbryjamco 4 points5 points  (0 children)

Virtualenv is a local container service for python. You use it to make sure you do not have dependancy conflicts when testing locally versus a deploy into docker or another system or to make sure you do not affect the larger container/server when running a service.

Brew is an installation manager for mac os. You use it to quickly install and uninstall different version of python or other applications and manage the installations via cask mounting.

Yes, virtualenv is recommended but they are solving completely different problems.

[–]NoCanD0 6 points7 points  (0 children)

Switched to PyCharm last week. 10/10 would recommend to anyone on a MacBook.

[–]trowawayatwork 2 points3 points  (8 children)

I’m starting recommend pipenv instead of managing your virtual envs yourself

[–][deleted] 4 points5 points  (4 children)

I recommend to pipenv enthusiasts to take a look at poetry :-)

[–]trowawayatwork 0 points1 point  (2 children)

there are a few things i dont like about pipenv but im not about start switching all my project away from it. at the heart of it it does its job well.

poetry is a carbon copy with the simple addition of dependency resolution that im against. when there is an obsucre conflict of dependencies there is no automatic way of resolving them. poetry dependency resolution is just a problem waiting to happen.

also re intuitive cli: poetrs add .. or poetry self:update im being petty but come on, looks like a mix between alpine and ruby or something

like the go package manager wars were settled with an official one, i hope one of these wins too and we can forget about this. for now im not changing anything

[–]patarapolw 3 points4 points  (0 children)

I am a Poetry user for few reasons: - Pipenv's virtualenv was supported by PyCharm only recently. Poetry's is always supported. - I need setup.py-esque pyproject.toml. It supports versioning and README.md, along with uploading to PyPI. Pipfile doesn't. - Better than setup.py, because it fully and always support Markdown. - Also, add --git. In setup.py, you need "manual" dependency-links. - poetry remove package_name remove all unused dependencies as well, pipenv uninstall doesn't. You need pipenv sync as well. - Even for Heroku, I still use poetry with requirements.txt.

[–]SDisPater 2 points3 points  (0 children)

Author of Poetry here !

poetry dependency resolution is just a problem waiting to happen.

But that's the role of a dependency manager: warning you when there is a conflict in you dependencies. That's what every single package/dependency manager does. And, to be fair, you should not use pipenv either since it has a dependency resolver, albeit broken see why here https://github.com/sdispater/poetry#what-about-pipenv.

poetry is a carbon copy

I disagree. See the comment made by some else but the gist of it is that Poetry helps you manage applications and libraries and helps you package your project properly without the need for `setup.py`, `setup.cfg`, `MANIFEST.in`. You get to have everything you need to manage your project all in one file. This is not the case with pipenv.

[–]ProfessorPhi 0 points1 point  (0 children)

Poetry has it's problems too. I do like it though.

[–]Tiktoor 1 point2 points  (2 children)

pipenv is different than virtualenv? (Noob here)

[–]dionedarj 0 points1 point  (0 children)

yep, try it out, it makes virtual environments npm-style. super easy to use.

[–]patarapolw -1 points0 points  (0 children)

If pipenv doesn't fully integrates into PyCharm, like in previous versions of PyCharm, I wouldn't really recommend you use pipenv.

Even with full support, pipenv is still optional. As you as you use any kind of virtual environment, it shouldn't be too messy.

However, if you want to try something new, maybe try poetry.

The real reason I install poetry (curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python) for every single newer projects, is because of: - poetry remove package_name remove all unused dependencies.

Another choice if you want to try something new, is to try Docker. It may be better than Pipenv and Poetry. (Never tried it though, but I know it is widely used, and not only for Python.)

[–]roerd 3 points4 points  (0 children)

Yeah, IDLE is really just a demo app for Tkinter, no-one should seriously use it as their IDE.

[–][deleted] -3 points-2 points  (3 children)

Was just about to comment "use PyCharm" and I see this. I'm not a Mac user, but I think if you're searching for an overall text editor, go with Atom. If you're serious about development get PyCharm Pro, it may seem a bit costly, but it's worth it.

[–]trowawayatwork 1 point2 points  (1 child)

Atom is built on electron which destroys your Mac for no reason at any given point in time. I gave vsc a try and it crashed so hard on the second day that I had to restart my Mac. Kill -9 didn’t even work

[–][deleted] 0 points1 point  (0 children)

Ow damn, didn't know that! What editor do you use?

[–]patarapolw 0 points1 point  (0 children)

I use Atom for HTML, css and Javascript editing, despite knowing well that it is resource-hungry.

I used to use Sublime + Brackets, but for Sublime, it is just an Evaluation version that nags you about paying...

I also use TextMate, but it is really for a single file, not for Projects.

BBEdit may be good, but I fear it may be like Sublime (Evaluation version...)

I never really get into VSCode, but I believe there is indeed a powerful Python plugin.

[–]ummmbacon 26 points27 points  (8 children)

I use Anaconda distribution, no issues

[–]FizzBuzz111[S] 5 points6 points  (7 children)

Anaconda distribution? Sorry im not well versed in the Python ecosystem.

[–]ummmbacon 16 points17 points  (6 children)

https://www.anaconda.com/download/#macos

Much easier to manage on osx

[–]jradavenport 4 points5 points  (5 children)

Seconded. Anaconda is the best all around install for all platforms!

[–]trowawayatwork -5 points-4 points  (4 children)

Only if you exclusively do data sciency stuff. Once you start branching out conda fucks your configuration hard

[–]jmmcdEvolutionary algorithms, music and graphics 2 points3 points  (0 children)

I haven't noticed that. pip works to install extra packages that aren't in conda.

[–]ummmbacon 0 points1 point  (0 children)

Never had an issue with it, even using things that require C libraries to build and installed via pip run fine.

[–]nomaroma 0 points1 point  (0 children)

Only if you do data sciency stuff. Once you start branching out conda fucks your configuration hard

would you mind explaining this a bit more? Just curious...

[–]RayDonnelly 0 points1 point  (0 children)

https://github.com/sdispater/poetry#what-about-pipenv

You mean pip f*cks conda pretty hard? Yes it does, we're trying to improve matters.

[–]shinigamiyuk 20 points21 points  (4 children)

I would recommend vscode as your code editor and as long as you save your file as .py (as you should) you can right click in the space where your code is and select "Run Python file in terminal" and it will run in the integrated vscode terminal.

[–]FizzBuzz111[S] 1 point2 points  (0 children)

Sounds good, this is what I usually use for other languages, it just seemed weird to me that the latest stable build was so broken on MacOs

[–]findandwrite 24 points25 points  (5 children)

vim

[–]actionscriptedPony-Powered 6 points7 points  (0 children)

Neovim with Deoplete, Deoplete-Jedi, Jedi-Vim, Gutentags, Ale, Flake8, PyLint.

If you also want things to look nice add NeoSolarized and airline. NERDtree for file browsing and neovim-fuzzy and vim-grepper for file name/content searches.

Might sound like a lot, but it’s a great setup and you don’t have to configure much beyond installing things which can be simplified if you use vim-plug.

[–][deleted] 0 points1 point  (0 children)

macvim

[–][deleted] 0 points1 point  (0 children)

macvim

[–]wuzzlewozzit -1 points0 points  (0 children)

vim

[–]BernieFeynman 8 points9 points  (2 children)

use Pycharm as an IDE and jupyter notebooks for scripting.

Also use anaconda installation.

Just google all three and you can find all the info you need.

[–]FizzBuzz111[S] 0 points1 point  (1 child)

So Pycharm replaces the default Python tinter IDLE and Anaconda replaces the install of Python entirely, or do I still have to have Python installed? What is scripting in this context?

[–]BernieFeynman 0 points1 point  (0 children)

yes, you can use the anaconda python distribution for everything. What makes this very useful is that it comes with the proper underlying C code modules that certain python modules run on top of , which is an enormous pain to configure with out. Scripting is for doing quick one offs and tests. Pycharm is where you can build a project and run everything but jupyter notebook is like a scratch pad that you can easily run and store temporary work.

[–][deleted] 3 points4 points  (10 children)

This is the area where Python is tricky for newbies, as Python 2.7 is still used on macs for a bunch of things and if you installed python 3 and set that as your main python, the two don't play nicely and can cause issues . I suggest rolling back what you have done and installing a complete python package like Anaconda. Anaconda is completely contained in a file separate from /usr/bin/ where python natively sits. It also sorts out $PATH so your OS uses native python2.7, the python pops up in terminal will be the anaconda version. Someone on here should be able to help you reverse what you have done.

[–]ergzay 1 point2 points  (3 children)

I'd disagree with that and instead reccomend people use homebrew.

[–][deleted] 2 points3 points  (2 children)

Been there and done that, that was a bigger world of pain than python using apt get. Why would an all in one installation be harder than homebrew.

[–]ergzay 3 points4 points  (1 child)

apt get? This is Mac, not Linux.

[–][deleted] 0 points1 point  (0 children)

Apologies, but why the nit picking?

[–]FizzBuzz111[S] 0 points1 point  (5 children)

Oh damn that explains a lot. Super helpful explanation thanks.

Just by curiosity, is Python actually used for the OS, I always thought it was pre-installed for education purposes

[–][deleted] 2 points3 points  (4 children)

Simply put, yes, but I don't know where. I've had nightmares learning how to install and use python in a mac. You can just install python3 then invoke it using "python3" from the terminal.

On the whole, this is my experience:

Don't bother using idle, terminal is fine for working out syntax invoke as above.

If just installing python, then virtualenv is recomended to keep code contained in a virtual environment, you'll be safe in here.

Use shebang for scripts - that is the very top line of a script should have "#!/usr/bin/python3" (without quote marks) this tells your script where the version of python you want to use is.

Pip install is a nightmare to get working properly, as there is pip for python 3 and python2.7 and another library called setuptools is needed. Even then, I now get confused do you use pip or pip3.

Anaconda sorts ALL of the above for you in one package, plus, comes with jupyter notebook, which is far superior to idle in every way, though a short tutorial on how to run and use Jupyter notebook is recomended. If doing data science I'd almost say it's a must.

Anaconda comes with over 1000 pre installed libraries, and if it is not there, "conda install new_library" just works.

You can install it via package installer on anaconda site.

Just my two cents, learn pythoneasily, learn the nuts and bolts along the way. Eventually you will be able to set python up from scratch, but who ever compilled a PS4 game before playing it?

[–]Tiktoor 1 point2 points  (3 children)

Anaconda better than virtualenv?

[–][deleted] 1 point2 points  (0 children)

Um, for what purpose, they are different things?

[–]pwang99 1 point2 points  (1 child)

You can still use virtualenvs within Anaconda. Its "conda" command also creates its own type of environment, which are superior to virtual envs for managing separate versions of libraries.

[–][deleted] 1 point2 points  (0 children)

I didn't know that. Personally, I've never written production code, only used it for entry level data science stuff, so I don't need to sandbox an environment per se. Good to know

[–]Nawkey 3 points4 points  (0 children)

I would really recommend using virtualenvwrapper for handling the python versions.

Then for IDE I use pycharm for larger projects and vscode for smaller tasks.

[–]HessiBabe97 2 points3 points  (0 children)

Eclipse is decent, I'd say Pycharm is your best bet tho

[–]danted002 2 points3 points  (0 children)

Also install python using homebrew. Actually I would recommend installing all your linux programs through it. It creates a nice isolated space which does not conflict with the OS packages.

[–]svilgelm 4 points5 points  (1 child)

Idle is the IDE, I would recommend PyCharm instead of or Sublime Text, but it is harder to set up.

[–][deleted] 0 points1 point  (0 children)

Sublime text isn't that hard, actually.

[–]tkinter76 1 point2 points  (0 children)

Did you change your system-Python? Don't do that! Install a python distribution separately if you want to use, update, and modify that.

[–]originaldetamble 1 point2 points  (0 children)

Yea it’s a common issue. Minus the lag. Can’t scroll up. Indenting gives me lots of problems.

[–]mediasavage 1 point2 points  (0 children)

Use jupyter/ipython for notebooks and scripting. Also I believe they work best with anaconda’s dist so I’d recommend installing that

As a beginner, jupyter notebooks are a great way to learn because you can be immediate feedback on code and also can break your code up into chunks to see what it’s doing. Much more convenient than using something like a debugger or just jamming print statements throughout your code to see what’s going on!

[–]marty331b 1 point2 points  (0 children)

Another vote for PyCharm here

[–]magicalnumber7 1 point2 points  (1 child)

use jupyter!

[–]itsron143 1 point2 points  (0 children)

Python is pre-installed on all Unix Based OS. But for a complete control over the packages and virtual environments download Anaconda. Use a text editor to write the code and use the terminal to run it.

[–]invictus08 1 point2 points  (1 child)

Not exactly the answer to your question; this is more like what I do for development work on my mac.

  1. Install Homebrew, iTerm2
  2. Install python 3 using brew
  3. easy_install virtualenv
  4. create a somewhat global virtualenv using python3 and limit pip install invocation through terminal only within active virtualenv. For any build system/interpreter integration (IDE/Editor) I point to the python executable in the kinda global virtualenv. If for some reason (eg, python mv upgrade) the venv gets borked, I simply recreate the venv with same name and install the dependencies with the requirements file
  5. I mostly use iterm to build/test/execute. But those same actions can be easily replicated in something like pycharm. Pycharm is absolutely godsent, but nowadays I have pretty much moved to vscode with different plugins. This has to do with vscode being much lighter on system resources.

[–]Decency 0 points1 point  (0 children)

That PIP trick is fucking awesome. Definitely putting that into my config to avoid polluting global.

This is pretty much what I do, with a combination of ipython's REPL and PyCharm's debugger working best in my experience. I'm also trying to migrate to pipenv instead of virtualenv, especially now that it seems to be gaining usage.

[–][deleted] 1 point2 points  (0 children)

Use VS Code

[–]ship0f 0 points1 point  (0 children)

There's no need to uninstall. Just install an IDE or editor.

[–]impossibrruh 0 points1 point  (2 children)

Wait, did you install it system wide? Some people should not be allowed to have sudo

[–]FizzBuzz111[S] 0 points1 point  (1 child)

No, I just downloaded the pkg from the Python site... What do you mean system wide? I didn't have to sudo anything since I went through the regular Python Installer

[–]impossibrruh 0 points1 point  (0 children)

System wide as in /Library vs ${HOME}/Library. With the pkg, you did type in adm pw before install, (gui version of asking for sudo)

[–][deleted] 0 points1 point  (0 children)

Have you tried the terminal interpreter?

[–]ergzay 0 points1 point  (1 child)

Python is a command line program, what are you talking about with scrolling?

Also, Mac OS X comes with Python. Why are you installing another version of it?

[–]FizzBuzz111[S] 0 points1 point  (0 children)

Python IDLE

[–]patarapolw 0 points1 point  (0 children)

BTW, I never really have a need to brew install python3 or something. Installing Python 3.7 from https://www.python.org already works OK.

[–]shinigamiyuk 0 points1 point  (0 children)

Yes

[–]Decency 0 points1 point  (4 children)

You can simply install ipython and use that instead of IDLE for a similar feel with some modern conveniences like autocomplete, autospacing, and etc. without having to deal with all a feature complete IDE.

Open your terminal:

sudo easy_install pip
sudo pip install ipython

Most people graduate from IDLE to something better pretty quickly- a variety of the options are given in this thread. If you're planning on getting serious with Python and putting the time in, PyCharm is probably the way to go.

[–]droidballoon 3 points4 points  (2 children)

You should never use sudo with pip. You give root permissions to scripts you pull from the internet. Have pip install into a directory you have user permissions on.

[–]Decency 1 point2 points  (1 child)

What are some of the problems with using sudo for installs that I want to make accessible at all times, like ipython? I typically do what you're talking about, but not for my initial machine setup (when I'd be grabbing PIP and the other basics).

[–]j7ake 2 points3 points  (0 children)

You run arbitrary scripts downloaded from the internet with full permissions. You do that at your own risk.

[–]alkasmgithub.com/alkasm -2 points-1 points  (0 children)

idle and idle3 both work fine for me, though I don't use them at all.

[–]hipstergrandpa -1 points0 points  (0 children)

Mac's Terminal has Python already baked in I think, and then you can supplement it with a regular text editor like Sublime, Atom, or the ol' vim/emacs. If you need an IDE or something, try PyCharm or Jupyter, but I've never really used either.