Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add option to select the Python executable to the "Run settings" dialog. #1601

Open
spyder-bot opened this issue Feb 17, 2015 · 19 comments

Comments

@spyder-bot
Copy link
Collaborator

From [email protected] on 2013-10-13T11:17:14Z

I do a lot of Python development, and I would like to execute a few of my scripts in a virtual pypy environment.

This works, if I set the global python interpreter to pypy. But than I cannot execute all the scripts that are incompatible with pypy any more. Even worse, the ipython console stops to work immediately for any script and manual usage.

Suggest solution:
Add section "Python executable" to the "run settings" dialog, that is specific for each script. It should offer push buttons "Default" and "Use the following Python interpreter:" with a text entry field for the fully qualified name of the interpreter.

In this way I would be able to run a few scripts with pypy, and all the rest with the default python interpreter.

Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1601

@spyder-bot
Copy link
Collaborator Author

From ccordoba12 on 2015-01-01T15:46:44Z

Labels: MS-v2.4 Cat-Console

@goanpeca
Copy link
Member

@blink1073 is this something you would agree on doing?

@blink1073
Copy link
Contributor

Yep, can do.

@blink1073
Copy link
Contributor

@ccordoba12, should I just add this to #2198? If not, I'll wait until that one is merged to implement this.

@ccordoba12
Copy link
Member

@blink1073, nop. Let's merge #2198 first.

I haven't worked on this issue because I think it's not easy to get the UX right. These are my concerns:

  1. Should we open a Python/IPython console for the user, so she can run it's script, if there's none with her selected interpreter?
  2. Should we always evaluate her script on the same interpreter? She could have a set of libraries that are only installed on that interpreter, so it won't make sense to use any interpreter.
  3. What if she wants to use the IPython console? She would need to install it first on her interpreter before trying to open a new one, or else things won't work!

All of this makes me realize that the right UX is to let users set their interpreters on a project basis, not on a file basis. At least that's what other IDE's do (e.g PyCharm and Python tools for Visual Studio).

@ccordoba12
Copy link
Member

Besides, this will avoid us to deal with all these complications (which seem to be too much to handle ;-)

@blink1073
Copy link
Contributor

So, assuming this is set on a per-project basis (which I agree with):

We would start an IPython kernel (and python console) using the given interpreter when the project is loaded, and all scripts would be run using that interpreter. This would require them to have IPython installed for that interpreter (or they can fall back on the Python one).

We'd need to have a more visible warning as to why IPython is not available, perhaps a popup stating that the minimum version was not found.

@goanpeca
Copy link
Member

Looking it from a practical side (what the user explains ...), sometimes you might be working on a "project" plus some non project related things, and these extra things might not be running with the same interpreter (or should not). Having this setting would give flexibility to the user from having to close and reopen projects constantly.

@ccordoba12 your points seems understandable, but why not give support to the simplest option at least? I would say this option should only support "Execute in a new dedicated Python Console" so if you select it, the rest of options should be greyed out (that would give a visual Cue on what the user can expect)

@Nodd
Copy link
Contributor

Nodd commented Apr 14, 2015

@goanpeca 👍
What about people not using projects ? When we talked about projects, we all agreed that using projects would be optional.
For me supporting only "Execute in a new dedicated Python Console" is fine, but UI-wise I would put the option to choose a specific interpreter between the radiobuttons (with an indent), and disable it if "Execute in a new dedicated Python Console" is not selected.

For supporting "Execute in active console" we should create something to easily change the interpreter for the console (like a menu entry on right clic, or in the topright menu).

@goanpeca
Copy link
Member

@Nodd you read my mind!! your powers are increasing!

@ccordoba12
Copy link
Member

@blink1073, when a user is selecting an interpreter for her project, we should check if IPython is installed on it, and if not, warn her about it.

@goanpeca, I see that you'd like more flexibility for power users (like you and me :-). But that could be really, really confusing for regular users (that are 90 or 95% of our users). So, for now, my vote is for letting users set their interpreters only at the project level. If we hear a really compelling reason to go for the file level, then we could think about it. Else, power users can open as many Spyder instances as they want, and evaluate their files with as many interpreters as they want ;-)

@nod, we just need to maintain the current option to change Python executables. That will avoid using projects to change interpreters ;-)

@goanpeca goanpeca removed this from the v3.0 milestone Apr 14, 2015
@ccordoba12
Copy link
Member

@blink1073, on a second thought, and following @goanpeca's suggestion, I think we can add the option to select an interpreter to the Run dialog (but not in Run preferences, right?), under the Dedicated Python console section.

That way we would avoid the issue with IPython, and all other things will continue to work as they are working right now :-)

Sorry that I've missed the point before ;-)

@ccordoba12 ccordoba12 added this to the v3.0 milestone Apr 16, 2015
@goanpeca
Copy link
Member

Yeiiiii 👍

@blink1073
Copy link
Contributor

Why not in the global config? I can see users getting frustrated with having to specify it for every file they open.

@Nodd
Copy link
Contributor

Nodd commented Apr 18, 2015

It already is configurable in the console preferencies.

@ccordoba12
Copy link
Member

Yes, in

Preferences > Console > Advanced settings > Python executable

to be exact :-)

@ccordoba12
Copy link
Member

But that affects both Python and IPython consoles, in all configurations (external, dedicated and interactive).

@ccordoba12 ccordoba12 modified the milestones: v3.1, v3.0 Dec 16, 2015
@blink1073 blink1073 removed their assignment Mar 11, 2017
@ccordoba12 ccordoba12 removed this from the todo milestone Jun 25, 2017
@ccordoba12 ccordoba12 added this to the v4.0beta2 milestone Jun 25, 2017
@ccordoba12 ccordoba12 modified the milestones: v4.0beta2, v4.0beta3 Aug 13, 2017
@ccordoba12 ccordoba12 modified the milestones: v4.0betaX, Not sorted Oct 11, 2018
@pyZerrenner
Copy link

Before opening a new issue, I would like to ask here, whether this feature could be considered again. Though since this issue is now many years old, I assume that there is not a high demand for it.

I work on different virtual conda-environments for different projects (sometimes multiple environments within the same project) and generally run my scripts in a dedicated console. So a feature to select the python interpreter for a dedicated console in the "Run configuration per file" dialog would be appreciated instead of always having to go into the settings menu and switching the interpreter globally. Maybe it is also possible to add an item in the "Console" menu to start a new console with a dialog to select a specific configuration (interpreter, special console type, etc.), though I do not use this menu myself.

Thanks for your continued efforts.

PS: I use "project" in the general sense, not in the "Spyder-project" sense.

@endolith
Copy link

endolith commented Jul 11, 2024

Why not in the global config? I can see users getting frustrated with having to specify it for every file they open.

I would like it to be specified for every file that is opened. Unless the entire Spyder configuration is changed for each environment (including which files are open), then I typically have files open from different projects and environments, and I would like them to each run in their own conda environment. (Or I would just run them all in the base environment, but that approach eventually has dependency issues and breaks.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants