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

Powershell activate and deactivate #626

Closed
asmeurer opened this Issue Mar 28, 2014 · 64 comments

Comments

Projects
None yet
@asmeurer
Contributor

asmeurer commented Mar 28, 2014

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@meawoppl

This comment has been minimized.

Show comment
Hide comment
@meawoppl

meawoppl Oct 30, 2014

Honestly just adding those scripts to the distribution seems to work flawlessly on win7-64bit. Would you like a PR for this?

meawoppl commented Oct 30, 2014

Honestly just adding those scripts to the distribution seems to work flawlessly on win7-64bit. Would you like a PR for this?

@asmeurer

This comment has been minimized.

Show comment
Hide comment
@asmeurer

asmeurer Oct 30, 2014

Contributor

Sure, but see also #913

Contributor

asmeurer commented Oct 30, 2014

Sure, but see also #913

@meawoppl

This comment has been minimized.

Show comment
Hide comment
@meawoppl

meawoppl Oct 30, 2014

Ahh, seems like that deals with it all much more nicely. Thanks for the ref.

meawoppl commented Oct 30, 2014

Ahh, seems like that deals with it all much more nicely. Thanks for the ref.

@rossant

This comment has been minimized.

Show comment
Hide comment
@rossant

rossant Jan 2, 2015

Will #913 work in Powershell? If not, would it be worth just adding the ps scripts to the distribution?

rossant commented Jan 2, 2015

Will #913 work in Powershell? If not, would it be worth just adding the ps scripts to the distribution?

@Ivoz

This comment has been minimized.

Show comment
Hide comment
@Ivoz

Ivoz Sep 15, 2015

Is there anything bad about just including ps scripts while you figure out #913 ? I thought conda was supposed to be advertised as more featureful than virtualenv :P

Ivoz commented Sep 15, 2015

Is there anything bad about just including ps scripts while you figure out #913 ? I thought conda was supposed to be advertised as more featureful than virtualenv :P

@liujimj

This comment has been minimized.

Show comment
Hide comment
@liujimj

liujimj Oct 17, 2015

Just to chime in, I also wasted about an hour of time figuring out why my environments weren't activating.

Anaconda envs are advertised as full-featured replacements for venv, so I would expect Powershell support.

liujimj commented Oct 17, 2015

Just to chime in, I also wasted about an hour of time figuring out why my environments weren't activating.

Anaconda envs are advertised as full-featured replacements for venv, so I would expect Powershell support.

@msarahan

This comment has been minimized.

Show comment
Hide comment
@msarahan

msarahan Oct 17, 2015

Contributor

If @Liquidmantis or anyone else wants to submit the ps scripts that @rossant mentioned, I'll merge them. It would be nice to not include another license file with Conda. I the meantime, we are reviewing #913 and its newer derivatives and hope to merge it soon.

Contributor

msarahan commented Oct 17, 2015

If @Liquidmantis or anyone else wants to submit the ps scripts that @rossant mentioned, I'll merge them. It would be nice to not include another license file with Conda. I the meantime, we are reviewing #913 and its newer derivatives and hope to merge it soon.

@Liquidmantis

This comment has been minimized.

Show comment
Hide comment
@Liquidmantis

Liquidmantis Nov 25, 2015

I'm fine with them being added, and was going to submit a PR now, but it looks like conda has been reworked and the old bat files have been removed anyway so I'm not sure how to proceed.

Liquidmantis commented Nov 25, 2015

I'm fine with them being added, and was going to submit a PR now, but it looks like conda has been reworked and the old bat files have been removed anyway so I'm not sure how to proceed.

@msarahan

This comment has been minimized.

Show comment
Hide comment
@msarahan

msarahan Nov 25, 2015

Contributor

Things are in a little bit of flux right now. The activate scripts were moved out of conda, into conda-env. This has unfortunately made the activate scripts harder to test, since they effectively depend on two packages. We will be discussing this after the Anaconda 2.4.1 release, and hopefully coming up with a better arrangement. If you put a PR in against conda-env, we'll be happy to consider it, and we'll take care of any moves necessary thereafter.

Contributor

msarahan commented Nov 25, 2015

Things are in a little bit of flux right now. The activate scripts were moved out of conda, into conda-env. This has unfortunately made the activate scripts harder to test, since they effectively depend on two packages. We will be discussing this after the Anaconda 2.4.1 release, and hopefully coming up with a better arrangement. If you put a PR in against conda-env, we'll be happy to consider it, and we'll take care of any moves necessary thereafter.

@masaeedu

This comment has been minimized.

Show comment
Hide comment
@masaeedu

masaeedu Mar 18, 2016

@msarahan It looks like the Anaconda 2.5 release is out now. Has there been any progress on this? It would greatly improve the Windows UX if this could be fixed. 🙏

masaeedu commented Mar 18, 2016

@msarahan It looks like the Anaconda 2.5 release is out now. Has there been any progress on this? It would greatly improve the Windows UX if this could be fixed. 🙏

@vmuriart

This comment has been minimized.

Show comment
Hide comment
@vmuriart

vmuriart Mar 21, 2016

@Liquidmantis Seems like the old bat files have been added back. I just tested your scripts from pscondaenvs and they work with conda 4.0.5.

#913 was closed in favor or #1727, but it didn't address the powershell issue.
@msarahan would you still accept the pr if @Liquidmantis or anyone else submits them?

vmuriart commented Mar 21, 2016

@Liquidmantis Seems like the old bat files have been added back. I just tested your scripts from pscondaenvs and they work with conda 4.0.5.

#913 was closed in favor or #1727, but it didn't address the powershell issue.
@msarahan would you still accept the pr if @Liquidmantis or anyone else submits them?

@msarahan

This comment has been minimized.

Show comment
Hide comment
@msarahan

msarahan Mar 28, 2016

Contributor

Sorry for the delay here. Absolutely.

Before they are accepted, they need to pass the test_activate.py tests. I added a bit of scaffolding for powershell, but didn't want to bloat #1727 any further. Please see this comment for how to run the tests with the new shell (modify test_activate.py, but also pass a command-line argument): #1727 (comment)

Ping me if you are working on this and need help.

Contributor

msarahan commented Mar 28, 2016

Sorry for the delay here. Absolutely.

Before they are accepted, they need to pass the test_activate.py tests. I added a bit of scaffolding for powershell, but didn't want to bloat #1727 any further. Please see this comment for how to run the tests with the new shell (modify test_activate.py, but also pass a command-line argument): #1727 (comment)

Ping me if you are working on this and need help.

@vmuriart

This comment has been minimized.

Show comment
Hide comment
@vmuriart

vmuriart Apr 12, 2016

@msarahan just took a look at this today to get it added. Might take me a bit to implement the Powershell test. Just noticed that the section on it is just an exception 🙍

vmuriart commented Apr 12, 2016

@msarahan just took a look at this today to get it added. Might take me a bit to implement the Powershell test. Just noticed that the section on it is just an exception 🙍

@msarahan

This comment has been minimized.

Show comment
Hide comment
@msarahan

msarahan Apr 15, 2016

Contributor

@vmuriart go ahead with a PR whenever, even if tests are not passing. I'll be happy to help you flesh out the framework.

Contributor

msarahan commented Apr 15, 2016

@vmuriart go ahead with a PR whenever, even if tests are not passing. I'll be happy to help you flesh out the framework.

vmuriart added a commit to vmuriart/conda that referenced this issue Apr 17, 2016

vmuriart added a commit to vmuriart/conda that referenced this issue Apr 17, 2016

@Gemma-Rate

This comment has been minimized.

Show comment
Hide comment
@Gemma-Rate

Gemma-Rate Nov 26, 2016

+1, encountering this issue on windows 10.

Gemma-Rate commented Nov 26, 2016

+1, encountering this issue on windows 10.

@JaimieMurdock

This comment has been minimized.

Show comment
Hide comment
@JaimieMurdock

JaimieMurdock Nov 26, 2016

+1 again, just ran into this again trying to do Py3 testing.

JaimieMurdock commented Nov 26, 2016

+1 again, just ran into this again trying to do Py3 testing.

@njalerikson

This comment has been minimized.

Show comment
Hide comment
@njalerikson

njalerikson Nov 30, 2016

Contributor

Addressed with #3175 and #3960

Contributor

njalerikson commented Nov 30, 2016

Addressed with #3175 and #3960

@schlichtanders

This comment has been minimized.

Show comment
Hide comment
@schlichtanders

schlichtanders Dec 14, 2016

Is there any progress on this? just tried https://github.com/Liquidmantis/PSCondaEnvs, but they break
and executing activate.bat within powershell just hangs forever

schlichtanders commented Dec 14, 2016

Is there any progress on this? just tried https://github.com/Liquidmantis/PSCondaEnvs, but they break
and executing activate.bat within powershell just hangs forever

@arvindch

This comment has been minimized.

Show comment
Hide comment
@arvindch

arvindch Jan 3, 2017

Same here - I'm very confused about the lack of working PowerShell support.

arvindch commented Jan 3, 2017

Same here - I'm very confused about the lack of working PowerShell support.

@BCSharp

This comment has been minimized.

Show comment
Hide comment
@BCSharp

BCSharp Jun 21, 2017

None of the solutions worked for me so I wrote my own activate.ps/deactivate.ps1 scripts:
https://github.com/BCSharp/PSCondaEnvs

Works on Windows/macOS/Linux, works for additional user environments in ~/.conda/envs.

BCSharp commented Jun 21, 2017

None of the solutions worked for me so I wrote my own activate.ps/deactivate.ps1 scripts:
https://github.com/BCSharp/PSCondaEnvs

Works on Windows/macOS/Linux, works for additional user environments in ~/.conda/envs.

@darkdreamingdan

This comment has been minimized.

Show comment
Hide comment
@darkdreamingdan

darkdreamingdan Jul 9, 2017

I've been building on BCSharp's excellent work at my own repo (currently on PR).

Just do:
conda install -n root -c pscondaenvs pscondaenvs

You need Conda 4.1 or above (check with conda info conda) - otherwise please install the latest version.

Behavior is exactly like CMD - use activate or deactivate appropriately. It's completely backwards compatible and will also launch both .ps1 and .bat activate.d/deactivate.d scripts.

darkdreamingdan commented Jul 9, 2017

I've been building on BCSharp's excellent work at my own repo (currently on PR).

Just do:
conda install -n root -c pscondaenvs pscondaenvs

You need Conda 4.1 or above (check with conda info conda) - otherwise please install the latest version.

Behavior is exactly like CMD - use activate or deactivate appropriately. It's completely backwards compatible and will also launch both .ps1 and .bat activate.d/deactivate.d scripts.

@joaobarcia

This comment has been minimized.

Show comment
Hide comment
@joaobarcia

joaobarcia Aug 1, 2017

Hi @darkdreamingdan , thanks for the work.

I ran conda install -n root -c pscondaenvs pscondaenvs in the powershell and got a success message by the end of the installation process.

However, if I try to run activate, I get:

Error: could not find environment: cmd.exe
Environment not changed.

If I try to run conda install -n root -c pscondaenvs pscondaenvs again, or inside CMD I now get:

Error: HTTPError: 403  Forbidden  http://repo.continuum.io/pkgs/pro/win-64/

Also, if I run activate in CMD once, I am able to run activate in the powershell from then on.

Any ideas? Happy to send any info that might help with debugging.

joaobarcia commented Aug 1, 2017

Hi @darkdreamingdan , thanks for the work.

I ran conda install -n root -c pscondaenvs pscondaenvs in the powershell and got a success message by the end of the installation process.

However, if I try to run activate, I get:

Error: could not find environment: cmd.exe
Environment not changed.

If I try to run conda install -n root -c pscondaenvs pscondaenvs again, or inside CMD I now get:

Error: HTTPError: 403  Forbidden  http://repo.continuum.io/pkgs/pro/win-64/

Also, if I run activate in CMD once, I am able to run activate in the powershell from then on.

Any ideas? Happy to send any info that might help with debugging.

@darkdreamingdan

This comment has been minimized.

Show comment
Hide comment
@darkdreamingdan

darkdreamingdan Aug 5, 2017

joaobarcia, please post a github bug report on my project so we can discuss there.

darkdreamingdan commented Aug 5, 2017

joaobarcia, please post a github bug report on my project so we can discuss there.

@h404bi

This comment has been minimized.

Show comment
Hide comment
@h404bi

h404bi Aug 6, 2017

@darkdreamingdan you closed your project's issue tracker, you might need to open it up.

h404bi commented Aug 6, 2017

@darkdreamingdan you closed your project's issue tracker, you might need to open it up.

@vidartf

This comment has been minimized.

Show comment
Hide comment
@vidartf

vidartf Nov 20, 2017

Is there currently an open PR for a fix? All earlier references I can find have been closed, and I'm not able to track those to any new PRs.

vidartf commented Nov 20, 2017

Is there currently an open PR for a fix? All earlier references I can find have been closed, and I'm not able to track those to any new PRs.

@msarahan

This comment has been minimized.

Show comment
Hide comment
@msarahan

msarahan Nov 20, 2017

Contributor

Not that I'm aware of.

There have been several PRs, but none have implemented this in a way that we think is wise. Activation is more than just modifying PATH - it's also running other scripts in the etc/conda/activate.d folder. Any accepted solution needs to do everything that the current activate.bat script does:

  • get path changes from conda itself (as opposed to hard-coding changes in powershell somehow)
  • call all additional .ps1 scripts in activate.d folders

The latter point there is tricky. Since powershell support is so new, it would be nice if the powershell scripts also supported .bat files in the absence of any similarly-named .ps1 file. Some packages, such as GDAL, depend on these scripts to set environment variables.

@kalefranz has done a ton of work to rework how activation scripts work in the 4.4.x branch. It may be worth postponing any further effort on powershell until 4.4.x gets out of pre-release and into common usage. It's much faster and simpler with regards to this activation stuff.

Contributor

msarahan commented Nov 20, 2017

Not that I'm aware of.

There have been several PRs, but none have implemented this in a way that we think is wise. Activation is more than just modifying PATH - it's also running other scripts in the etc/conda/activate.d folder. Any accepted solution needs to do everything that the current activate.bat script does:

  • get path changes from conda itself (as opposed to hard-coding changes in powershell somehow)
  • call all additional .ps1 scripts in activate.d folders

The latter point there is tricky. Since powershell support is so new, it would be nice if the powershell scripts also supported .bat files in the absence of any similarly-named .ps1 file. Some packages, such as GDAL, depend on these scripts to set environment variables.

@kalefranz has done a ton of work to rework how activation scripts work in the 4.4.x branch. It may be worth postponing any further effort on powershell until 4.4.x gets out of pre-release and into common usage. It's much faster and simpler with regards to this activation stuff.

@BCSharp

This comment has been minimized.

Show comment
Hide comment
@BCSharp

BCSharp Nov 21, 2017

@h404bi, the development continued at https://github.com/BCSharp/PSCondaEnvs, post your issues there. At my end, I cannot reproduce the issue reported by @joaobarcia using the latest version.

@msarahan, PSCondaEnv does just what you mention, although it can be improved (esp. in speed). I am looking forward to the rework of activation in 4.4.

BCSharp commented Nov 21, 2017

@h404bi, the development continued at https://github.com/BCSharp/PSCondaEnvs, post your issues there. At my end, I cannot reproduce the issue reported by @joaobarcia using the latest version.

@msarahan, PSCondaEnv does just what you mention, although it can be improved (esp. in speed). I am looking forward to the rework of activation in 4.4.

@msarahan

This comment has been minimized.

Show comment
Hide comment
@msarahan

msarahan Nov 21, 2017

Contributor

@BCSharp that looks very refined. Nice work - especially on the .bat file fallback. Do you mind putting up a PR against the 4.3.x branch? I guess the only annoying part left might be getting the test suite to run against your scripts.

Contributor

msarahan commented Nov 21, 2017

@BCSharp that looks very refined. Nice work - especially on the .bat file fallback. Do you mind putting up a PR against the 4.3.x branch? I guess the only annoying part left might be getting the test suite to run against your scripts.

@darkdreamingdan

This comment has been minimized.

Show comment
Hide comment
@darkdreamingdan

darkdreamingdan Nov 22, 2017

The bug @joaobarcia posted was already resolved on my fork darkdreamingdan/PSCondaEnvs#1 where the bat functionality came from in the first place 😕

darkdreamingdan commented Nov 22, 2017

The bug @joaobarcia posted was already resolved on my fork darkdreamingdan/PSCondaEnvs#1 where the bat functionality came from in the first place 😕

@msarahan

This comment has been minimized.

Show comment
Hide comment
@msarahan

msarahan Nov 22, 2017

Contributor

Sorry for any credit misassignment. Having done a lot of work on the bat and shell activation scripts, I admire what you all have done with the powershell stuff. I've been off of this stuff for not quite 2 years now, so please forgive my ignorance of who has done what.

Contributor

msarahan commented Nov 22, 2017

Sorry for any credit misassignment. Having done a lot of work on the bat and shell activation scripts, I admire what you all have done with the powershell stuff. I've been off of this stuff for not quite 2 years now, so please forgive my ignorance of who has done what.

@kalefranz

This comment has been minimized.

Show comment
Hide comment
@kalefranz

kalefranz Jun 7, 2018

Member

If anyone following this thread would like to contribute, #6471 sketches out the start of what a powershell wrapper might look like under the conda 4.4+ framework. The #6471 PR has additional instruction and comments. A new PR that follows the same patterns established by the five other shell wrappers, and as sketched out in #6471, would be very welcome.

Member

kalefranz commented Jun 7, 2018

If anyone following this thread would like to contribute, #6471 sketches out the start of what a powershell wrapper might look like under the conda 4.4+ framework. The #6471 PR has additional instruction and comments. A new PR that follows the same patterns established by the five other shell wrappers, and as sketched out in #6471, would be very welcome.

@musm

This comment has been minimized.

Show comment
Hide comment
@musm

musm Sep 24, 2018

bump desperately seeking Powershell support

musm commented Sep 24, 2018

bump desperately seeking Powershell support

@kalefranz

This comment has been minimized.

Show comment
Hide comment
@kalefranz

kalefranz Sep 25, 2018

Member
Member

kalefranz commented Sep 25, 2018

@kalefranz

This comment has been minimized.

Show comment
Hide comment
@kalefranz

kalefranz Oct 4, 2018

Member

Resolved by #7794. Will be included in conda 4.6.

Member

kalefranz commented Oct 4, 2018

Resolved by #7794. Will be included in conda 4.6.

@kalefranz kalefranz closed this Oct 4, 2018

@rhaejr

This comment has been minimized.

Show comment
Hide comment
@rhaejr

rhaejr Oct 10, 2018

This is still messed up with Powershell with current anaconda version.

rhaejr commented Oct 10, 2018

This is still messed up with Powershell with current anaconda version.

@mingwandroid

This comment has been minimized.

Show comment
Hide comment
@mingwandroid

mingwandroid Oct 10, 2018

Contributor
Contributor

mingwandroid commented Oct 10, 2018

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