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

Add Linux prep instructions to developer guide #575

Merged

Conversation

renxida
Copy link
Contributor

@renxida renxida commented Nov 20, 2024

[skip ci]

There are some apt packages needed before it would work.

@renxida renxida force-pushed the add-linux-prep-instructions-to-developer-guide branch from 29cfb30 to fdff368 Compare November 21, 2024 14:52
(these instructions are tested on Ubuntu 24.04 which has clang-18 and python3.12 by default)

```
sudo apt update && sudo apt install -y python-is-python3 python3.12-venv python3-dev clang lld
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to recommend https://github.com/pyenv/pyenv over python-is-python3 python3.12-venv python3-dev

I regularly switch between 3.10, 3.11, 3.12, 3.13, and 3.13t when testing packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyenv sounds awesome & would probably make it a lot annoying to manage this. However, I have zero experience with pyenv and really am not the best qualified person to write these instructions.

What do you think about just getting the apt install command in to fix the immediate frustrations I was dealing with, then revamping these instructions for pyenv in a later PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, but I wouldn't over-index on Ubuntu 24.04 and Python 3.12.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I like just linking to pyenv and saying it's a good tool to use for managing multiple python environments. Probably too verbose for our docs, but if you wanted to check it out, here are some setup instructions:

Pre-Reqs for ubuntu from their wiki

sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Installing pyenv from instructions here

curl https://pyenv.run | bash

Add to .bashrc

It's also outputted by installer after running installation:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc

Run source ~/.bashrc

source ~/.bashrc

Check installation

pyenv --version

Install whichever version you need (i.e. for 3.12)

pyenv install 3.12

Set as local version

In your workspace:

pyenv local 3.12

Check python version

python --version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup i saw those. Made this based on that:

#585

Turns out pyenv can be just an extra step you do to replace python3-venv

I think we should just do venv for simplicity's sake but i'll add a lil click-expand section on using pyenv

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 that seems reasonable to focus on venv and just point to pyenv as an option. This is the same idea we did in other places.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out pyenv can be just an extra step you do to replace python3-venv

I think we should just do venv for simplicity's sake but i'll add a lil click-expand section on using pyenv

pyenv and venv are different. Prior discussion in this repo: #524 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. mybad. not replace, but supplement.

Repalces python-is-python3, and docs adjusted accordingly.

@renxida renxida force-pushed the add-linux-prep-instructions-to-developer-guide branch from fdff368 to 478020e Compare November 21, 2024 22:03
(these instructions are tested on Ubuntu 24.04 which has clang-18 and python3.12 by default)

```
sudo apt update && sudo apt install -y python-is-python3 python3.12-venv python3-dev clang lld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 that seems reasonable to focus on venv and just point to pyenv as an option. This is the same idea we did in other places.

docs/developer_guide.md Outdated Show resolved Hide resolved
@renxida
Copy link
Contributor Author

renxida commented Nov 21, 2024

Edits incorporated & pls re-review.

Copy link
Contributor

@amd-chrissosa amd-chrissosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but you want to wait for Scott's approval

@renxida renxida merged commit c8738b7 into nod-ai:main Nov 21, 2024
6 checks passed
Comment on lines +24 to +49
<summary> Or, alternatively, use `pyenv` to manage a separate python installation for more control over its version: </summary>


First, install pyenv and its dependencies.

```bash
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl git \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
curl https://pyenv.run | bash
```

Then, make pyenv available by adding the below to your `~/.bashrc`:

```bash
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
```

Finally, install a pyenv-managed version of python

```bash
pyenv install 3.12 # or whichever python version you'd like
pyenv local 3.12
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least link to the upstream documentation here. I wouldn't even include the inlined copy of their docs, but that's up to you. Each line of documentation we add here is an extra line of documentation to keep from going stale. Direct people to upstream, which will actually be maintained.

Comment on lines +18 to +20
```
python-is-python3 python3-venv python3-dev
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefix these with sudo apt install

Also nit: set the syntax for code blocks (```bash)

@renxida
Copy link
Contributor Author

renxida commented Nov 21, 2024

ack merged before i saw Chris's comment. Let me incorporate the comments in another PR,

renxida added a commit that referenced this pull request Nov 22, 2024
…e of merge (#588)

[skip ci]

Clicked merge before some of #575 's comments showed up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants