Closed RoyRao2333 closed 2 months ago
@RoyRao2333 A few things:
With that said, if you want all of this to "just work", you need to use activation. https://moonrepo.dev/docs/proto/workflows Activation will only enable tools that have a version defined in a .prototools
file.
@milesj
Thanks for the reply.
And,
.zshrc
:# proto
export PROTO_HOME="$HOME/.proto";
export PATH="$PROTO_HOME/shims:$PROTO_HOME/bin:$PATH";
eval "$(proto activate zsh)"
# proto end
But still, I can't invoke cyberdrop-dl
(already sourced .zshrc
). Is there anything missing or am I getting this wrong? Please give some more specific guidance on how to use packages installed by pip?
Thank you very much for your time!
Activation will only enable tools that have a version defined in a .prototools file.
I do have a ~/.proto/.prototools
file:
But as far as I know, these versions are from the packages managed by proto, not by pip. Should I add package versions installed by pip? If do, how can I properly do that?
Activation will include pip packages on PATH
because they belong to the python
tool.
@milesj
Thanks.
So as you can see, I've already appended eval "$(proto activate zsh)"
to .zshrc
. Why still not working?
I'm not quite understand the principle of Shell Activation, sorry for the inconvenience.
Activation updates your PATH
so all of these binaries are available. Globals (~/.proto/.prototools
) are not enabled by default so you need to pass --include-global
.
@milesj
# .zshrc
# proto
export PROTO_HOME="$HOME/.proto";
export PATH="$PROTO_HOME/shims:$PROTO_HOME/bin:$PATH";
eval "$(proto activate zsh --include-global)"
# proto end
I even reinstalled cyberdrop-dl and still no luck...
Are you reloading your shell after making changes to the config?
What's the output of proto activate
if you run it manually?
@milesj
Yes, I reload shell everytime.
Here's the output:
❯ proto activate zsh --include-global
export __ORIG_PATH="$PATH"
_proto_hook() {
trap '' SIGINT
output=$(proto activate zsh --export)
if [ -n "$output" ]; then
eval "$output";
fi
trap - SIGINT
}
typeset -ag chpwd_functions
if (( ! ${chpwd_functions[(I)_proto_hook]} )); then
chpwd_functions=(_proto_hook $chpwd_functions)
fi
Sorry, output of proto activate --export
. It will show you the PATH being set.
You can also set PROTO_LOG=trace
before activate to see what it's doing.
@RoyRao2333 I see /Users/royrao/.proto/tools/python/3.12.4/install/bin
in your PATH
because of activate. Be sure that you are installing pip packages using the proto version of pip. which pip
should point to the python 3.12.4 version.
Edit: Try cd
ing somewhere or calling _proto_hook
directly. I think there may be a bug where it doesn't evaluate till after you move around.
@milesj
Yes, I'm sure that I'm using pip managed by proto. Here's the full output:
As you can see, .proto/tools/python/3.12.4/install/bin
is not added to my PATH variable.
@RoyRao2333 Yeah something seems off. Let me dig through the code and see if I can find the bug.
I think this will fix it. It's hard to verify some of this stuff. https://github.com/moonrepo/proto/pull/572
Can you try the latest patch?
If it still doesn't work, could you do the following:
PROTO_LOG=trace
in your shell, before the activate command.PATH
.Then send over the logs :P
@milesj
- Open a new terminal
- CD into a new directory
- Verify PATH
Thanks, it's working after these steps in v0.39.4 :)
Still got some questions here though:
.proto/shims
and .proto/bin
is duplicated because I added "$PROTO_HOME/shims:$PROTO_HOME/bin"
to my PATH manually in my .zshrc
before activate. But If I don't do that, proto
can't be found at all (command not found: proto
).Thanks for you patience 😊
cd
. The plan is to have it work when shell is activated, but it really depends on if there's a .prototools
file and where a new terminal is opened in. There's also a few perf issues to work out. You could always call _proto_hook
manually in your shell to trigger it for now. @milesj
We can probably filter them if they already exist
I'd like this very much!
The plan is to have it work when shell is activated
I'll call _proto_hook
for now. Hoping it'll work in the future releases.
Again, thanks for this excellent tool you guys brought us! Closing this issue now.
I was looking into removing the duplicate shims/bin paths, but it turns out it was added on purpose, and it's to ensure that proto shims take precedence over the injected tool bin directories.
If you don't care about that, you can pass --no-shim
and --no-bin
flags to the activate command.
@milesj
Got it. Thanks!
I'll try --no-shim
and --no-bin
now.
What version?
0.39.2
Which command?
No response
What happened?
Sorry for the fuzzy title... It's quicker to take a look at these screenshots:
For Node:
But I can find
npm
andcorepack
in~/.proto/tools/node/20.16.0/lib/node_modules
:For Python, packages installed by pip cannot be found either:
I can only use it if I export
~/.proto/tools/python/3.12.4/install/bin
to PATH.This is too much trouble. How can I fix this? Thanks!
Trace logs?
No response
Operating system?
MacOS
Architecture?
arm64