Giter Club home page Giter Club logo

pipxu's People

Contributors

bulletmark avatar nardol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

nardol

pipxu's Issues

PermissionError: [Errno 13] Permission denied: '/run/user/1000'

Summary

A PermissionError occurs when using the pipxu install command.

$ /workspaces/codespaces-blank $ pipx install uv pipxu
...
$ /workspaces/codespaces-blank $ pipxu install hatch
Traceback (most recent call last):
  File "/usr/local/py-utils/bin/pipxu", line 8, in <module>
    sys.exit(main())
  File "/usr/local/py-utils/venvs/pipxu/lib/python3.10/site-packages/pipxu/pipxu.py", line 184, in main
    return args.func(args)
  File "/usr/local/py-utils/venvs/pipxu/lib/python3.10/site-packages/pipxu/commands/install.py", line 60, in main
    with FileLock(lockfile):
  File "/usr/local/py-utils/venvs/pipxu/lib/python3.10/site-packages/filelock/_api.py", line 339, in __enter__
    self.acquire()
  File "/usr/local/py-utils/venvs/pipxu/lib/python3.10/site-packages/filelock/_api.py", line 295, in acquire
    self._acquire()
  File "/usr/local/py-utils/venvs/pipxu/lib/python3.10/site-packages/filelock/_unix.py", line 38, in _acquire
    ensure_directory_exists(self.lock_file)
  File "/usr/local/py-utils/venvs/pipxu/lib/python3.10/site-packages/filelock/_util.py", line 46, in ensure_directory_exists
    Path(filename).parent.mkdir(parents=True, exist_ok=True)
  File "/usr/local/python/3.10.13/lib/python3.10/pathlib.py", line 1175, in mkdir
    self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/run/user/1000'

Description

To the best of my knowledge, this error occurs in Unix environments where systemd is not running, such as Docker containers and WSL.

The issue seems to arise from the part of the pipxu install command that tries to create a lock file.

lockfile = user_runtime_path() / f'{args._prog}.lock'
vdirbase = args._venvs_dir
for pkg in args.package:
# Use a lock file in case we are running multiple installs in parallel
with FileLock(lockfile):

In Unix environments, the path configured by platformdirs.user_runtime_path() becomes /run/user/xxxx. However, in the targeted environments, /run/user/xxxx does not exist. Moreover, the /run/user directory is not accessible to normal users.

As a result, users are forced to run sudo mkdir /run/user/xxxx && sudo chown -R $USER:$USER /run/user/xxxx before using pipxu install. This is not an ideal solution.

The easiest way to reproduce this issue is to launch a Blank GitHub Codespace: https://github.com/codespaces

Solution

How about generating the lock file under $USER/.local? From my understanding, either of the following paths would be suitable:

>>> platformdirs.user_data_path()
PosixPath('/home/codespace/.local/share')
>>> platformdirs.user_state_path()
PosixPath('/home/codespace/.local/state')

I would be happy to create a pull request once we reach an agreement on this change. Thank you for the great work on pipxu!

Ability to pass arguments to uv pip when upgrading a package

To compare with pipx, if I want to update something to a pre-version, I can run pipx upgrade --pip-args=--pre <package>
I have not found how to do the same with pipxu.
I tried with run-pip but I had the message specifying "--prerelease=allow" is a wrong parameter passed to pipxu.

Could it be possible to allow this situation?
Allowing to pass arguments to uv pip E.G. when upgrading.

pipxu cannot find uv package

In an elevated shell I install pipx via python -m pip install pipx.

In a demoted shell I install pipxu via pipx install pipxu:

>pipx install pipxu
  installed package pipxu 1.15, installed using Python 3.10.6
  These apps are now globally available
    - pipxu-bootstrap
    - pipxu.exe
done! โœจ ๐ŸŒŸ โœจ

Then I run

>pipxu list
Error: uv program must be installed, and in your PATH or specified with --uv option.

It seems like pipxu executes uv via command line instead of using its library API, and the dependency on uv is not installed automatically into the pipx environment.
Any ideas how to resolve that?

I then tried installing pipxu into the base/global conda environment, but the same error still appears. I guess the dependency on uv is not declared in the pipxu package.

Edit: Upon further consultation of README, it seems uv cannot be installed via pip at all???

error: unrecognized arguments: --index-url

To install a tool from a custom index url I use the following with pipx:

pipx install some-great-tool -i https://myserver/custom/simple/
pipx install some-great-tool --index-url https://myserver/custom/simple/

Current behavior

$ pipxu install some-great-tool --index-url https://myserver/custom/simple/
usage: pipxu [-h] [--uv uv_path] [-m] [--home HOME] [--bin-dir BIN_DIR] [--man-dir MAN_DIR] [--default-python DEFAULT_PYTHON] [-V]
             {debug,inject,install,list,reinstall-all,reinstall,runpip,uninject,uninstall-all,uninstall,upgrade-all,upgrade,version} ...
pipxu: error: unrecognized arguments: --index-url https://myserver/custom/simple/

Expected behavior

Package installed from custom index server

pipxu is fantastic, just works and is fast and efficient!

Feel free to close this "issue" once you've read. I wanted to say thank you for this wonderful package, it just works, is super fast, and disk space efficient.

Since I've upgraded to python 3.12, I've had to start using pipx, which I love in theory, but being based on pip is super slow, pipxu is exactly what the community needs

Thank you again!

Install error: unexpected argument 'Support/pipxu/venvs/1' found

Installing with the script, I get this error:

>>> Running uv venv -q --python=python3 /Users/brad.feehan/Library/Application Support/pipxu/venvs/1
error: unexpected argument 'Support/pipxu/venvs/1' found

Usage: uv venv [OPTIONS] [NAME]

For more information, try '--help'.
Error: failed to create /Users/brad.feehan/Library/Application Support/pipxu/venvs/1 for pipxu.

Cause

The virtualenv is created in a path with a space, which is interpreted as two arguments to the uv command, instead of one argument containing a space.

The default path for PIPXU_HOME is set in pipxu/pipxu.py:124.

This refers to platformdirs.user_data_dir() which is a good practice. However on MacOS this is "${HOME}/Library/Application Support", and it causes the error when the PIPXU_HOME contains a space.

Potential fix

A hacky solution would be to quote the directory, but then directories containing " quote characters would fail (kinda pathological but also technically possible).

As a better solution, it probably shouldn't use shell quoting rules to execute subprocesses. Instead, use an interface that allows passing arguments as individual strings, so nothing requires quoting.

Workaround

Manually tell pipxu to store its stuff in a directory with no space characters in the path:

export PIPXU_HOME="${HOME}/.pipxu"
mkdir -p "${PIPXU_HOME}"

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.