bulletmark / pipxu Goto Github PK
View Code? Open in Web Editor NEWInstall and Run Python Applications in Isolated Environments using UV
Install and Run Python Applications in Isolated Environments using UV
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.
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.
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.
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}"
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???
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.
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!
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'
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.
pipxu/pipxu/commands/install.py
Lines 56 to 60 in abc02f4
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
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
!
I found this section in your toml file. What is its purpose?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.