... | ... | @@ -17,17 +17,50 @@ Note that I'm (@ljg) no Python expert, so please feel free to join the [discussi |
|
|
|
|
|
## User-based Individual Configuration
|
|
|
|
|
|
First, determine the version of the default python and decide if it's acceptable for your project:
|
|
|
|
|
|
```bash
|
|
|
python3 --version
|
|
|
```
|
|
|
|
|
|
(It's currently 3.9 on the Rocky 9 systems and 3.6 on the Rocky 8 systems.)
|
|
|
|
|
|
If you need a newer version, try, for example:
|
|
|
|
|
|
```bash
|
|
|
which python3.12
|
|
|
```
|
|
|
|
|
|
Unfortunately 3.9 is the newest available on Rocky 8 and 3.12 is the newest on Rocky 9.
|
|
|
|
|
|
### venv
|
|
|
|
|
|
If you've verified that the environment or packages you need are not already on the system, then you most likely need to install something that would conflict with the system environment, and likely would conflict with other python environments you may want to run in the future. If it's an environment that more of your colleagues are interested in, then see the group shared topics further down the page. If you want to set something up just for yourself, then I strongly recommend using the [venv](https://docs.python.org/3/library/venv.html) tools to isolate the environment.
|
|
|
|
|
|
The following creates a Python 3.12 environment stored in a directory named `example` in your login directory and then "activates" it so that the default `python` and `pip` commands are operating within that environment using corresponding defaults.
|
|
|
|
|
|
```bash
|
|
|
python3.12 -m venv ~/example
|
|
|
source ~/example/bin/activate
|
|
|
```
|
|
|
Now you can probably cut-and-paste instructions from that obscure package installation and stand a chance of being successful, assuming Python 3.12 is a good starting point. To exit the environment, use the command:
|
|
|
|
|
|
```bash
|
|
|
deactivate
|
|
|
```
|
|
|
|
|
|
### pip
|
|
|
|
|
|
TL;DR: use the command:
|
|
|
If you're using the `venv` method above (which I recommend), you can just use `pip`, but if you really want to use a non-isolated environment, especially with a newer-than-the-default version of pip and python, then you can:
|
|
|
|
|
|
```bash
|
|
|
pip3 install --user
|
|
|
pip3.12 install --user something
|
|
|
python3.12
|
|
|
```
|
|
|
|
|
|
### Anaconda
|
|
|
|
|
|
### venv
|
|
|
(Please contribute advice on user-based installations.)
|
|
|
|
|
|
## Research-group Shared Configuration
|
|
|
|
... | ... | |