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

Setup: Add venv for Ubuntu Noble (24.04 LTS) #6235

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

TunaLobster
Copy link
Contributor

This is an update to #5481 for LTS Noble.

Same ideas and problems being solved here.

Sphinxsetup.sh Outdated
# Install flake8
python3 -m pip install --user --upgrade flake8==3.7.9
python3 -m pip install $PIP_USER_ARGUMENT --upgrade sphinx==${SPHINX_VERSION} "docutils<0.19" "requests>=2.31.0" sphinx-tabs==3.* lxml git+https://github.com/ArduPilot/sphinx_rtd_theme.git git+https://github.com/ArduPilot/sphinxcontrib-youtube.git beautifulsoup4 flake8==3.7.9
Copy link
Contributor

Choose a reason for hiding this comment

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

Please leave these as separate lines.

The efficiency is in no way important for this script, and it's easier to tell what's gone wrong with the separate lines.

It's also easier to tell exactly what's going on with the separate lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I put them together as pip has a much improved dependency resolver that can handle version conflicts when given all of the information. I can separate them out. I'm going to update #4642 next to move the list of packages to something common between setup scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I follow. With the current --upgrade option doing this on separate lines could result in different behavior as follow on pip install commands do not take into account the previously commanded pinning. Only when given all packages at once can the dependency resolver correctly do both updating and pinning.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, pip will remove pins if you pass --upgrade and are specifying a specific package?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say that isn't a bad idea to regroup things together

update.sh Outdated Show resolved Hide resolved
Sphinxsetup.sh Outdated
@@ -10,14 +10,24 @@ fi
DISTRIBUTION_ID=$(lsb_release -i -s)
if [ ${DISTRIBUTION_ID} = 'Ubuntu' ]; then
DISTRIBUTION_CODENAME=$(lsb_release -c -s)
if [ ${DISTRIBUTION_CODENAME} = 'focal' ] || [ ${DISTRIBUTION_CODENAME} = 'bionic' ]; then
sudo add-apt-repository universe
if [ ${DISTRIBUTION_CODENAME} = 'focal' ] || [ ${DISTRIBUTION_CODENAME} = 'bionic' ] || [ ${DISTRIBUTION_CODENAME} = 'noble' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need universe for noble?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I scanned my installed packages with aptitude search '?section (multiverse) ?installed' and only got steam and lutris things back. Removing for nobel.

@Hwurzburg
Copy link
Contributor

@peterbarker @khancyr awaiting approvals

@peterbarker
Copy link
Contributor

@peterbarker @khancyr awaiting approvals

... want to know the impact of --upgrade XYZZY on packages which are not XYZZY and have been pinned

@khancyr
Copy link
Contributor

khancyr commented Sep 23, 2024

╭─khancyr@MAN-LP-0101 /mnt/c/Documents and Settings/PierreKancir/Downloads/logs
╰─$ sudo pip install -U pymavlink==2.4.13
Requirement already satisfied: pymavlink==2.4.13 in /usr/local/lib/python3.10/dist-packages (2.4.13)
Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from pymavlink==2.4.13) (0.18.3)
Requirement already satisfied: lxml in /usr/lib/python3/dist-packages (from pymavlink==2.4.13) (4.8.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
╭─khancyr@MAN-LP-0101 /mnt/c/Documents and Settings/PierreKancir/Downloads/logs
╰─$ sudo pip install -U mavproxy
Collecting mavproxy
  Using cached MAVProxy-1.8.71-py3-none-any.whl (7.2 MB)
Requirement already satisfied: pyserial>=3.0 in /usr/lib/python3/dist-packages (from mavproxy) (3.5)
Collecting pymavlink>=2.4.14
  Using cached pymavlink-2.4.41-py3-none-any.whl (11.6 MB)
Requirement already satisfied: pynmeagps in /usr/local/lib/python3.10/dist-packages (from mavproxy) (1.0.39)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from mavproxy) (1.21.5)
Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from pymavlink>=2.4.14->mavproxy) (0.18.3)
Requirement already satisfied: lxml in /usr/lib/python3/dist-packages (from pymavlink>=2.4.14->mavproxy) (4.8.0)
Installing collected packages: pymavlink, mavproxy
  Attempting uninstall: pymavlink
    Found existing installation: pymavlink 2.4.13
    Uninstalling pymavlink-2.4.13:
      Successfully uninstalled pymavlink-2.4.13
Successfully installed mavproxy-1.8.71 pymavlink-2.4.41
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Pining only works for the current cmdline, so any further pip install -U will remove the pining to satisfy the dependency.
If you try sudo pip install -U pymavlink==2.4.13 mavproxy it will look for the mavproxy version that is compatibles with the pinned pymavlink

@peterbarker
Copy link
Contributor

╭─khancyr@MAN-LP-0101 /mnt/c/Documents and Settings/PierreKancir/Downloads/logs
╰─$ sudo pip install -U pymavlink==2.4.13
Requirement already satisfied: pymavlink==2.4.13 in /usr/local/lib/python3.10/dist-packages (2.4.13)
Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from pymavlink==2.4.13) (0.18.3)
Requirement already satisfied: lxml in /usr/lib/python3/dist-packages (from pymavlink==2.4.13) (4.8.0)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
╭─khancyr@MAN-LP-0101 /mnt/c/Documents and Settings/PierreKancir/Downloads/logs
╰─$ sudo pip install -U mavproxy
Collecting mavproxy
  Using cached MAVProxy-1.8.71-py3-none-any.whl (7.2 MB)
Requirement already satisfied: pyserial>=3.0 in /usr/lib/python3/dist-packages (from mavproxy) (3.5)
Collecting pymavlink>=2.4.14
  Using cached pymavlink-2.4.41-py3-none-any.whl (11.6 MB)
Requirement already satisfied: pynmeagps in /usr/local/lib/python3.10/dist-packages (from mavproxy) (1.0.39)
Requirement already satisfied: numpy in /usr/lib/python3/dist-packages (from mavproxy) (1.21.5)
Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from pymavlink>=2.4.14->mavproxy) (0.18.3)
Requirement already satisfied: lxml in /usr/lib/python3/dist-packages (from pymavlink>=2.4.14->mavproxy) (4.8.0)
Installing collected packages: pymavlink, mavproxy
  Attempting uninstall: pymavlink
    Found existing installation: pymavlink 2.4.13
    Uninstalling pymavlink-2.4.13:
      Successfully uninstalled pymavlink-2.4.13
Successfully installed mavproxy-1.8.71 pymavlink-2.4.41
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Pining only works for the current cmdline, so any further pip install -U will remove the pining to satisfy the dependency. If you try sudo pip install -U pymavlink==2.4.13 mavproxy it will look for the mavproxy version that is compatibles with the pinned pymavlink

OK, thanks for checking.

I guess I have to withdraw my objections to the one-line thing, 'though it makes it a PITA to work out what the problems are. Could we at least use \ to separate the packages onto separate lines to make it easie to see them all at a glance?

@TunaLobster TunaLobster force-pushed the pr/venv-lunar branch 2 times, most recently from 3d74a67 to 6357b52 Compare October 8, 2024 01:02
@TunaLobster
Copy link
Contributor Author

This should be good as is. I think a better way would be to check if the year of the Ubuntu release is greater than 24. That would keep it working on the non-LTS releases too.

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