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

Feature request: per-project Python interpreter #11362

Open
akdor1154 opened this issue Jan 20, 2020 · 27 comments
Open

Feature request: per-project Python interpreter #11362

akdor1154 opened this issue Jan 20, 2020 · 27 comments

Comments

@akdor1154
Copy link
Contributor

akdor1154 commented Jan 20, 2020

Related issues:
#9804 (project settings, you guys are considering Conda envs which is a similar usecase)
#1014 (exactly this, imported from google code and seemingly abandoned)

Currently interpreters are a global setting. It would be great to have a Python interpreter selectable as a project-level preference instead.

In #9804 it looks like you are considering allowing project-level Conda, but I don't use Conda. I just use a virtualenv per project (managed by poetry; pipenv users will have a similar/identical setup). This means I just want to set every project's interpreter to ./.venv/bin/python, relative to the project root.

For bonus points it would be nice to detect the existence of a pyproject.toml (https://www.python.org/dev/peps/pep-0518/), check if poetry is used (likewise for any other pyproject.toml-using tools), and if so then autoconfigure project interpreter to be the default under poetry env.

@LeoWelter
Copy link

may I say "me too". I was kind of expecting this would be in. As new user of Spyder i'm kind of disappointed since virtual env support is in pycharm and eclipse for ages now.

@ccordoba12 ccordoba12 added this to the future milestone Jan 28, 2020
@goanpeca goanpeca removed this from the future milestone Feb 23, 2020
@mhamiltonj
Copy link

The lack of this feature means the team I work with is now migrating to PyCharm, despite the fact it has drawbacks for data science work. Keeping multiple team members' enviroments consistent with conda was just too cumbersome, so we switched to pipenv, only to find that dealing with different envirmoments in spyder requires manually changing the interpreter path in settings every time you switch project. Given that we all work on several projects, and often need to switch between them quickly, this is just not a usable workflow.

@ccordoba12
Copy link
Member

Sorry to hear that. Unless you and your team are willing to fund this feature, it'll come in Spyder 5 (to be released next year).

@svdHero
Copy link

svdHero commented Nov 24, 2020

@mhamiltonj we have exactly the same problem in our company. Switched to pipenv and wanted to migrate from PyCharm to Spyder, which is especially great for our physicists, because Spyder has such a Matlab-Feel to it.
The only obstacle remaining is the need to manually change the interpreter path many times a day. So annoying and error-prone.

Spyder is great, but it definetely needs this feature in order to be of any significance in a professional work environment (pun intended 😉 ).

@ccordoba12
Copy link
Member

@svdHero, I said in my comment above:

Unless you and your team are willing to fund this feature, it'll come in Spyder 5 (to be released next year).

Unfortunately, this is not true anymore. Furthermore, we don't have plans to implement this now because it's been requested very little.

So, if this is important for your company, please consider to fund this work. You can contact me (my email address is in my profile) to discuss about it.

@PackElend
Copy link

there is a similar request, see #4223

@svdHero
Copy link

svdHero commented Jan 6, 2021

@ccordoba12 Unfortunately, funding is not possible, since we are a rather small electronics manufacturing company and the main focus is not Python. So management has no interest in investing into Python toolchain. Seems as if I will have to go back to VSCode until this feature makes it into Spyder.

I am sorry. I'd love our company to support open source projects. 😔

@ccordoba12
Copy link
Member

@svdHero, sorry to hear that. Unfortunately, we are a small team and this is kind of a big feature. We'll try to implement it for Spyder 6, to be released at the end of this year or the beginning of 2022.

@mrclary
Copy link
Contributor

mrclary commented Jan 7, 2021

@ccordoba12, Since Spyder projects already create a .spyproject directory containing project configuration settings, it seems that the core configuration paradigm already exists and the bulk of the development work would just be implementing a project configuration interface. I imagine a Project Configuration window that would be something like a stripped down version of Spyder's preferences window, with the ability to select an interpreter (and set code style linting, and ...).

This, of course, would be quite a bit of work; but does this resemble what you were thinking could be included for Spyder 5?

@ccordoba12
Copy link
Member

ccordoba12 commented Jan 8, 2021

Yes, that's basically the idea. We have a proposal for that dialog on issue #9804. However, we won't have time to include it for Spyder 5 (unless someone else helps us).

@frafra
Copy link

frafra commented Apr 13, 2021

Wouldn't it be enough in some cases to add a command line option to use a specific python executable? Something like --use-current-python-interpreter and or --python-intepreter PATH?

It would be pretty easy just running spyder -p . --use-current-python-interpreter

Even without UI, having the Python interpreter configured in the project settings would be great!

Integration with Poetry seems more tricky, as spyder_kernels should be available in the virtual environment, but Poetry does not support using system installed packages (only in master).

@trianta2
Copy link

trianta2 commented Nov 11, 2021

I've been searching around for this feature request. I just installed Spyder 5.1.5 and I'm loving the improvements over Spyder 3. Kind of surprised that project-specific metadata such as the Python interpreter isn't available. Looking forward to when this feature is added.

@ccordoba12
Copy link
Member

This feature hasn't been implemented yet, sorry.

@EvenGu
Copy link

EvenGu commented Mar 9, 2022

I'd like to request this feature as well. Once I create a spyder project, I would expect to be able to specify and save the interpreter associated so that I don't need to change it every time I work on another project in a different environment.

@invokermain
Copy link

This is a sorely needed feature, per project venv is best practice, using shared venv across many projects is not great and leads to many bad habits (one venv for everything, no per project dependency specification etc)

@ccordoba12 ccordoba12 modified the milestone: v6.0alpha1 Mar 28, 2022
@ccordoba12
Copy link
Member

ccordoba12 commented Mar 28, 2022

We'll try to implement this feature for Spyder 6, but the problem is that offering the ability to associate an environment with a project also intuitively demands a graphical way to manage packages in the env. And that's simply a much harder endeavor for which we don't have enough resources at the moment.

@jonzhaopeng
Copy link

We also need this feature, but we don't have money to donate. Maybe We have engineers to write code

@ghost
Copy link

ghost commented Oct 11, 2022

I encountered this issue as well and have created a workaround for Windows in this gist to deal with this in the meantime. Perhaps it's useful for others.

@ccordoba12 ccordoba12 added this to the v6.0alpha1 milestone Oct 11, 2022
@wilecoyote2015
Copy link

We also need this feature. I've considered migrating from PyCharm to Spyder for scientific work several times in the last years, but this, along with missing PyCham-Like run-configurations, is always a showstopper, unfortunately.

@AZippelius
Copy link

I also really want this feature, and the lack makes working with multiple projects are real pain.

@ghost
Copy link

ghost commented Jan 2, 2023

@AZippelius I think "a real pain" is exagerating a bit, but if you're really hindered by this you can use the gist I linked to earlier to work around this issue (on Windows).

@AZippelius
Copy link

@ba-tno As far as I can tell, that automatically selects the interpreter when starting Spyder, but not when switching projects inside spyder. So that would require a restart each time, which is only a marginal improvment.

@ghost
Copy link

ghost commented Jan 10, 2023

@AZippelius That's correct, in my day to day work I rarely switch projects from within spyder. If I do, I simply launch a new instance (and maybe close the other one) with my script from a different directory with an environment file.

@callegar
Copy link

callegar commented Feb 4, 2023

@ccordoba12

We'll try to implement this feature for Spyder 6, but the problem is that offering the ability to associate an environment with a project also intuitively demands a graphical way to manage packages in the env

Please, don't let this delay this useful feature. If I understand it correctly, as soon as the console in spyder gets associated with a virtual environment you already get a way to manage packages in the env from spyder almost for free: running pip or whatever tool is used for package management in the specific environment from the console.

@gwerbin
Copy link

gwerbin commented Apr 11, 2023

@AZippelius I think "a real pain" is exagerating a bit, but if you're really hindered by this you can use the gist I linked to earlier to work around this issue (on Windows).

I would say it is indeed "a real pain" for some workflows, but not others. For example, not having this feature is basically a dealbreaker for me, and it's been the #1 thing keeping me away from using Spyder over the years (RStudio also lacks or lacked this feature for many years, and similarly I basically had to stop using it). I would love to see this implemented ASAP, because I do very much want to use Spyder.

I also strongly agree with @callegar in that you do not need GUI package management in order to make per-project environment/interpreter association useful, and that I hope the legitimate desire for the former does not delay the latter.

@01tot10
Copy link

01tot10 commented May 25, 2023

I'm in the process of trying to have my projects contained in separate (conda/mamba) environments, and ran into this limitation today. Wanted to give my thumbs up for the development team for considering this as a future feature!

@mrclary
Copy link
Contributor

mrclary commented May 25, 2023

This feature is planned for Spyder 6.0 release later this year.

@ccordoba12 ccordoba12 modified the milestones: v6.0alpha1, v6.0alpha2 Jun 8, 2023
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha2, v6.0alpha3 Jul 29, 2023
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha3, v6.0beta1 Nov 17, 2023
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha4, v6.0beta1 Feb 6, 2024
@ccordoba12 ccordoba12 modified the milestones: v6.0alpha5, v6.1.0 Mar 12, 2024
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