Code Monkey home page Code Monkey logo

Comments (9)

kescobo avatar kescobo commented on May 23, 2024 1

Ah, ok, in that case perhaps I'll re-open this for now. I guess what I was seeing is the fact that activating a conda environment adds stuff to your PATH.

If I understand correctly, you'd like the user to be able to choose between installing your dependencies themselves or letting CondaPkg do it for them?

Yes, essentially. Eg, perhaps the simplest thing would be if ENV["CONDA_DEFAULT_ENV"] is set already, then just use that? Alternatively, maybe one could check for some new flag ENV["CONDAPKG_USE_DEFAULT_ENV"] = true or something?

I don't think it makes sense for you to support being able to stack environments or to manage some existing environment, but giving users the ability to use their own environment (and if it breaks, it's on them) might be nice.

from condapkg.jl.

cjdoris avatar cjdoris commented on May 23, 2024 1

Ok sure, there could certainly be an opt out mechanism. There is already a backends machinery to let you use a preinstalled Conda. I could add a Null backend which doesn't actually do anything, assuming the user already has a sufficient Conda environment already active.

from condapkg.jl.

cjdoris avatar cjdoris commented on May 23, 2024 1

Ok I've made an issue specifically for the new backend.

Closing this now but feel free to reopen if you want to keep discussing.

from condapkg.jl.

cjdoris avatar cjdoris commented on May 23, 2024 1

Just added this: https://cjdoris.github.io/PythonCall.jl/dev/pythoncall/#pythoncall-config

from condapkg.jl.

kescobo avatar kescobo commented on May 23, 2024

Is it just these lines: https://github.com/cjdoris/CondaPkg.jl/blob/main/src/env.jl#L24-L27 ?

It seems that if I've already got a conda environment activated from my shell, CondaPkg is smart enough to use that:

julia> CondaPkg.withenv() do
       run(`which python`)
end

# removed output....

/home/kevin/Software/miniconda3/bin/python
Process(`which python`, ProcessExited(0))

So that's cool! Maybe just add some guidance in the README to this effect would be useful?

from condapkg.jl.

cjdoris avatar cjdoris commented on May 23, 2024

No, CondaPkg ignores any other environment, but withenv uses your current PATH plus whatever the environment adds (just as if you had activated the environment from the command line).

If I understand correctly, you'd like the user to be able to choose between installing your dependencies themselves or letting CondaPkg do it for them?

Right now, CondaPkg dependencies are purely declarative, and not optional. This rules out shipping a CondaPkg.toml file with your package because they'd be installed for everyone. So I think the best you can do at the minute is give the user a function which adds the right CondaPkg dependencies to their current project.

Optional dependencies is at the back of my mind but I don't have any solid idea how it would work yet. Happy to discuss.

from condapkg.jl.

kescobo avatar kescobo commented on May 23, 2024

Oh, yeah that seems like a fine solution to me πŸ‘

from condapkg.jl.

hhaensel avatar hhaensel commented on May 23, 2024

This issue was very helpful mfor me! Thanks for adding the Null backend πŸš€

I tend to use my Conda.jl installation for all my python work and for me it is very helpful to have the same environment in Python and Julia, particularly when I'm porting code. It took me a while to find the docs for using the same environment as PyCall.
Maybe the following two snippets could find their place in the installation instruction?

ENV["JULIA_PYTHONCALL_EXE"] = "@PyCall"
using PythonCall
@py import pandas as pd
ENV["JULIA_CONDAPKG_BACKEND"] = "Null"
ENV["JULIA_PYTHONCALL_EXE"] = Sys.which("python")
using PythonCall
@py import pandas as pd

from condapkg.jl.

hhaensel avatar hhaensel commented on May 23, 2024

Very clear now πŸ˜ƒ. It will certainly help adopters coming from PyCall like me ...

from condapkg.jl.

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.