Post #1309406
2026-04-17 20:46 UTC
Replies (8)
-
@txtechnician@mastodon.social 2026-04-17 20:56
@bryanredeagle Why is the "no home dir" being mentioned? Is it relevant to your setup? PyPi packages are often Linux System Packages too. You can install from PyPi, but will get a warning from your system. In general, the Python package in your System package manager is sometimes named "python-packageName". So, look for Linux packages before PyPi installs for ease of use. Outside of that: - python venv: `python3 -m venv venv` - docker python environment
-
@txtechnician@mastodon.social 2026-04-17 21:08
@bryanredeagle https://docs.python.org/3/library/venv.html
-
@luyin@lgbtqia.space 2026-04-17 21:22
@bryanredeagle uv if possible
-
@wyatt@polymaths.social 2026-04-17 21:23
@bryanredeagle very carefully! Any other questions, just submit another ticket and don't forget to give me a rating on your satisfaction.
-
@flan@bonito.cafe 2026-04-17 22:16
@bryanredeagle I use pyenv for installing specific python versions for for different projects, and venv for creating virtual environments, if a project need to run in the background, i have two methods, depending the case For example, after installing pyenv: pyenv install 3.13.7 pyenv shell 3.13.7 python -m venv /home/auser/project source /home/auser/project/bin/activate cd /home/auser/project pip install apackage python aproject.py For running in the background, after installing screen: screen -dmS projectname /bin/bash -c "source /home/auser/project/bin/activate && cd /home/auser/project && python aproject.py --paramsifrequired" And for viewing such screen: screen -r projectname CTRL+C for stopping the screen CTRL+A next CTRL+D for screen detach and returning to the console In a systemd service with a virtual env: sudo nano /etc/systemd/system/aservice.service paste: [Unit] Description=A service for a server [Service] Type=simple #User=auser ExecStart=/home/auser/project/bin/python aproject.py WorkingDirectory=/home/auser/project TimeoutSec=60 StandardOutput=journal StandardError=journal SyslogIdentifier=aproject Restart=always [Install] WantedBy=multi-user.target CTRL+S for saving and CTRL+X for closing nano sudo systemctl daemon-reload && sudo systemctl enable aservice && sudo systemctl start aservice && journalctl -feu aservice Hope this helps you
-
@anzah@raphus.social 2026-04-17 23:48
@bryanredeagle probably none of the regular things work, like installing dependencies from requirements.txt or making the script a Python package. However maybe somehow creating in memory filesystem might work. Probably would need venv on top of that. Not sure that the account has necessary rights to mount anything. Another crazy idea is to bundle ask the dependencies into the script. Probably would be lot of work to refactor everything to work in a setup like that.
-
@danmac@aus.social 2026-04-18 04:40
@bryanredeagle usually in the situation I would use the /opt or /usr/local directories. Create a directory for the scripts, change the ownership to the user or leave it root if they don't need to be writeable
-
@darac@furry.engineer 2026-04-18 06:20
@bryanredeagle a couple of options: can you make a package, so that the script makes use of system libraries? If you require packages that aren't in your distro, that's a non-starter. Alternatively, might somewhere like /usr/libexec be suitable?