Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Dominoes posted:

Native; non virtual.

I guess I just barely use conda. Wasn't really aware there was such a thing as a non virtual anaconda interpreter!

Really though, with how inexpensive and fast it is, I wouldn't really recommend most people ever use a non-virtual interpreter. Though, I admit, there might be use cases I'm not thinking of.

Thermopyle fucked around with this message at 00:04 on Nov 5, 2015

Adbot
ADBOT LOVES YOU

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

I don't really use python that much, but my setup is Windows with PyCharm, and a bunch of venvs (not because I really need separate environments, just as a best practice thing). Working with the venvs feels like a pain, especially in a console - a lot of the time I prefer opening the whole IDE just to run a script. Last time I did a thing, I spent hours wrestling with the packaging system and ended up having to (I think) download a particular wheel and rename it to trick the system into installing it

Anyway, am I an idiot for not using Anaconda? I don't really know a lot about it but it seems like y'all are using it, and if it removes any of the headaches I'm in

Cingulate
Oct 23, 2012

by Fluffdaddy

baka kaba posted:

Anyway, am I an idiot for not using Anaconda?
Idiot is a strong word, but ...

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

baka kaba posted:

I don't really use python that much, but my setup is Windows with PyCharm, and a bunch of venvs (not because I really need separate environments, just as a best practice thing). Working with the venvs feels like a pain, especially in a console - a lot of the time I prefer opening the whole IDE just to run a script. Last time I did a thing, I spent hours wrestling with the packaging system and ended up having to (I think) download a particular wheel and rename it to trick the system into installing it

Anyway, am I an idiot for not using Anaconda? I don't really know a lot about it but it seems like y'all are using it, and if it removes any of the headaches I'm in

No, you're not an idiot. I switched from virtualenvs to anaconda because everyone in here is always talking about it, but for the use case of virtual environments, I don't really find it any better than virtualenv.

There's a caveat to that though. When you install packages that require compiling on Windows you're often in for a world of hurt. Anaconda provides pre-compiled packages automatically. Whether or not you require compiled packages depends a lot on what field you're working in. It's certainly possible to never need them and thus never run into Anaconda's best feature when it comes to virtual environments.

As far as the extra work of using virtualenvs...look into using virtualenvwrapper. It makes it easier. I think there's a branch for windows.

Space Kablooey
May 6, 2009


Thermopyle posted:

As far as the extra work of using virtualenvs...look into using virtualenvwrapper. It makes it easier. I think there's a branch for windows.

It's a bitch and a half to install it on windows, but it's well worth it.

http://www.tylerbutler.com/2012/05/how-to-install-python-pip-and-virtualenv-on-windows-with-powershell/

SurgicalOntologist
Jun 17, 2004

baka kaba posted:

I don't really use python that much, but my setup is Windows with PyCharm, and a bunch of venvs (not because I really need separate environments, just as a best practice thing). Working with the venvs feels like a pain, especially in a console - a lot of the time I prefer opening the whole IDE just to run a script. Last time I did a thing, I spent hours wrestling with the packaging system and ended up having to (I think) download a particular wheel and rename it to trick the system into installing it

Anyway, am I an idiot for not using Anaconda? I don't really know a lot about it but it seems like y'all are using it, and if it removes any of the headaches I'm in

Well, if you're having issues activating the environment, it won't help. I'm confused what you mean, though. In the console it's one line; in PyCharm you set it and forget it. (is there a shebang equivalent on Windows so you can hard-code the environment into the script?)

OTOH if you're having issues installing packages into the environments, Anaconda may solve these issues.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Dominoes posted:

Native; non virtual.

Those words don't make any sense in this context.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Lysidas posted:

Those words don't make any sense in this context.

I was able to deduce what he meant. Apparently setting Anaconda as your system python interpreter and not using environments is a thing that people do.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
That doesn't make any sense, though. Support of Python 3.5 syntax and features is independent of whether the Python interpreter is the "main" Python installation or a virtualenv. "Full Python 3.5 support" probably means things like the new async syntax; PyCharm 4.5.4 supported the @ matrix multiplication operator but doesn't understand things like async def function(): ...

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Lysidas posted:

That doesn't make any sense, though. Support of Python 3.5 syntax and features is independent of whether the Python interpreter is the "main" Python installation or a virtualenv. "Full Python 3.5 support" probably means things like the new async syntax; PyCharm 4.5.4 supported the @ matrix multiplication operator but doesn't understand things like async def function(): ...

We're talking about Anaconda not PyCharm.

SurgicalOntologist
Jun 17, 2004

Thermopyle posted:

We're talking about Anaconda not PyCharm.

There's the confusion... the conversation started about PyCharm (check the last page).

lord of the files
Sep 4, 2012

Cingulate posted:

Idiot is a strong word, but ...

you are not. but if you are using windows, then having your packages precompiled is helpful. due to how buggy pip is on windows it can be a nightmare to build a package compared to linux. if you are using windows then anaconda should be a strong possibility if working with many external packages.

BigRedDot
Mar 6, 2008

For the record "Python 3.5 support" for Anaconda just means that now there are installers (either full Anaconda or Miniconda network installer) that make Python 3.5 the default python interpreter in the root environment. As noted, anyone could create a new named Python 3.5 environment for some time now.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Nitrocat posted:

you are not. but if you are using windows, then having your packages precompiled is helpful. due to how buggy pip is on windows it can be a nightmare to build a package compared to linux. if you are using windows then anaconda should be a strong possibility if working with many external packages.

Pip for Windows has improved immeasurably in the past few versions. There are still some packages that really do need to be compiled from source (numpy, liblas, greenlet, pyxml) but for the most part pip knows how to work with whl files and knows when to try to compile and when not to.

Jose Cuervo
Aug 25, 2004
I am trying to figure out how best to accomplish the following:

I have a small simulation written in Python that I now want to make more user friendly so that people can actually use it. In particular, I would like people to be able to
1. Change the simulation parameters before clicking a button and running the simulation,
2. See the progress of the simulation (which is currently just text output to the console), and
3. See plots associated with the simulation once it is done running.

Thus I need some sort of GUI.

My idea was to use a web browser to accomplish all of this. Is something like this even possible? If so, what should I begin reading up on /searching for to be able to accomplish this?

The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord

Jose Cuervo posted:

I am trying to figure out how best to accomplish the following:

I have a small simulation written in Python that I now want to make more user friendly so that people can actually use it. In particular, I would like people to be able to
1. Change the simulation parameters before clicking a button and running the simulation,
2. See the progress of the simulation (which is currently just text output to the console), and
3. See plots associated with the simulation once it is done running.

Thus I need some sort of GUI.

My idea was to use a web browser to accomplish all of this. Is something like this even possible? If so, what should I begin reading up on /searching for to be able to accomplish this?

You could use Electron (though I'm not sure it would be the ideal solution). You could also look at using Kivy (or GTK/QT/etc).

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

SurgicalOntologist posted:

Well, if you're having issues activating the environment, it won't help. I'm confused what you mean, though. In the console it's one line; in PyCharm you set it and forget it. (is there a shebang equivalent on Windows so you can hard-code the environment into the script?)

OTOH if you're having issues installing packages into the environments, Anaconda may solve these issues.

I was more wondering if there was a way to streamline it really, so it's not "navigate to the relevant venv's scripts folder, activate it, navigate to the project folder, run the script", especially if you just want to bang it out as a quick command. It's fine within PyCharm obviously!



Thermopyle posted:

No, you're not an idiot. I switched from virtualenvs to anaconda because everyone in here is always talking about it, but for the use case of virtual environments, I don't really find it any better than virtualenv.

There's a caveat to that though. When you install packages that require compiling on Windows you're often in for a world of hurt. Anaconda provides pre-compiled packages automatically. Whether or not you require compiled packages depends a lot on what field you're working in. It's certainly possible to never need them and thus never run into Anaconda's best feature when it comes to virtual environments.

As far as the extra work of using virtualenvs...look into using virtualenvwrapper. It makes it easier. I think there's a branch for windows.

I'll check out that wrapper, it looks a little better at least. And yeah my biggest headache was installing... lxml I think, I ended up researching the whole package management system and chasing down various binary versions and having to try faking the filename so it would install on my system... it was just a dependency for something else, I just wanted to import it and get on with what I was doing. So yeah, any extra layer of management convenience would be great

I guess what I'm really asking is, is Anaconda like a 'default' Python distribution at this point? What the average person should be installing so they can get coding with a minimum of fuss and hassle?

SurgicalOntologist
Jun 17, 2004

baka kaba posted:

I was more wondering if there was a way to streamline it really, so it's not "navigate to the relevant venv's scripts folder, activate it, navigate to the project folder, run the script", especially if you just want to bang it out as a quick command. It's fine within PyCharm obviously!


I'll check out that wrapper, it looks a little better at least. And yeah my biggest headache was installing... lxml I think, I ended up researching the whole package management system and chasing down various binary versions and having to try faking the filename so it would install on my system... it was just a dependency for something else, I just wanted to import it and get on with what I was doing. So yeah, any extra layer of management convenience would be great

I guess what I'm really asking is, is Anaconda like a 'default' Python distribution at this point? What the average person should be installing so they can get coding with a minimum of fuss and hassle?

Oh yeah I haven't used venv for so long I forgot you had to navigate to its folder. Yeah, use conda. It makes the activation process just activate <name-of-env> in Windows (no need to be in any special directory). And conda install lxml will get the binaries and dependencies.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

SurgicalOntologist posted:

Oh yeah I haven't used venv for so long I forgot you had to navigate to its folder. Yeah, use conda. It makes the activation process just activate <name-of-env> in Windows (no need to be in any special directory). And conda install lxml will get the binaries and dependencies.

Well, virtualenvwrapper fixes that.


baka kaba posted:

I guess what I'm really asking is, is Anaconda like a 'default' Python distribution at this point? What the average person should be installing so they can get coding with a minimum of fuss and hassle?

I can't really think of any downsides to just using Anaconda.

I actually use miniconda. AFAICT, the only difference between Anaconda and miniconda is that Anaconda includes a bunch of packages in the download, whereas with miniconda, it downloads packages when you install them.

I don't think I'd call Anaconda the 'default' in the python community.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Yeah it's more the management stuff that sounds nice, I don't actually need all the packages - I mean being able to just make a library appear on your system when you need it is why package managers are neat!

And I know Anaconda isn't the only one of these, I guess I was more asking if these systems are the 'default' over a straight Python download. Like how using some sort of IDE is the 'default' way to program as far as recommendations go, rather than just coding in notepad. That's probably not the best analogy but you know what I mean :ohdear:

SurgicalOntologist
Jun 17, 2004

Thermopyle posted:

Well, virtualenvwrapper fixes that.

Yeah, and I actually use pew (with miniconda) but I didn't want to complicate things further.

Anaconda (well, miniconda) is my default recommendation, and it may be some kind of "default" within the scientific Python community but not so much for Python users as a whole. It should be, though.

Space Kablooey
May 6, 2009


I thought pip was the "default" package manager/installer.

SurgicalOntologist
Jun 17, 2004

"Default" is the wrong word here, I think baka kaba meant more along the lines of "most recommended". It is (in my opinion) "what the average person should install to get coding with minimal fuss."

FoiledAgain
May 6, 2007

PyCharm question:

If I have to go an arbitrary line (say, to fix an error) how can I quickly find out which class I'm in? Is there some way to make the view of my project expand/collapse to follow where I am in the code?

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Yeah I really meant it in the "use this, idiot!" sense hence the :airquote:

FoiledAgain posted:

PyCharm question:

If I have to go an arbitrary line (say, to fix an error) how can I quickly find out which class I'm in? Is there some way to make the view of my project expand/collapse to follow where I am in the code?

If you click the settings gear on that pane and you have an Autoscroll from Source option, it's that

FoiledAgain
May 6, 2007

baka kaba posted:

Yeah I really meant it in the "use this, idiot!" sense hence the :airquote:


If you click the settings gear on that pane and you have an Autoscroll from Source option, it's that

Thanks! I never noticed that option before.

Space Kablooey
May 6, 2009


SurgicalOntologist posted:

"Default" is the wrong word here, I think baka kaba meant more along the lines of "most recommended". It is (in my opinion) "what the average person should install to get coding with minimal fuss."

Ah, sure, that makes sense.

As far as I can recall, except for installing lxml (:v:), I've yet to have a really bad experience using pip.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

FoiledAgain posted:

Thanks! I never noticed that option before.

You can also click the crosshairs/bullseye icon just to the left of the gear icon to scroll to your currently editing file in the Project view without turning on the AutoScroll thingy.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Thermopyle posted:

You can also click the crosshairs/bullseye icon just to the left of the gear icon to scroll to your currently editing file in the Project view without turning on the AutoScroll thingy.

Ohhh is that what that does. I poked it a few times and wondered

LXML!!! :bahgawd:

Cingulate
Oct 23, 2012

by Fluffdaddy
I'm trying to figure out how I would go about renewing our Anaconda Accelerate/MKL license when they run out in a few month, and since the website upgrade, I don't understand anything anymore. Any pointers? I'm at a university and want to set it up on two or three systems.

Also, I have a laptop that I actually mostly use on the move - a lot of that without web access. What happens if I set up MKL there - does my Numpy simply stop working when I'm on the train?

KICK BAMA KICK
Mar 2, 2009

Emacs Headroom posted:

Once you're used to that, look into Scala -- you get the interactive notebook / REPL, static typing, compile time checking, and functional stuff all at once.
From like a month ago but I wanted to say thanks, I did start learning Scala. :ssh: I think I like it more than Python. :ssh: Translated some Java code I had written for an algorithms course and started finding a bunch of optimizations that were obvious to me when seeing the same ideas expressed in the functional style.

BigRedDot
Mar 6, 2008

Cingulate posted:

I'm trying to figure out how I would go about renewing our Anaconda Accelerate/MKL license when they run out in a few month, and since the website upgrade, I don't understand anything anymore. Any pointers? I'm at a university and want to set it up on two or three systems.

Also, I have a laptop that I actually mostly use on the move - a lot of that without web access. What happens if I set up MKL there - does my Numpy simply stop working when I'm on the train?

There shouldn't be a need to renew, MKL was just recently made available to everyone for free (log on to anaconda.org to download a license to use locally). But send me a PM and I will get you in touch with the right people if you still have questions/issues.

FWIW I have relayed the problems around messaging to Travis, and we are working it. Still working through some growing pains, organizationally speaking.

QuarkJets
Sep 8, 2008

BigRedDot posted:

There shouldn't be a need to renew, MKL was just recently made available to everyone for free (log on to anaconda.org to download a license to use locally). But send me a PM and I will get you in touch with the right people if you still have questions/issues.

Just want to reiterate how awesome this is

Cingulate
Oct 23, 2012

by Fluffdaddy

QuarkJets posted:

Just want to reiterate how awesome this is
empty quoting

Whenever complaining about anything continuum, it's just me saying "why do I only have one cherry on top? I want three!"

Cingulate
Oct 23, 2012

by Fluffdaddy
Ah well, my 3.5/Anaconda/MKL woes continue. I've set up a new 3.5 environment,
code:
conda install mkl
, update everything (license is still in .continuum). But my numpy/scipy versions are the non-MKL variants:
code:
numpy                     1.10.1                   py35_0
and

code:
numpy.show_config()
blas_opt_info:
    language = c
    define_macros = [('HAVE_CBLAS', None)]
    library_dirs = ['/home/cingulate/anaconda3/lib']
    libraries = ['openblas']
openblas_info:
    language = c
    define_macros = [('HAVE_CBLAS', None)]
    library_dirs = ['/home/cingulate/anaconda3/lib']
    libraries = ['openblas']
openblas_lapack_info:
    language = c
    define_macros = [('HAVE_CBLAS', None)]
    library_dirs = ['/home/cingulate/anaconda3/lib']
    libraries = ['openblas']
lapack_opt_info:
    language = c
    define_macros = [('HAVE_CBLAS', None)]
    library_dirs = ['/home/cingulate/anaconda3/lib']
    libraries = ['openblas']
blas_mkl_info:
  NOT AVAILABLE
However, conda also claims 
code:
Note that the following features are enabled:
  - mkl

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Okay so I feel kinda embarrassed about this question. It's about an early Project Euler question: question 18.

I should preface this by saying that I eventually figured out the correct solution, and it's way simpler than the solution I'm going to ask about. Here's one right way to do it:
http://codepad.org/3fwfoSrN

So there's probably much simpler/more elegant ways to write that, but it works just fine. You give it a filename, it reads the numbers in, and does its thing. The algorithm is applicable to the more difficult problem 67, as well.

Here's the thing: I don't know anything about math, and these solutions don't come easily to me, so I originally came up with the idea of computing the answer with a "longest path" algorithm. I found Dijkstra's Algorithm on Wikipedia, converted the pseudocode to Python, and came up with:
http://codepad.org/H0dHxtqN

I can't figure out where my implementation is wrong; I've never implemented Dijkstra's Algorithm before. Either that, or I can't figure out why this algorithm is not sufficient to solve the problem. It actually works on the smaller example that Project Euler gives. Can anyone give me any hints? And sorry about my crappy code, or if it's hard to read. It's not too many lines, at least.

Fergus Mac Roich fucked around with this message at 01:08 on Nov 11, 2015

FoiledAgain
May 6, 2007

I don't think that algorithm applies here because you don't need to calculate the shortest path through the pyramid. You have to find the biggest number on each line. Turn the pyramid into a list of lists of integers, find the biggest integer in each list with max(), then sum() them at the end.

edit: Ah, I see I misunderstood the problem. I looks like adjacency does matter. Ignore me in this case. But even still, I don't know that you have the right approach. The correct answer doesn't find the shortest route, because there is no shortest route. You have to take one number from every line.

FoiledAgain fucked around with this message at 01:38 on Nov 11, 2015

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Is there a real difference between a shortest path and a longest path? You can see in the code there that I swapped the concepts around where appropriate. I suppose there's something I'm not understanding, but it seemed clear to me that the values of the numbers mapped neatly onto the concept of weights of nodes on a graph. All paths are the same number of nodes, but each node has a different weight, determined by the number the node represents in the triangle. In the first solution I linked, I did exactly what you said(okay i reread what you said and no I didn't do that but I did something that does work and is much simpler than a graph), but I am sort of a dummy and it took me a solid week to think of that. I'm just trying to make sure I have my head around why I was wrong.

Fergus Mac Roich fucked around with this message at 01:41 on Nov 11, 2015

FoiledAgain
May 6, 2007

Fergus Mac Roich posted:

but it seemed clear to me that the values of the numbers mapped neatly onto the concept of weights of nodes on a graph

I don't think this works because in the pyramid you're limited in terms of which numbers you can select next. In other words, not all of the nodes are connected. If you selected the number in position p on row r, then in row r+1 you can only select the numbers in positions p-1, p, and p+1 (and if you selected the first or last number on a line, then of course you can't take p-1 or p+1).

Adbot
ADBOT LOVES YOU

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Yeah... it's still not intuitive to me why this algorithm can't do this(note that my script does model the constraint you mentioned) but I guess I should have read further. There are other internet resources making it clear that this algorithm is just inapplicable to longest path in a DAG, assuming that I'm right that this problem actually can be modeled in that way. I guess I'll come back to this problem one day when I understand graph algorithms better and maybe it'll make more sense. At least I have a solution. Thanks.

Fergus Mac Roich fucked around with this message at 02:19 on Nov 11, 2015

  • Locked thread