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

wenv init as non root user #4

Closed
stuaxo opened this issue Dec 10, 2019 · 8 comments
Closed

wenv init as non root user #4

stuaxo opened this issue Dec 10, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@stuaxo
Copy link

stuaxo commented Dec 10, 2019

If I install wenv as a user it installs to ./.local/bin/wenv:

$ pip3 install wenv
$ which wenv
/home/stu/.local/bin/wenv

However wenv init tries to install use the system directory, in this case it should run successfully, and probably setup in .local/share/wenv

@s-m-e s-m-e added the bug Something isn't working label Dec 11, 2019
@s-m-e
Copy link
Member

s-m-e commented Dec 11, 2019

Yes, indeed. For a user install, Python's sys.prefix still points to /usr (instead of ~/.local/. Some logic is needed to detect where and how the package is installed to avoid this.

@stuaxo
Copy link
Author

stuaxo commented Dec 11, 2019

I wonder what pip does to work out where to install things ?

@s-m-e
Copy link
Member

s-m-e commented Dec 11, 2019

There is a --user option for pip install. I'd bet it can be triggered through a configuration file or environment variable. What OS / distro are you running on?

@stuaxo
Copy link
Author

stuaxo commented Dec 11, 2019

Ubuntu, --user seems to be the default, though I'm at work so check try right now.

s-m-e added a commit that referenced this issue Dec 11, 2019
@s-m-e
Copy link
Member

s-m-e commented Dec 11, 2019

Ubuntu, --user seems to be the default [...]

Thanks, I have not seen this before. Will try in a VM.

In the meantime, I just pushed a possible fix to develop. You can try it by installing it from github: pip install -U git+https://github.com/pleiszenburg/wenv.git@develop

It should auto-detect a user installation and use site.USER_BASE instead of sys.prefix.

@stuaxo
Copy link
Author

stuaxo commented Dec 11, 2019

Cheers I'll give it a go later, and double check my assumptions.

@stuaxo
Copy link
Author

stuaxo commented Dec 11, 2019

Great, that works.

According to this bug - eight04/vpip#4

The rule is:

If the sys.prefix is not writeable and site.ENABLE_USER_SITE is set then try the directory --user would use.

The dest directory is described in PEP 0370

The destination directory is the same on mac and linux, I guess wenv is Windows a bit exotic, but you never know(?).

@s-m-e
Copy link
Member

s-m-e commented Dec 17, 2019

Implemented in v0.2.0, released.

@s-m-e s-m-e closed this as completed Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants