Code Monkey home page Code Monkey logo

Comments (8)

asmeurer avatar asmeurer commented on June 1, 2024

One issue is supporting different shells from bash. And also Windows...

from conda-build.

tpn avatar tpn commented on June 1, 2024

Yup. It gets annoyingly more involved once you get past the surface.

We've (Continuum) talked in the past about implementing conda via bash/zsh scripts right? Perhaps that is the most appropriate top-level change to make. That would make this particular change trivial to implement.

A Windows equivalent... ugh. No technical reason why it wouldn't be possible.

from conda-build.

asmeurer avatar asmeurer commented on June 1, 2024

The problem is that right now, activate is really just a convenience script. All it does is prepend the PATH and set CONDA_DEFAULT_ENV (the latter lets you conda install in that environment without using -n). But there's no reason why you shouldn't be able to modify your PATH manually, or just call the absolute path to the binary. I personally have more than one conda environment in my default PATH.

So I'm a little uneasy about pre-activate scripts, because then packages that use them would only work if you used activate to activate the environment.

I think a better solution here would be to patch R to find tcl/tk automatically in the same prefix. We can also patch our tcl/tk if that helps (though we shouldn't change the tcl/tk API obviously).

from conda-build.

tpn avatar tpn commented on June 1, 2024

Oh, right, yeah I understand how the current implementation of activate works -- I was referring to the enhancement that's been thrown about a couple of times where conda would actually be implemented as a shell function, dispatching to underlying Python files where necessary.

That's a pretty substantial change though. Our installer would have to change, Linux/OSX users would have to ensure their dotfiles source the new whatever.rc files that we provide, etc. There are definitely benefits though -- implementing them directly in bash/zsh facilitates environment manipulation as well as vastly improved completion support (especially with zsh).

I guess R could be patched. I don't think this is unique to R though; some packages really do rely on environment variables being set correctly (ORACLE_HOME and QTDIR come to mind too) -- this is going to become more common as conda starts branching out into other non-Python arenas.

So, it would be great if conda had a facility for supporting this. (It's just unfortunate that the implementation details are so... complicated, once you dig past the surface layer.)

from conda-build.

asmeurer avatar asmeurer commented on June 1, 2024

That too would just be a convenience wrapper, so that you don't have to type "source". But using conda directly and modifying the PATH manually would still supported (especially since people do use non-bash shells like csh, zsh, fish, ...).

I really think it's not a question of implementation details. It's just a question of what we want to consider a conda environment to be. Right now, it is really nothing more than another prefix on your PATH. activate helps you manage your PATH, but that's it. This idea is really powerful. Imagine the possibilities if every single independent program on your computer used a different environment. Issues like conflicting libraries would be non-issues. You can already do this with Python programs using virtualenv or conda environments, but conda is Python agnostic, so you can really do it with anything. Conda's clever ideas of hard linking and relocatable packages make this possible.

So really the issue is packages like oracle or tk or qt that only expect to be installed once per machine, not a hundred times as conda lets you do. Applying your idea weakens the idea of any conda environment that uses it. Suddenly, they can only be used if they are activated (and of course only one environment can be active at once per (bash) session). It's almost as bad as the non-environment situation where you can only have one prefix per system.

I'm not opposed or for the idea at this point. I just think we should understand the implications.

(by the way, we already have tab completion support in bash using argcomplete. See http://conda.pydata.org/docs/config.html#tab-completion).

from conda-build.

bkreider avatar bkreider commented on June 1, 2024

I believe this is solved by conda-env, but maybe not documented well? https://github.com/conda/conda-env/blob/develop/bin/activate#L78

from conda-build.

msarahan avatar msarahan commented on June 1, 2024

activate.d scripts can be used for this. Closing.

https://conda.io/docs/using/envs.html#saved-environment-variables

from conda-build.

github-actions avatar github-actions commented on June 1, 2024

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!

from conda-build.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.