-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Select different anaconda environments #4223
Comments
Could you be more specific? |
Spyder is not limited to use in an Anaconda distribution. I also use Spyder in a WinPython distribution. I don't think it is practical for Spyder to know which package manager installed it and handle all the complexities of changing environments. With both Anaconda and WinPython, I create a separate Windows batch file for each environment to run Spyder. Discussion and example batch files are at winpython/winpython#351 |
I still don't understand that well how you guys are talking about, but our plan to manage environments/virtualenvs in Spyder is by adding the possibility of a setting a particular Python interpreter per project. That will be done in Spyder 3.3. |
I go to "Preferences > Python interpreter > Use the following interpreter" and change it to the newly created environment:
Now I restart Spyder and get the error:
So I install
And if I open Spyder it still shows the anaconda default environment:
Would this generally be the right way to work with different environments? |
Or is this the case because Spyder is started from another anaconda environment and I normally had to start it from the system python interpreter? |
Are you sure is that the default environment? Please try to import any package besides |
You are right, it somehow worked after restarting a couple of times because the kernel broke down it IPython console did not open. I have installed pyPdf in the environment test-wise and importing works partly but then breaks:
This might also related to pyPdf but let's put my question more generally away from debugging third party packages: If you wanted to use Spyder and Anaconda on a Linux-System working on different Anaconda environments, what would be the steps to install Spyder and later change between the environments? |
There's no easy way right now, except changing interpreters in However, when we add the possibility to associate a conda env to a project, then you would only need to create a project for your code, and decide what modules you'd like to use in your project (we'll also provide a graphical interface to install conda packages). Does that sound good? |
👍 The only thing I'd be interested in would then be the planned release date 😄 |
This will be part of Spyder 3.3, to be released by the end of the summer. |
Thanks! |
@ckaldemeyer, please leave this one open so we don't forget to address it in 3.3 ;-) |
👍 |
Spyder IDE specific enviroment workaround by attaching Spyder IDE to a running enviroment kernel Preliminary: need to install ipykernel into the specific enviroment @ckaldemeyer has this as above. I've found it useful to add a descriptive name when installing the kernel, that way when changing kernels in Jupyter notebook it makes straightforward the environment you are working with: Get a list of your kernels (so you know which one to use) Launch Jupyter qtconsole (console, notebook) using the kernel associated with the enviroment you want to work with (ie the output from jupyter kernelspec list). If working with jupyter notebook, you can just launch the notebook normally and change the kernel on the right side. Within the qtconsole (console, notebook) spawned from the step above use a magic number command to get all of the information you need for a connection The output from the magic number (%connect_info) at the end, lists the name of the kernel.json file you can use to attach, on linux its normally automatically saved to /run/user/"your user id"/jupyter if you added the kernel to the environment as a user. Alternatively copy the connection port information within the curly braces (including the curly braces) of the output %connect_info and save it as .json file. Use Spyder IDE to connect to already running kernel: Spyder will now be using the kernel specific to your environment. Because you can use multiple IPython console tabs, you can run/test code against different environments by just changing the tabs of the IPython console |
Is there anything wrong with doing something like the following to invoke spyder with a specific environment?
Call that alias to open spyder in that env.
I've been doing this to run spyder within alternate envs without problems. Is this OK, or have I just been lucky? |
That is ok. In fact, there's a similar mechanism for Windows users provided automatically by Anaconda (i.e. Anaconda creates Start menu entries for each Spyder package in different envs). We simply want to avoid this process and let users work with a single Spyder version for all their projects. |
Hi all, I use the Python 3.6. After I create a new ENV of Python 3.5 I have the same problem by switching Spyder between different ENVs. But I figure out. Here is what I did: Then close the Spyder That's all. |
Hi Everyone; |
how about the Spyder 3.6? |
3.6 is the Python version, not the Spyder version. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
the best way I found is to : conda install spyder and: then select the env in the top window |
Brilliant - that's the answer right there! Much appreciated. |
This is also related with what @mrclary suggested we do to make the python interpreter configuration option in the preferences leaner. I would like to hear your thoughts :-p . I also agree we should probably use envs in general instead of interpreters, but there might be cases where one still needs to point to a specific interpreter. Also some pointers, what should be the default behavior when switching to a different env (from the status bar), restart the consoles? only the current one? ask the user? add an option on preferences to do it automatically or ask the user all the time? |
What do you mean "switching to a different env (from the status bar)"? Do you mean just updating the status bar when switching console tabs? Presently, switching "interpreters" in the preferences only affects new console tabs, leaving existing console tabs in the environment (interpreter) they were started with; I think this is good. But it would be nice if the "interpreter" status in the status bar updated to reflect the current console tab, similar to the git status when switching editor documents. |
Yeah, that would be really nice. My vote would be to always restart the current console or just start a new console with that environment. |
The way VSCode changes the interpreters is very efficient and was hoping this was introduced in spyder. When will it be available? |
I would like to see the same functionality as in VS Code as well, I have just switched from VS Code to Spyder but being a bit disappointed as this feature is missing. |
@PackElend, since Spyder 4.2.0, you can go to
Check the option called |
I'm aware of this but this not as convenient as in VS Code. |
all issues have in common, that I want to be able to switch the environment by a single click or environment is changed automatically when a project is selected with a custom environment. |
Switching environments makes little sense in Spyder because a user can open as many consoles as they want. Therefore, we're planning to offer the ability to open a console with any detected environment. If you want to participate in the discussion we're having about that, please leave your comment in spyder-ide/ux-improvements#10. |
@ccordoba12 @PackElend, I agree that these features are desirable but I think we can close this issue in favor of existing ones.
|
I disagree. I think the PR that fixes spyder-ide/ux-improvements#10 should fix this one as well (this has a lot more history). |
Description of your problem
What steps will reproduce the problem?
What is the expected output? What do you see instead?
I want wo use this environment (send the code to the interpreter)
The interpreter breaks down.
Isn't there a way to switch different Anaconda envs within Spyder?
Please provide any additional information below
Versions and main components
Dependencies
Please go to the menu entry
Help > Optional Dependencies
(orHelp > Dependencies
), press the buttonCopy to clipboard
and paste the contents below:
The text was updated successfully, but these errors were encountered: