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

Fix octoprint versioning by checking python version #54

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,26 @@ pip install --upgrade pip

#### 2. Install Octoprint:

`pip install Octoprint==1.8.1`
⚠️ Since Octoprint 1.8.x is not compatible with python 3.11 and higher, you will have to check your python version using this command:

`python --version`


<details>
<summary> If your python version is `<= 3.10` </summary>

```bash
pip install Octoprint==1.8.1
```

</details>
<details>
<summary> Else if you are using python `>= 3.11` </summary>

```bash
pip install Octoprint==1.9.3
```
</details>

#### 3. Create octoprint service:

Expand Down
18 changes: 13 additions & 5 deletions scripts/2_octoprint_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,19 @@ echo " "
echo " Sit tight... "
echo " "

wget https://github.com/OctoPrint/OctoPrint/archive/refs/tags/1.8.4.zip -P /root
unzip /root/1.8.4.zip -d /root
cd /root/OctoPrint-1.8.4
python /root/OctoPrint-1.8.4/setup.py install

# Get the current Python version
PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'`

echo "Python version: $PYTHON_VERSION"

# Compare the current Python version is greater than or equal to 3.11.0, install OctoPrint 1.9.3 else install OctoPrint 1.8.1
if [ "$(printf '%s\n' "$PYTHON_VERSION" "3.11.0" | sort -V | head -n1)" = "3.11.0" ]; then
echo "Python version is greater than or equal to 3.11.0, installing OctoPrint 1.9.3"
pip install octoprint:1.9.3
else
echo "Python version is less than 3.11.0, installing OctoPrint 1.8.1"
pip install octoprint:1.8.1
fi

cd /

Expand Down